-
Notifications
You must be signed in to change notification settings - Fork 719
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
checker: prevent the regions in split-cache from becoming the target of merge #3454
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,8 +122,8 @@ func (s *testMergeCheckerSuite) SetUpTest(c *C) { | |
}, | ||
}, | ||
&metapb.Peer{Id: 109, StoreId: 4}, | ||
core.SetApproximateSize(10), | ||
core.SetApproximateKeys(10), | ||
core.SetApproximateSize(1), | ||
core.SetApproximateKeys(1), | ||
), | ||
} | ||
|
||
|
@@ -191,10 +191,19 @@ func (s *testMergeCheckerSuite) TestBasic(c *C) { | |
c.Assert(ops, NotNil) | ||
c.Assert(ops[0].RegionID(), Equals, s.regions[2].GetID()) | ||
c.Assert(ops[1].RegionID(), Equals, s.regions[1].GetID()) | ||
s.cluster.RuleManager.DeleteRule("test", "test") | ||
s.cluster.RuleManager.DeleteRule("pd", "test") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The rule was not deleted correctly here, which caused the subsequent test to be invalid. |
||
|
||
// Skip recently split regions. | ||
s.cluster.SetSplitMergeInterval(time.Hour) | ||
ops = s.mc.Check(s.regions[2]) | ||
c.Assert(ops, IsNil) | ||
|
||
s.mc.startTime = time.Now().Add(-2 * time.Hour) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original test did not modify the
|
||
ops = s.mc.Check(s.regions[2]) | ||
c.Assert(ops, NotNil) | ||
ops = s.mc.Check(s.regions[3]) | ||
c.Assert(ops, NotNil) | ||
|
||
s.mc.RecordRegionSplit([]uint64{s.regions[2].GetID()}) | ||
ops = s.mc.Check(s.regions[2]) | ||
c.Assert(ops, IsNil) | ||
|
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.
Here, the original value 10 is greater than threshold 2, which causes the region to be unable to be merged.