Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: closed immediately if error rate is changed to 0 #8887

Merged
merged 4 commits into from
Dec 18, 2024

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Dec 10, 2024

What problem does this PR solve?

Issue Number: Ref #8678.

What is changed and how does it work?

This PR does the following changes:

  1. add more tests for the circuit breaker.
  2. change to closed state immediately if the error rate is changed to 0

Check List

Tests

  • Unit test

Release note

None.

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 10, 2024
Copy link

codecov bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.27%. Comparing base (88a761e) to head (2dfe3dd).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8887      +/-   ##
==========================================
+ Coverage   76.25%   76.27%   +0.01%     
==========================================
  Files         461      461              
  Lines       70399    70407       +8     
==========================================
+ Hits        53685    53702      +17     
+ Misses      13366    13355      -11     
- Partials     3348     3350       +2     
Flag Coverage Δ
unittests 76.27% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@rleungx rleungx requested review from nolouch and okJiang December 10, 2024 06:42
Copy link
Member

@okJiang okJiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, cc @Tema

@rleungx rleungx changed the title *: open immediately if error rate is changed to 0 *: closed immediately if error rate is changed to 0 Dec 10, 2024
@Tema
Copy link
Contributor

Tema commented Dec 13, 2024

Good idea. LGTM

Copy link
Contributor

ti-chi-bot bot commented Dec 13, 2024

@Tema: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@@ -19,13 +19,11 @@ import (
"sync"
"time"

"github.com/tikv/pd/client/errs"

"github.com/pingcap/log"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't we enforce the order in CI?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I add a linter for it, see #8925

Comment on lines +270 to +274
if s.cb.config.ErrorRateThresholdPct == 0 {
return cb.newState(now, StateClosed), nil
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to and a simple test circuit_brealer_test.go to cover it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added, PTAL

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Dec 16, 2024
@rleungx rleungx mentioned this pull request Dec 17, 2024
@rleungx
Copy link
Member Author

rleungx commented Dec 17, 2024

/retest

Copy link
Contributor

ti-chi-bot bot commented Dec 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nolouch, okJiang, Tema

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 18, 2024
Copy link
Contributor

ti-chi-bot bot commented Dec 18, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-16 03:14:27.666268655 +0000 UTC m=+840257.755071197: ☑️ agreed by nolouch.
  • 2024-12-18 02:52:46.927605985 +0000 UTC m=+1011757.016408518: ☑️ agreed by okJiang.

@ti-chi-bot ti-chi-bot bot merged commit 2d970a6 into tikv:master Dec 18, 2024
25 checks passed
@rleungx rleungx deleted the test-cb branch December 18, 2024 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants