hachikuji opened a new pull request #9531:
URL: https://github.com/apache/kafka/pull/9531


   When initializing the raft state machine after shutting down as a leader, we 
were previously entering the "unattached" state, which means we have no leader 
and no voted candidate. This was a bug because it allowed a reinitialized 
leader to cast a vote for a candidate in the same epoch that it was already the 
leader of. This patch fixes the problem by introducing a new "resigned" state 
which allows us to retain the leader state so that we cannot change our vote 
and we will not accept additional appends.
   
   This patch also revamps the shutdown logic to make use of the new "resigned" 
state. Previously we had a separate path in `KafkaRaftClient.poll` for the 
shutdown logic which resulted in some duplication. Instead now we incorporate 
shutdown behavior into each state's respective logic.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to