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

operator: When replacing-down-peer, it should not stop at the step of leave-joint-state #5789

Merged
merged 3 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
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))
}
}
}