jsancio commented on code in PR #19658:
URL: https://github.com/apache/kafka/pull/19658#discussion_r2082461965


##########
raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java:
##########
@@ -1048,14 +1053,18 @@ private void maybeHandleElectionLoss(NomineeState 
state, long currentTimeMs) {
         }
     }
 
-    private int binaryExponentialElectionBackoffMs(int retries) {
+    // visible for testing
+    static int binaryExponentialElectionBackoffMs(int backoffMaxMs, int 
retries, Random random) {
         if (retries <= 0) {
             throw new IllegalArgumentException("Retries " + retries + " should 
be larger than zero");
         }
-        // upper limit exponential co-efficients at 20 to avoid overflow
+        // Takes minimum of the following:
+        // 1. exponential backoff calculation (maxes out at 102.4 seconds)
+        // 2. configurable electionBackoffMaxMs + jitter
+        // The jitter is added to prevent deadlock of elections.

Review Comment:
   I don't think deadlock is the correct term. The actors/replicas are not dead 
or blocked. I think that livelock is a more accurate description of the issue.
   
   The replicas are changing (i.e. holding election) but they are changing in a 
way that they can't make progress (i.e. elect a leader).



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