ijuma commented on a change in pull request #10393: URL: https://github.com/apache/kafka/pull/10393#discussion_r607233215
########## 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: As a general rule, methods like this should not log IMO. The calling method should log instead. That is, good to avoid the side effect from the "check" operation. It seems like it was like that before this PR. What was the motivation for changing 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org