lh0156 opened a new pull request, #22203:
URL: https://github.com/apache/kafka/pull/22203

   ### Summary
   
   This patch preserves the candidate `votedKey` when transitioning to 
`LeaderState`.
   
   Before this change, `LeaderState.election()` always returned an 
elected-leader `ElectionState` with an empty `votedKey`. Since 
`QuorumState.transitionToLeader` writes the new state's election state to the 
quorum state store, the candidate's self-vote could be dropped during the 
candidate-to-leader transition.
   
   The patch passes the candidate election state's `votedKey` into 
`LeaderState` and keeps the same value across the soft `ResignedState` 
representation. This keeps the in-memory and persisted election-state 
representation consistent after a candidate becomes leader and later resigns.
   
   ### Testing
   
   ```bash
   ./gradlew :raft:unitTest


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to