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

restore: split between tables #42972

Merged
merged 1 commit into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions br/pkg/restore/split.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,11 @@ func (rs *RegionSplitter) ScatterRegions(ctx context.Context, newRegions []*spli
func getSplitKeys(rewriteRules *RewriteRules, ranges []rtree.Range, regions []*split.RegionInfo, isRawKv bool) map[uint64][][]byte {
splitKeyMap := make(map[uint64][][]byte)
checkKeys := make([][]byte, 0)
if rewriteRules != nil && len(rewriteRules.NewKeyspace) == 0 {
for _, rule := range rewriteRules.Data {
checkKeys = append(checkKeys, rule.NewKeyPrefix)
}
}
for _, rg := range ranges {
checkKeys = append(checkKeys, rg.EndKey)
}
Expand Down
8 changes: 5 additions & 3 deletions br/pkg/restore/split_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,12 @@ func initRewriteRules() *restore.RewriteRules {

// expected regions after split:
//
// [, aay), [aay, bba), [bba, bbf), [bbf, bbh), [bbh, bbj),
// [bbj, cca), [cca, xxe), [xxe, xxz), [xxz, )
// [aa, aay), [aay, bba), [bba, bbf), [bbf, bbh), [bbh, bbj),
// [bbj, cca), [cca, xx), [xx, xxe), [xxe, xxz), [xxz, )
//
// Please note that "aa" has been rewritten to "xx", so the "bb" rewrite rule split point won't be included.
func validateRegions(regions map[uint64]*split.RegionInfo) bool {
keys := [...]string{"", "aay", "bba", "bbf", "bbh", "bbj", "cca", "xxe", "xxz", ""}
keys := [...]string{"", "aay", "bba", "bbf", "bbh", "bbj", "cca", "xx", "xxe", "xxz", ""}
return validateRegionsExt(regions, keys[:], false)
}

Expand Down