Skip to content

Commit

Permalink
operator: When replacing-down-peer, it should not stop at the step of…
Browse files Browse the repository at this point in the history
… leave-joint-state (#5789)

ref #5568, close #5788

Signed-off-by: HunDunDM <[email protected]>

Co-authored-by: Ti Chi Robot <[email protected]>
  • Loading branch information
HunDunDM and ti-chi-bot authored Dec 19, 2022
1 parent 544c86a commit d87f230
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion server/schedule/operator/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ func (dv DemoteVoter) IsFinish(region *core.RegionInfo) bool {
log.Warn("obtain unexpected peer", zap.String("expect", dv.String()), zap.Uint64("obtain-learner", peer.GetId()))
return false
}
return region.GetPendingLearner(peer.GetId()) == nil
return peer.GetId() == dv.PeerID
}
return false
}
Expand Down
7 changes: 7 additions & 0 deletions server/schedule/operator/step_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,5 +569,12 @@ func (suite *operatorStepTestSuite) check(step OpStep, desc string, testCases []
err := step.CheckInProgress(suite.cluster, region)
testCase.CheckInProgress(err)
_ = step.GetCmd(region, true)

if _, ok := step.(ChangePeerV2Leave); ok {
// Ref https://github.com/tikv/pd/issues/5788
pendingPeers := region.GetLearners()
region = region.Clone(core.WithPendingPeers(pendingPeers))
suite.Equal(testCase.IsFinish, step.IsFinish(region))
}
}
}

0 comments on commit d87f230

Please sign in to comment.