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


##########
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:
   Ah, good catch! My test didn't work as expected. Also updated the test to 
catch the issue. Thanks.



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