Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RAFT node responds to VoteRequest with outdated Term (#5021)
A node's Term may be increased during handling of a VoteRequest. When that was the case, the node was responding with a stale Term. Example trace: ``` [DBG] RAFT [S1Nunr6R - S-R3F-5xgoWjQW] Received a voteRequest &{term:27 lastTerm:26 lastIndex:46 candidate:yrzKKRBu reply:$NRG.R.OHF7VRUO} [DBG] RAFT [S1Nunr6R - S-R3F-5xgoWjQW] Stepping down from leader, detected higher term: 27 vs 26 [DBG] RAFT [S1Nunr6R - S-R3F-5xgoWjQW] Stepping down [DBG] RAFT [S1Nunr6R - S-R3F-5xgoWjQW] Switching to follower [DBG] RAFT [S1Nunr6R - S-R3F-5xgoWjQW] Sending a voteResponse &{term:26 peer:S1Nunr6R granted:true} -> "$NRG.R.OHF7VRUO" ``` This is handled correctly except VoteResponse in the last log line should be sending back Term 27, not 26. Signed-off-by: Your Name <marco@nats.io>
- Loading branch information