showuon commented on code in PR #12716:
URL: https://github.com/apache/kafka/pull/12716#discussion_r996433828


##########
raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java:
##########
@@ -647,12 +647,13 @@ private boolean handleVoteResponse(
         }
     }
 
-    private int binaryExponentialElectionBackoffMs(int retries) {
+    // visible for testing
+    int binaryExponentialElectionBackoffMs(int retries) {
         if (retries <= 0) {
             throw new IllegalArgumentException("Retries " + retries + " should 
be larger than zero");
         }
         // upper limit exponential co-efficients at 20 to avoid overflow
-        return Math.min(RETRY_BACKOFF_BASE_MS * random.nextInt(2 << 
Math.min(20, retries - 1)),
+        return Math.min(RETRY_BACKOFF_BASE_MS * random.nextInt(2 << 
Math.min(20, retries)),

Review Comment:
   Yes, you're right. On second thought, I think this change is not necessary. 
I'll close it.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to