Skip to content
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: add disconnected check when fix orphan peers (#7240) #7776

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions pkg/schedule/checker/rule_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,30 @@
hasUnhealthyFit = true
break
}
<<<<<<< HEAD

Check failure on line 501 in pkg/schedule/checker/rule_checker.go

View workflow job for this annotation

GitHub Actions / tso-function-test

syntax error: unexpected <<, expected }
pinDownPeer, hasUnhealthyFit = checkDownPeer(rf.Peers)
if hasUnhealthyFit {
break
=======

Check failure on line 505 in pkg/schedule/checker/rule_checker.go

View workflow job for this annotation

GitHub Actions / tso-function-test

syntax error: unexpected ==, expected }
for _, p := range rf.Peers {
if isUnhealthyPeer(p.GetId()) {
// make sure is down peer.
if region.GetDownPeer(p.GetId()) != nil {
pinDownPeer = p
}
hasUnhealthyFit = true
break loopFits
}
// avoid to meet down store when fix orpahn peers,
// Isdisconnected is more strictly than IsUnhealthy.
if c.cluster.GetStore(p.GetStoreId()).IsDisconnected() {
hasUnhealthyFit = true
pinDownPeer = p
break loopFits
}
>>>>>>> f9b476d80 (checker: add disconnected check when fix orphan peers (#7240))

Check failure on line 522 in pkg/schedule/checker/rule_checker.go

View workflow job for this annotation

GitHub Actions / tso-function-test

syntax error: unexpected >>, expected }

Check failure on line 522 in pkg/schedule/checker/rule_checker.go

View workflow job for this annotation

GitHub Actions / tso-function-test

invalid character U+0023 '#'
}
}

Check failure on line 524 in pkg/schedule/checker/rule_checker.go

View workflow job for this annotation

GitHub Actions / tso-function-test

syntax error: non-declaration statement outside function body

// If hasUnhealthyFit is false, it is safe to delete the OrphanPeer.
if !hasUnhealthyFit {
Expand Down Expand Up @@ -539,7 +558,12 @@
return operator.CreatePromoteLearnerOperatorAndRemovePeer("replace-down-peer-with-orphan-peer", c.cluster, region, orphanPeer, pinDownPeer)
case orphanPeerRole == metapb.PeerRole_Voter && destRole == metapb.PeerRole_Learner:
return operator.CreateDemoteLearnerOperatorAndRemovePeer("replace-down-peer-with-orphan-peer", c.cluster, region, orphanPeer, pinDownPeer)
<<<<<<< HEAD
case orphanPeerRole == destRole && isDisconnectedPeer(pinDownPeer) && !dstStore.IsDisconnected():
=======
case orphanPeerRole == metapb.PeerRole_Voter && destRole == metapb.PeerRole_Voter &&
c.cluster.GetStore(pinDownPeer.GetStoreId()).IsDisconnected() && !dstStore.IsDisconnected():
>>>>>>> f9b476d80 (checker: add disconnected check when fix orphan peers (#7240))

Check failure on line 566 in pkg/schedule/checker/rule_checker.go

View workflow job for this annotation

GitHub Actions / tso-function-test

invalid character U+0023 '#'
return operator.CreateRemovePeerOperator("remove-replaced-orphan-peer", c.cluster, 0, region, pinDownPeer.GetStoreId())
default:
// destRole should not same with orphanPeerRole. if role is same, it fit with orphanPeer should be better than now.
Expand All @@ -556,7 +580,7 @@
if len(fit.OrphanPeers) >= 2 {
hasHealthPeer := false
var disconnectedPeer *metapb.Peer
for _, orphanPeer := range fit.OrphanPeers {

Check failure on line 583 in pkg/schedule/checker/rule_checker.go

View workflow job for this annotation

GitHub Actions / tso-function-test

syntax error: non-declaration statement outside function body
if isDisconnectedPeer(orphanPeer) {
disconnectedPeer = orphanPeer
break
Expand Down
Loading