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

client/retry: only return the latest error in backoffer #8227

Merged
merged 3 commits into from
May 31, 2024

Conversation

JmPotato
Copy link
Member

@JmPotato JmPotato commented May 30, 2024

What problem does this PR solve?

Issue Number: ref #8142.

What is changed and how does it work?

Due to the return of historical errors causing the client's retry logic to fail,
and since we currently do not need to obtain all errors during retries, this PR
removes `multierr` from backoffer and add tests to ensure the correctness of the retry logic.

Check List

Tests

  • Unit test
  • Integration test

Release note

Fix the bug where HTTP client retry logic is ineffective.

@JmPotato JmPotato added the component/client Client logic. label May 30, 2024
@JmPotato JmPotato requested review from rleungx and HuSharp May 30, 2024 06:42
Copy link
Contributor

ti-chi-bot bot commented May 30, 2024

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • HuSharp
  • rleungx

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 30, 2024
@JmPotato JmPotato requested a review from nolouch May 30, 2024 06:50
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 30, 2024
@JmPotato JmPotato force-pushed the remove_multierr branch 2 times, most recently from 612870a to ce72132 Compare May 30, 2024 07:21
@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 30, 2024
// SetRetryableChecker sets the retryable checker.
func (bo *Backoffer) SetRetryableChecker(checker func(err error) bool) {
// SetRetryableChecker sets the retryable checker, `overwrite` flag is used to indicate whether to overwrite the existing checker.
func (bo *Backoffer) SetRetryableChecker(checker func(err error) bool, overwrite bool) {
Copy link
Member

@okJiang okJiang May 30, 2024

Choose a reason for hiding this comment

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

Isn't overwrite over-designed? Because now there is only one call

Copy link
Member Author

Choose a reason for hiding this comment

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

The SetRetryableChecker function might be invoked by higher-level callers such as BR, Lightning, or TiDB. I added this flag to ensure the caller-set checker is not overwritten unexpectedly.

client/retry/backoff.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented May 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.38%. Comparing base (632cda4) to head (cbbf78b).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8227      +/-   ##
==========================================
+ Coverage   77.32%   77.38%   +0.06%     
==========================================
  Files         470      471       +1     
  Lines       61340    61346       +6     
==========================================
+ Hits        47431    47475      +44     
+ Misses      10331    10303      -28     
+ Partials     3578     3568      -10     
Flag Coverage Δ
unittests 77.38% <100.00%> (+0.06%) ⬆️

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

Copy link
Contributor

ti-chi-bot bot commented May 31, 2024

@okJiang: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 31, 2024
@JmPotato
Copy link
Member Author

/merge

Copy link
Contributor

ti-chi-bot bot commented May 31, 2024

@JmPotato: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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 ti-community-infra/tichi repository.

Copy link
Contributor

ti-chi-bot bot commented May 31, 2024

This pull request has been accepted and is ready to merge.

Commit hash: 5126a32

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label May 31, 2024
@ti-chi-bot ti-chi-bot bot merged commit 199b017 into tikv:master May 31, 2024
15 checks passed
@JmPotato JmPotato deleted the remove_multierr branch May 31, 2024 08:30
@ti-chi-bot ti-chi-bot added the needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. label Jul 31, 2024
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Jul 31, 2024
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.1: #8465.

JmPotato added a commit to ti-chi-bot/pd that referenced this pull request Aug 6, 2024
JmPotato added a commit to ti-chi-bot/pd that referenced this pull request Aug 6, 2024
JmPotato added a commit to ti-chi-bot/pd that referenced this pull request Aug 6, 2024
JmPotato added a commit to ti-chi-bot/pd that referenced this pull request Aug 6, 2024
ti-chi-bot bot pushed a commit that referenced this pull request Aug 6, 2024
ref #8142, close #8499

Due to the return of historical errors causing the client's retry logic to fail,
and since we currently do not need to obtain all errors during retries, this PR
removes `multierr` from backoffer and add tests to ensure the correctness of the retry logic.

Signed-off-by: JmPotato <[email protected]>

Co-authored-by: JmPotato <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/client Client logic. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants