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

backup: advacned prepare implementation #48439

Merged
merged 39 commits into from
Jan 17, 2024

Conversation

YuJuncen
Copy link
Contributor

@YuJuncen YuJuncen commented Nov 8, 2023

What problem does this PR solve?

Issue Number: close #50359

Problem Summary:
This PR implemented the client side of the enhanced prepare stage of snapshot backup.

What is changed and how it works?

Generally this is a state machine that tries to collect the whole range. If a region has applied to the last index, the region's range will be collected. When the whole key space has been collected, we are done.

Check List

Tests

  • Unit test (TBD)
  • 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/invalid-title do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 8, 2023
Copy link

tiprow bot commented Nov 8, 2023

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

@YuJuncen YuJuncen changed the title Advacned prepare backup: advacned prepare implementation Nov 8, 2023
@YuJuncen
Copy link
Contributor Author

/build

Copy link

codecov bot commented Nov 17, 2023

Codecov Report

Merging #48439 (7a2948e) into master (9fb89b0) will decrease coverage by 14.5137%.
Report is 23 commits behind head on master.
The diff coverage is 69.2041%.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #48439         +/-   ##
=================================================
- Coverage   70.0608%   55.5471%   -14.5137%     
=================================================
  Files          1445       1563        +118     
  Lines        420102     587661     +167559     
=================================================
+ Hits         294327     326429      +32102     
- Misses       105477     238413     +132936     
- Partials      20298      22819       +2521     
Flag Coverage Δ
integration 36.7136% <48.9619%> (?)
unit 70.1537% <59.6885%> (+0.0929%) ⬆️

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

Components Coverage Δ
dumpling 54.0269% <ø> (ø)
parser ∅ <ø> (∅)
br 56.4434% <69.1228%> (+6.8186%) ⬆️

@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 Nov 20, 2023
bo := tikv.NewBackoffer(ctx, regionCacheMaxBackoffMs)
if len(endKey) == 0 {
// This is encoded [0xff; 8].
// Workaround for https://github.com/tikv/client-go/issues/1051.
Copy link
Contributor

Choose a reason for hiding this comment

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

This issue has been fixed, can we remove the workaround and upgrade client-go?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That may not be picked to release version and upgrading client-go may have other side effects. I think we'd better keep this unchanged for the consistency between all versions.

}

func (p *prepareStream) convertToEvent(resp *brpb.PrepareSnapshotBackupResponse) (event, bool) {
switch resp.Ty {
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the response type of PrepareSnapshotBackupRequestType_Finish?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update lease result.

p.nextRetry = time.NewTimer(p.RetryBackoff)
return nil
}
if item, ok := p.waitApplyDoneRegions.ReplaceOrInsert(r); ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

when overlapped happened. Do we need set overlapped range to fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If that range is larger, it may be retry after we checking the holes in AdvanceStep, if it is smaller, I think it can be ignored.


func (s SplitRequestClient) Send(req *brpb.PrepareSnapshotBackupRequest) error {
// Try best to keeping the request untouched.
rs := req.Regions
Copy link
Contributor

Choose a reason for hiding this comment

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

seems it canbe moved into if req.Ty == xxxxx, :)

Copy link
Contributor

@3pointer 3pointer 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

Copy link

ti-chi-bot bot commented Jan 17, 2024

[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 approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 17, 2024
Copy link

ti-chi-bot bot commented Jan 17, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-01-17 10:10:15.027941251 +0000 UTC m=+350656.592238956: ☑️ agreed by BornChanger.
  • 2024-01-17 10:55:10.392956378 +0000 UTC m=+353351.957254082: ☑️ agreed by 3pointer.

Copy link

tiprow bot commented Jan 17, 2024

@YuJuncen: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
tiprow_fast_test b13969c link true /test tiprow_fast_test

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

Signed-off-by: hillium <[email protected]>
@ti-chi-bot ti-chi-bot bot merged commit bbbada0 into pingcap:master Jan 17, 2024
22 checks passed
@BornChanger
Copy link
Contributor

/label needs-cherry-pick-release-6.5

@ti-chi-bot ti-chi-bot bot added the needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. label Jan 17, 2024
@BornChanger
Copy link
Contributor

/label needs-cherry-pick-release-7.1

@ti-chi-bot ti-chi-bot bot added the needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. label Jan 17, 2024
@BornChanger
Copy link
Contributor

needs-cherry-pick-release-7.5

@ti-chi-bot
Copy link
Member

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

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

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

ti-chi-bot bot pushed a commit that referenced this pull request Jan 18, 2024
YuJuncen added a commit to ti-chi-bot/tidb that referenced this pull request Feb 20, 2024
guoshouyan pushed a commit to guoshouyan/tidb that referenced this pull request Mar 5, 2024
@BornChanger BornChanger added the needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. label Apr 12, 2024
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Apr 12, 2024
@ti-chi-bot ti-chi-bot bot removed the needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. label Nov 7, 2024
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.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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement the client of stopping merge / conf-change
6 participants