raft: reset the leader on entering candidate state
Not resetting a leader causes vote requests to be ignored instead of rejected which will make voting round to take more time to fail and may slow down new leader election.
This commit is contained in:
@@ -161,6 +161,10 @@ void fsm::become_follower(server_id leader) {
|
||||
}
|
||||
|
||||
void fsm::become_candidate() {
|
||||
// When starting a campain we need to reset current leader otherwise
|
||||
// disruptive server prevention will stall an election if quorum of nodes
|
||||
// start election together since each one will ignore vote requests from others
|
||||
_current_leader = {};
|
||||
_state = candidate{};
|
||||
_tracker = std::nullopt;
|
||||
_log_limiter_semaphore = std::nullopt;
|
||||
|
||||
Reference in New Issue
Block a user