dengziming commented on a change in pull request #10393:
URL: https://github.com/apache/kafka/pull/10393#discussion_r607430517



##########
File path: raft/src/main/java/org/apache/kafka/raft/CandidateState.java
##########
@@ -235,6 +240,15 @@ public int epoch() {
         return highWatermark;
     }
 
+    @Override
+    public boolean canGrantVote(int candidateId, boolean isLogUpToDate) {
+        // Still reject vote request even candidateId = localId, Although the 
candidate votes for
+        // itself, this vote is implicit and not "granted".
+        log.debug("Rejecting vote request from candidate {} since we are 
already candidate in epoch {}",
+            candidateId, epoch);

Review comment:
       @ijuma , we logged both vote result and the reject reason in 
`KafkaRaftClient` before this PR, but different `EpochState` have different 
reject reason, to reduce the cyclomatic complexity we moved the if-else out of 
`KafkaRaftClient`.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to