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: cli refactor backup error handling logic #54697

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Tristan1900
Copy link

@Tristan1900 Tristan1900 commented Jul 17, 2024

What problem does this PR solve?

Issue Number: close #54696

Problem Summary:

What changed and how does it work?

  1. Moved backup specific error handling logic out of the retry file, since the retry is shared by other usages as well.
  2. Renamed the method and a few other variables.
  3. Move as much as possible of hardcoded strings to be const so unit test can use
  4. Delete unused methods, handleErrorPb and HandleError
  5. Delete and move the permission file, as in the file only one method is related to permission.

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

NA

Copy link

ti-chi-bot bot commented Jul 17, 2024

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

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 do-not-merge/invalid-title do-not-merge/needs-linked-issue do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jul 17, 2024
Copy link

ti-chi-bot bot commented Jul 17, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign 3pointer for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@sre-bot
Copy link
Contributor

sre-bot commented Jul 17, 2024

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jul 17, 2024
Copy link

tiprow bot commented Jul 17, 2024

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.

@Tristan1900 Tristan1900 changed the title br cli refactor backup error handling logic br: cli refactor backup error handling logic Jul 17, 2024
}

// messageIsNotFoundStorageError checks whether the message returning from TiKV is "NotFound" storage I/O error
func messageIsNotFoundStorageError(msg string) bool {
Copy link
Author

@Tristan1900 Tristan1900 Jul 17, 2024

Choose a reason for hiding this comment

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

@3pointer does the storage here mean S3 or any backup destination? At first I thought it's TiKV internal but there is a proto type for it already so got a bit confused. Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

at this context storage means TiKV.

Copy link

codecov bot commented Jul 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.4630%. Comparing base (eab8700) to head (6b994c9).

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #54697         +/-   ##
=================================================
- Coverage   72.8958%   56.4630%   -16.4329%     
=================================================
  Files          1552       1674        +122     
  Lines        437298     609406     +172108     
=================================================
+ Hits         318772     344089      +25317     
- Misses        99002     241622     +142620     
- Partials      19524      23695       +4171     
Flag Coverage Δ
integration 38.2258% <65.8227%> (?)
unit 71.7056% <100.0000%> (-0.2295%) ⬇️

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

Components Coverage Δ
dumpling 52.9656% <ø> (ø)
parser ∅ <ø> (∅)
br 62.7950% <100.0000%> (+16.9003%) ⬆️

@@ -0,0 +1,181 @@
package utils
Copy link
Contributor

Choose a reason for hiding this comment

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

new file should add license first, you can copy from other files.

Copy link
Author

Choose a reason for hiding this comment

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

ah! good catch

}

// messageIsNotFoundStorageError checks whether the message returning from TiKV is "NotFound" storage I/O error
func messageIsNotFoundStorageError(msg string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

at this context storage means TiKV.

@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 18, 2024
Copy link

ti-chi-bot bot commented Jul 18, 2024

PR needs rebase.

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.

Signed-off-by: Wenqi Mou <[email protected]>
Signed-off-by: Wenqi Mou <[email protected]>
Signed-off-by: Wenqi Mou <[email protected]>
Signed-off-by: Wenqi Mou <[email protected]>
@Tristan1900 Tristan1900 force-pushed the br-refactor-backup-error-handling branch from 0387ae6 to 62b39d0 Compare July 18, 2024 17:23
Signed-off-by: Wenqi Mou <[email protected]>
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 (
// Retry error can be retried but will consume the backoff attempt quota.
Retry ErrorHandlingStrategy = iota
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps use StrategyRetry so we can know its type when using outside this package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

br: refactor br cli backup error handling logic
4 participants