chia7712 commented on code in PR #16211:
URL: https://github.com/apache/kafka/pull/16211#discussion_r1630128548


##########
raft/src/main/java/org/apache/kafka/raft/LeaderState.java:
##########
@@ -126,8 +127,13 @@ public long timeUntilCheckQuorumExpires(long 
currentTimeMs) {
      */
     public void updateCheckQuorumForFollowingVoter(int id, long currentTimeMs) 
{
         updateFetchedVoters(id);
-        // The majority number of the voters excluding the leader. Ex: 3 
voters, the value will be 1
-        int majority = voterStates.size() / 2;
+        // The majority number of the voters. Ex: 3 voters, the value will be 2
+        int majority = (int) ((double) (voterStates.size() + 1) / 2);

Review Comment:
   just curios. this function will return majority number `2` if there are 4 
voters. Is that expected? I assume the corrected number is `3`



##########
raft/src/main/java/org/apache/kafka/raft/LeaderState.java:
##########
@@ -111,9 +111,10 @@ public long timeUntilCheckQuorumExpires(long 
currentTimeMs) {
         long remainingMs = checkQuorumTimer.remainingMs();
         if (remainingMs == 0) {
             log.info(
-                "Did not receive fetch request from the majority of the voters 
within {}ms. Current fetched voters are {}.",
+                "Did not receive fetch request from the majority of the voters 
within {}ms. Current fetched voters are {}, and voters are {}",
                 checkQuorumTimeoutMs,
-                fetchedVoters);
+                fetchedVoters,
+                voterStates);

Review Comment:
   Should it be `voterStates.keySet()`?



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