-
Notifications
You must be signed in to change notification settings - Fork 721
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
schedule, checker: add ruleChecker #2042
Conversation
Signed-off-by: disksing <i@disksing.com>
Signed-off-by: disksing <i@disksing.com>
Signed-off-by: disksing <i@disksing.com>
Signed-off-by: disksing <i@disksing.com>
Codecov Report
@@ Coverage Diff @@
## master #2042 +/- ##
==========================================
- Coverage 76.87% 76.84% -0.03%
==========================================
Files 184 185 +1
Lines 18653 18829 +176
==========================================
+ Hits 14339 14470 +131
- Misses 3227 3253 +26
- Partials 1087 1106 +19
Continue to review full report at Codecov.
|
log.Warn("lost the store, maybe you are recovering the PD cluster", zap.Uint64("store-id", peer.StoreId)) | ||
return false | ||
} | ||
return !store.IsUp() |
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.
prefer to use IsOffline
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 we treat tomestone
as offline too. (it happens when force bury a store before moing out all regions). replicaChecker
's behaviour is like this too: https://github.com/pingcap/pd/blob/4d65bbefbc6db6e92fee33caa97415274512757a/server/schedule/checker/replica_checker.go#L216-L218
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.
Yes, but this function named isOfflinePeer
which may be a little bit confused.
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.
em. do you have better suggestion? (replicaChecker uses checkOfflinePeer
as function name too...)
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.
I think IsOfflineOrTomestone looks too verbose 😢
Signed-off-by: disksing <i@disksing.com> Co-Authored-By: Ryan Leung <rleungx@gmail.com>
Signed-off-by: disksing <i@disksing.com>
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.
rest LGTM.
|
||
// SelectStoreToReplacePeerByRule selects a store to replace a region peer in order to fit the placement rule. | ||
func SelectStoreToReplacePeerByRule(scope string, cluster opt.Cluster, region *core.RegionInfo, fit *placement.RegionFit, rf *placement.RuleFit, peer *metapb.Peer, filters ...filter.Filter) *core.StoreInfo { | ||
rf2 := removePeerFromRuleFit(rf, peer) |
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.
What purpose for this, don't want to remove looseMatchPeer
?
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.
Similar to replicaChecker.SelectBestReplacementStore, replace
is done by
copy region with the old peer removed + add a new peer to the copied region
The difference is in ruleChecker
, replace happens inside a rule (remove a peer, add another peer fits the same rule), so the replace process besomes
copy RuleFit with the old peer removed + add a new peer to the copied RuleFit
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.
got
Signed-off-by: disksing <i@disksing.com>
PTAL @rleungx |
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.
LGTM
/run-all-tests |
What problem does this PR solve?
Introduce
RuleChecker
to fix region according to placement rules.What is changed and how it works?
Check List
Tests