When doing a leader transfer clear vote state on leader and when non-chosen peers receive the update

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2023-05-10 07:49:22 -07:00
parent c5c5a34fec
commit 717afae9ef

View File

@@ -1352,6 +1352,10 @@ func (n *raft) StepDown(preferred ...string) error {
}
}
// Clear our vote state.
n.vote = noVote
n.writeTermVote()
stepdown := n.stepdown
prop := n.prop
n.Unlock()
@@ -3196,6 +3200,10 @@ func (n *raft) processAppendEntry(ae *appendEntry, sub *subscription) {
// Here we can become a leader but need to wait for resume of the apply channel.
n.lxfer = true
}
} else {
// Since we are here we are not the chosen one but we should clear any vote preference.
n.vote = noVote
n.writeTermVote()
}
}
case EntryAddPeer: