ahuang98 commented on code in PR #17807:
URL: https://github.com/apache/kafka/pull/17807#discussion_r1876452932


##########
raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java:
##########
@@ -738,17 +739,22 @@ private VoteResponseData buildVoteResponse(
         ListenerName listenerName,
         short apiVersion,
         Errors partitionLevelError,
-        boolean voteGranted
+        boolean voteGranted,
+        boolean preVote
     ) {
+        // We are granting a PreVote, we do not send our leader id if we have 
one.
+        // This prevents Prospective and Follower states from ping-ponging as 
described in KIP-996.
+        int leaderId = preVote && voteGranted ? UNKNOWN_LEADER_ID : 
quorum.leaderIdOrSentinel();

Review Comment:
   note: this will be reverted in the next commit. we won't ping-pong between 
Prospective and Follower for the same Leader if Prospective persists the 
leaderId



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to