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: refactor error handle mechanism to tolerant unexpect kv errors. #48646

Merged
merged 16 commits into from
Dec 8, 2023

Conversation

3pointer
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #47656

Problem Summary:
record the state of unknown kv error and give some tolerance of these unknown error.

What is changed and how it works?

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.

None

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Nov 16, 2023
Copy link

ti-chi-bot bot commented Nov 16, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. release-note-none Denotes a PR that doesn't merit a release note. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 16, 2023
Copy link

tiprow bot commented Nov 16, 2023

Hi @3pointer. 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/test-infra repository.

@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 5, 2023
@3pointer 3pointer marked this pull request as ready for review December 5, 2023 06:46
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 5, 2023
Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Merging #48646 (7d10267) into master (28cb579) will increase coverage by 1.0382%.
Report is 32 commits behind head on master.
The diff coverage is 0.0000%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #48646        +/-   ##
================================================
+ Coverage   71.0454%   72.0836%   +1.0382%     
================================================
  Files          1368       1407        +39     
  Lines        402969     417762     +14793     
================================================
+ Hits         286291     301138     +14847     
- Misses        96737      97753      +1016     
+ Partials      19941      18871      -1070     
Flag Coverage Δ
integration 43.8085% <0.0000%> (?)
unit 71.0510% <ø> (+0.0056%) ⬆️

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

Components Coverage Δ
dumpling 53.9663% <ø> (ø)
parser ∅ <ø> (∅)
br 47.9098% <0.0000%> (-5.0616%) ⬇️

Copy link
Contributor

@YuJuncen YuJuncen 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


const (
// This type can be retry but consume the backoffer attempts.
Retry ErrorStrategy = iota
Copy link
Contributor

Choose a reason for hiding this comment

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

I will prefer add a prefix Strategy to this or extract this retry related utilities to another package. utils.Retry looks like a function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nailed it

if messageIsNotFoundStorageError(msg) {
reason := fmt.Sprintf("File or directory not found on TiKV Node (store id: %v). "+
"work around:please ensure br and tikv nodes share a same storage and the user of br and tikv has same uid.",
uuid)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why store id is a uuid?🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because during restore. we cannot get store id

return ErrorResult{GiveUp, "unknown error and retry too many times, give up"}
}

func (ec *ErrorContext) HandleErrorPb(e *backuppb.Error, uuid uint64, canIgnore bool) ErrorResult {
Copy link
Contributor

Choose a reason for hiding this comment

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

canIgnore looks so magical here, I guess it should be the requirement of the coarse-grained backup. I will prefer make another function to handle the scenario.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pushBackup need it, but fine-grained doesn't. Do you think make it a field of errContext is better?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can make two functions: HandleErrAndIgnoreStoreErrors and HandleErr or something. 🤔

Copy link

ti-chi-bot bot commented Dec 7, 2023

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-tests-checked label, please finished the tests then check the finished items in description.

For example:

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

📖 For more info, you can check the "Contribute Code" section in the development guide.

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 7, 2023
Copy link

ti-chi-bot bot commented Dec 7, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Leavrth, YuJuncen

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 7, 2023
Copy link

ti-chi-bot bot commented Dec 7, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-12-07 03:37:08.110530446 +0000 UTC m=+1671456.775756642: ☑️ agreed by Leavrth.
  • 2023-12-07 04:01:23.63277732 +0000 UTC m=+1672912.298003512: ☑️ agreed by YuJuncen.

@3pointer
Copy link
Contributor Author

3pointer commented Dec 8, 2023

/test mysql-test

Copy link

tiprow bot commented Dec 8, 2023

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

In response to this:

/test mysql-test

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/test-infra repository.

@ti-chi-bot ti-chi-bot bot merged commit 6c30c6e into pingcap:master Dec 8, 2023
27 of 31 checks passed
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Dec 8, 2023
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Dec 8, 2023
@3pointer 3pointer added the needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. label Feb 4, 2024
@ti-chi-bot
Copy link
Member

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

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. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A better error handling on backup & restore.
4 participants