-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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: use common scan-split-scatter logic #52433
Conversation
Signed-off-by: lance6716 <lance6716@gmail.com>
/test pull-br-integration-test |
Hi @lance6716. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with 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. |
@lance6716: Cannot trigger testing until a trusted user reviews the PR and leaves an 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 kubernetes/test-infra repository. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #52433 +/- ##
================================================
+ Coverage 72.1392% 75.0279% +2.8886%
================================================
Files 1467 1467
Lines 426844 427329 +485
================================================
+ Hits 307922 320616 +12694
+ Misses 99686 86516 -13170
- Partials 19236 20197 +961
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/ok-to-test |
/test pull-br-integration-test |
@lance6716: The specified target(s) for
Use 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 kubernetes/test-infra repository. |
/test pull-br-integration-test |
@lance6716: The specified target(s) for
Use 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 kubernetes/test-infra repository. |
@@ -125,14 +106,14 @@ func (rs *RegionSplitter) executeSplitByRanges( | |||
roughSortedSplitKeys = append(roughSortedSplitKeys, sortedKeys[curRegionIndex]) | |||
} | |||
if len(roughSortedSplitKeys) > 0 { | |||
if err := rs.executeSplitByKeys(ctx, splitContext, scanStartKey, roughSortedSplitKeys); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scanStartKey
is the start key. but sortedKeys
are all end keys. if didn't scan with start key will cause error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need to split the scanStartKey
so theoretically we don't need to care about it. For the error I should have fixed in
tidb/br/pkg/restore/split/client.go
Lines 541 to 548 in da775f6
// we need to find the regions that contain the split keys. However, the scan | |
// region API accepts a key range [start, end) where end key is exclusive, and if | |
// sortedSplitKeys length is 1, we scan region may return empty result. So we | |
// increase the end key a bit. If the end key is on the region boundaries, it | |
// will be skipped by getSplitKeysOfRegions. | |
scanStart := codec.EncodeBytesExt(nil, sortedSplitKeys[0], c.isRawKv) | |
lastKey := kv.Key(sortedSplitKeys[len(sortedSplitKeys)-1]) | |
scanEnd := codec.EncodeBytesExt(nil, lastKey.Next(), c.isRawKv) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update: I fixed a bug and add tests in 59e6f0f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, We need make sure not use same key as start/end key to scan regions. or we will get an error from PD. I assume here is no chance to get a slice with only one nil/"" value in it.
Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
@lance6716: The following test failed, say
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. |
br/pkg/restore/split.go
Outdated
@@ -409,7 +338,7 @@ func (helper *LogSplitHelper) splitRegionByPoints( | |||
} | |||
|
|||
helper.pool.ApplyOnErrorGroup(helper.eg, func() error { | |||
newRegions, errSplit := regionSplitter.splitAndScatterRegions(ctx, region, splitPoints, false) | |||
newRegions, errSplit := regionSplitter.splitAndScatterRegions(ctx, region, splitPoints) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it can directly call regionSplitter.client.SplitWaitAndScatter
and the function splitAndScatterRegions
can be removed.
Signed-off-by: lance6716 <lance6716@gmail.com>
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 3pointer, lance6716, Leavrth 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 |
What problem does this PR solve?
Issue Number: ref #51533
Problem Summary:
What changed and how does it work?
Check List
Tests
BR CI https://do.pingcap.net/jenkins/blue/organizations/jenkins/pingcap%2Ftidb%2Fpull_br_integration_test/detail/pull_br_integration_test/102/pipeline
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.