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



##########
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:
       Thank you for reminding me of this principle, maybe a better way to fix 
this is to return `Tuple<Boolean, String>` to represent "canGrantVote" and 
"rejectReason", I will try to fix this later.




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