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

br: add retry for raw kv client put #58963

Merged
merged 3 commits into from
Jan 21, 2025

Conversation

Tristan1900
Copy link
Contributor

@Tristan1900 Tristan1900 commented Jan 15, 2025

What problem does this PR solve?

Issue Number: close #58845

Problem Summary:

What changed and how does it work?

Adds a retry logic in raw kv client to mask temporary connection error from the client_go library

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

Adds retry logic for raw kv client put operation when doing log meta restore to mask any temporary errors from the client_go (tikv) library

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-tests-checked do-not-merge/needs-triage-completed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed do-not-merge/needs-tests-checked labels Jan 15, 2025
Copy link

tiprow bot commented Jan 15, 2025

Hi @Tristan1900. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

@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. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jan 15, 2025
Copy link

codecov bot commented Jan 15, 2025

Codecov Report

Attention: Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.

Project coverage is 74.6823%. Comparing base (20e6bd2) to head (05a0f78).
Report is 17 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58963        +/-   ##
================================================
+ Coverage   73.0261%   74.6823%   +1.6561%     
================================================
  Files          1684       1731        +47     
  Lines        465659     475625      +9966     
================================================
+ Hits         340053     355208     +15155     
+ Misses       104692      97961      -6731     
- Partials      20914      22456      +1542     
Flag Coverage Δ
integration 48.7170% <77.7777%> (?)
unit 72.2103% <94.4444%> (-0.0035%) ⬇️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 61.1010% <94.4444%> (+15.8057%) ⬆️


func PutRawKvWithRetry(ctx context.Context, client *rawkv.RawKVBatchClient, key, value []byte, originTs uint64) error {
retry := utils.InitialRetryState(rawKVMaxRetries, rawKVInitialRetryInterval, rawKVMaxRetryInterval)
for retry.ShouldRetry() {
Copy link
Contributor

Choose a reason for hiding this comment

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

you can use utils.WithRetry if you define the InitialRetryState.

Signed-off-by: Wenqi Mou <[email protected]>
Copy link
Contributor

@BornChanger BornChanger left a comment

Choose a reason for hiding this comment

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

rest lgtm.

@BornChanger
Copy link
Contributor

/retest

Copy link

tiprow bot commented Jan 17, 2025

@BornChanger: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@BornChanger
Copy link
Contributor

/retest

Copy link

tiprow bot commented Jan 17, 2025

@BornChanger: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

Signed-off-by: Wenqi Mou <[email protected]>
@Tristan1900
Copy link
Contributor Author

@BornChanger @3pointer please take another look when you get a chance, thanks!

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 20, 2025
@BornChanger BornChanger requested a review from 3pointer January 21, 2025 03:09
@@ -53,6 +53,10 @@ const (
recoveryMaxAttempts = 16
recoveryDelayTime = 30 * time.Second
recoveryMaxDelayTime = 4 * time.Minute

rawClientMaxAttempts = 5
Copy link
Contributor

@3pointer 3pointer Jan 21, 2025

Choose a reason for hiding this comment

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

is 5 times(12~13s) retry enough for the special workload?

prefer make it longer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's mainly for retrying on removing the idle connection and create a new connection, I think it should be done within seconds, setting total retry to be >10s should be safe.

Copy link

ti-chi-bot bot commented Jan 21, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 3pointer, BornChanger

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 Jan 21, 2025
Copy link

ti-chi-bot bot commented Jan 21, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-01-20 03:06:54.72819794 +0000 UTC m=+63742.059117341: ☑️ agreed by BornChanger.
  • 2025-01-21 03:23:23.75113324 +0000 UTC m=+151131.082052641: ☑️ agreed by 3pointer.

@BornChanger BornChanger added needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. labels Jan 21, 2025
@ti-chi-bot ti-chi-bot bot merged commit 3a378c8 into pingcap:master Jan 21, 2025
42 checks passed
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jan 21, 2025
@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jan 21, 2025
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jan 21, 2025
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jan 21, 2025
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jan 21, 2025
@ti-chi-bot
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

br: got rpcClient is idle error during log meta restore
4 participants