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


##########
raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java:
##########
@@ -1020,24 +1020,14 @@ private void maybeHandleElectionLoss(NomineeState 
state, long currentTimeMs) {
         if (state instanceof CandidateState candidate) {
             if (candidate.epochElection().isVoteRejected() && 
!candidate.isBackingOff()) {
                 logger.info(
-                    "Insufficient remaining votes to become leader. We will 
backoff before retrying election again. " +
-                    "Current epoch election state is {}.",
+                    "Insufficient remaining votes to become leader. Candidate 
will wait the remaining election " +
+                        "timeout ({}) before transitioning back to 
Prospective. Current epoch election state is {}.",
+                    candidate.remainingElectionTimeMs(currentTimeMs),
                     candidate.epochElection()
                 );
-                // Go immediately to a random, exponential backoff. The 
backoff starts low to prevent
-                // needing to wait the entire election timeout when the vote 
result has already been
-                // determined. The randomness prevents the next election from 
being gridlocked with
-                // another nominee due to timing. The exponential aspect 
limits epoch churn when the
-                // replica has failed multiple elections in succession.
-                candidate.startBackingOff(
-                    currentTimeMs,
-                    RaftUtil.binaryExponentialElectionBackoffMs(
-                        quorumConfig.electionBackoffMaxMs(),
-                        RETRY_BACKOFF_BASE_MS,
-                        candidate.retries(),
-                        random
-                    )
-                );
+                // Mark that the candidate is now backing off. After election 
timeout expires the candidate will
+                // transition back to prospective
+                candidate.startBackingOff();

Review Comment:
   I'll go with the latter option - I'm a bit reluctant to change the return 
type of the recordVote methods since it would affect a lot of existing tests. 



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