[ 
https://issues.apache.org/jira/browse/KAFKA-18389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18078197#comment-18078197
 ] 

Yunseop Eom commented on KAFKA-18389:
-------------------------------------

Hi,

I opened a PR for this issue:
https://github.com/apache/kafka/pull/22203

The patch preserves the candidate `votedKey` when transitioning to 
`LeaderState`. Previously, `LeaderState.election()` returned an elected-leader 
state with an empty `votedKey`, so the candidate's self-vote could be dropped 
when `QuorumState.transitionToLeader` wrote the leader election state.

The change also keeps the same `votedKey` across the soft `ResignedState` 
representation so the election state remains consistent after a leader resigns.

Testing:
./gradlew :raft:unitTest

> Do not lose votedKey on transition to LeaderState
> -------------------------------------------------
>
>                 Key: KAFKA-18389
>                 URL: https://issues.apache.org/jira/browse/KAFKA-18389
>             Project: Kafka
>          Issue Type: Improvement
>          Components: kraft
>            Reporter: Alyssa Huang
>            Priority: Minor
>
> After KAFKA-17642 is merged in, all epoch state transitions (other than the 
> transition to Leader) will preserve votedKey and leaderId state. We should 
> make the transition to LeaderState consistent with this.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to