diff --git a/pkg/schedule/checker/rule_checker.go b/pkg/schedule/checker/rule_checker.go index 1cbb3e5e7d1..0e9c663c77c 100644 --- a/pkg/schedule/checker/rule_checker.go +++ b/pkg/schedule/checker/rule_checker.go @@ -577,7 +577,7 @@ func (c *RuleChecker) fixOrphanPeers(region *core.RegionInfo, fit *placement.Reg ruleCheckerRemoveOrphanPeerCounter.Inc() return operator.CreateRemovePeerOperator("remove-unhealthy-orphan-peer", c.cluster, 0, region, orphanPeer.StoreId) } - // If there is one extra peer but all the count of all the rule is not satisfied, we should not remove any peer to keep the high available. + // The healthy orphan peer should be the last one to be removed only if there are extra peers to keep the high availablility. if hasHealthPeer && extra > 0 { // there already exists a healthy orphan peer, so we can remove other orphan Peers. ruleCheckerRemoveOrphanPeerCounter.Inc() diff --git a/pkg/schedule/placement/fit.go b/pkg/schedule/placement/fit.go index 8f9870ce658..d907bcd011a 100644 --- a/pkg/schedule/placement/fit.go +++ b/pkg/schedule/placement/fit.go @@ -93,7 +93,7 @@ func (f *RegionFit) IsSatisfied() bool { return len(f.OrphanPeers) == 0 } -// retrun true if the count of the rule is satisfied. +// ExtraCount return the extra count. func (f *RegionFit) ExtraCount() int { desired := 0 for _, r := range f.RuleFits {