Skip to content

Commit

Permalink
for test
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Nov 6, 2023
1 parent 04cb434 commit 225b33d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions server/schedule/checker/rule_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,23 +451,28 @@ func (c *RuleChecker) fixOrphanPeers(region *core.RegionInfo, fit *placement.Reg
checkerCounter.WithLabelValues("rule_checker", "remove-orphan-peer").Inc()
return operator.CreateRemovePeerOperator("remove-orphan-peer", c.cluster, 0, region, fit.OrphanPeers[0].StoreId)
}
checkerCounter.WithLabelValues("rule_checker", "remove-orphan-peer-hasUnhealthyFit").Inc()

// try to use orphan peers to replace unhealthy down peers.
for _, orphanPeer := range fit.OrphanPeers {
if pinDownPeer != nil {
if pinDownPeer.GetId() == orphanPeer.GetId() {
checkerCounter.WithLabelValues("rule_checker", "remove-orphan-peer1").Inc()
continue
}
// make sure the orphan peer is healthy.
if isUnhealthyPeer(orphanPeer.GetId()) || isDisconnectedPeer(orphanPeer) {
checkerCounter.WithLabelValues("rule_checker", "remove-orphan-peer2").Inc()
continue
}
// no consider witness in this path.
if pinDownPeer.GetIsWitness() || orphanPeer.GetIsWitness() {
checkerCounter.WithLabelValues("rule_checker", "remove-orphan-peer3").Inc()
continue
}
// pinDownPeer's store should be disconnected, because we use more strict judge before.
if !isDisconnectedPeer(pinDownPeer) {
checkerCounter.WithLabelValues("rule_checker", "remove-orphan-peer4").Inc()
continue
}
// check if down peer can replace with orphan peer.
Expand All @@ -490,6 +495,8 @@ func (c *RuleChecker) fixOrphanPeers(region *core.RegionInfo, fit *placement.Reg
} else {
checkerCounter.WithLabelValues("rule_checker", "replace-orphan-peer-no-fit").Inc()
}
} else {
checkerCounter.WithLabelValues("rule_checker", "remove-orphan-peer5").Inc()
}
}

Expand Down

0 comments on commit 225b33d

Please sign in to comment.