ijuma commented on a change in pull request #10523: URL: https://github.com/apache/kafka/pull/10523#discussion_r611216846
########## File path: raft/src/main/java/org/apache/kafka/raft/CandidateState.java ########## @@ -241,12 +236,14 @@ public int epoch() { } @Override - public boolean canGrantVote(int candidateId, boolean isLogUpToDate) { + public Optional<String> validateGrantVote(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); - return false; + return Optional.of(String.format( + "Rejecting vote request from candidate %s since we are already candidate in epoch %s", + candidateId, + epoch + )); Review comment: One tricky aspect is that we now generate the string even if logging is disabled. Let me think about that a bit more. -- 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