ahuang98 commented on code in PR #17807: URL: https://github.com/apache/kafka/pull/17807#discussion_r1880692570
########## raft/src/main/java/org/apache/kafka/raft/EpochState.java: ########## @@ -26,16 +26,18 @@ default Optional<LogOffsetMetadata> highWatermark() { } /** - * Decide whether to grant a vote to a candidate. + * Decide whether to grant a vote to a replica. * * It is the responsibility of the caller to invoke * {@link QuorumState#transitionToUnattachedVotedState(int, ReplicaKey)} if vote is granted. * - * @param candidateKey the id and directory of the candidate - * @param isLogUpToDate whether the candidate’s log is at least as up-to-date as receiver’s log + * @param replicaKey the id and directory of the replica requesting the vote + * @param isLogUpToDate whether the replica's log is at least as up-to-date as receiver’s log * @return true if it can grant the vote, false otherwise */ - boolean canGrantVote(ReplicaKey candidateKey, boolean isLogUpToDate); + boolean canGrantVote(ReplicaKey replicaKey, boolean isLogUpToDate); + + boolean canGrantPreVote(ReplicaKey replicaKey, boolean isLogUpToDate); Review Comment: > We do have this method call. It is in QuorumState::canGrantVote. If we didn't have this method, you would have the same if statement at every call site. I agree with this statement, but not sure if I'm understanding if you are trying to make a further point. > The other concern I have is which is easier to unittest? For example, it doesn't look like we have a unittest for QuorumState::canGrantVote. As you said, QuorumState::canGrantVote just calls either EpochState::canGrantVote or EpochState::canGrantPreVote and both of those methods are unit tested? -- 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