Skip to content

Commit

Permalink
split between tables
Browse files Browse the repository at this point in the history
Signed-off-by: hillium <[email protected]>
  • Loading branch information
YuJuncen committed Apr 12, 2023
1 parent 65e7457 commit 748fb23
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
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

0 comments on commit 748fb23

Please sign in to comment.