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 region range check for batch scan regions #27192

Merged
merged 14 commits into from
Aug 14, 2021

Conversation

glorv
Copy link
Contributor

@glorv glorv commented Aug 13, 2021

What problem does this PR solve?

Currently, the implement of pd's batch scan regions can't guarantee consistency, so we add extra check for return returned region [startKey, endKey) check to ensure if there are potential range gap, the method will return an error.

What is changed and how it works?

Proposal: xxx

What's Changed:

How it Works:

Check List

Tests

  • Unit test
  • Integration test

Side effects

Documentation

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 13, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • 3pointer
  • YuJuncen

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 13, 2021
@glorv
Copy link
Contributor Author

glorv commented Aug 13, 2021

/component br

@ti-chi-bot ti-chi-bot added the component/br This issue is related to BR of TiDB. label Aug 13, 2021
@glorv
Copy link
Contributor Author

glorv commented Aug 13, 2021

/sig migrate

@glorv
Copy link
Contributor Author

glorv commented Aug 13, 2021

/assign @kennytm @3pointer

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


// current pd can't guarantee the consistency of returned regions
if len(regions) == 0 {
return nil, errors.New("scan region return empty result")
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe a normalized error (i.e. berror.Errxxx) here?

@@ -225,8 +225,7 @@ func (s *testRestoreUtilSuite) TestPaginateScanRegion(c *C) {
regionMap := make(map[uint64]*restore.RegionInfo)
regions := []*restore.RegionInfo{}
batch, err := restore.PaginateScanRegion(ctx, NewTestClient(stores, regionMap, 0), []byte{}, []byte{}, 3)
c.Assert(err, IsNil)
c.Assert(batch, DeepEquals, regions)
c.Assert(err, ErrorMatches, ".*scan region return empty result.*")
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a case testing holes found during scanning regions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@zhouqiang-cl zhouqiang-cl added the cherry-pick-approved Cherry pick PR approved by release team. label Aug 13, 2021
@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 13, 2021
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 13, 2021
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Aug 13, 2021
@glorv
Copy link
Contributor Author

glorv commented Aug 13, 2021

/build

@glorv
Copy link
Contributor Author

glorv commented Aug 13, 2021

/run-check_dev_2

@glorv
Copy link
Contributor Author

glorv commented Aug 13, 2021

/run-check_dev_2

1 similar comment
@glorv
Copy link
Contributor Author

glorv commented Aug 13, 2021

/run-check_dev_2

@glorv
Copy link
Contributor Author

glorv commented Aug 13, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 14980d5

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 13, 2021
@glorv
Copy link
Contributor Author

glorv commented Aug 13, 2021

/build

@ti-chi-bot ti-chi-bot merged commit d92c49f into pingcap:master Aug 14, 2021
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Aug 14, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.2 in PR #27220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Cherry pick PR approved by release team. component/br This issue is related to BR of TiDB. needs-cherry-pick-release-5.2 release-note-none Denotes a PR that doesn't merit a release note. sig/migrate size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants