raft: correct pendingConfIndex check for AutoLeave (#12137)

Close #12136

Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
This commit is contained in:
Jay
2020-07-21 07:49:22 +08:00
committed by GitHub
parent 93637b1779
commit cc656718fa
2 changed files with 133 additions and 1 deletions

View File

@@ -566,7 +566,7 @@ func (r *raft) advance(rd Ready) {
oldApplied := r.raftLog.applied
r.raftLog.appliedTo(newApplied)
if r.prs.Config.AutoLeave && oldApplied < r.pendingConfIndex && newApplied >= r.pendingConfIndex && r.state == StateLeader {
if r.prs.Config.AutoLeave && oldApplied <= r.pendingConfIndex && newApplied >= r.pendingConfIndex && r.state == StateLeader {
// If the current (and most recent, at least for this leader's term)
// configuration should be auto-left, initiate that now. We use a
// nil Data which unmarshals into an empty ConfChangeV2 and has the