jsancio commented on code in PR #15986: URL: https://github.com/apache/kafka/pull/15986#discussion_r1624716888
########## raft/src/main/java/org/apache/kafka/raft/internals/VoterSet.java: ########## @@ -55,15 +57,41 @@ final public class VoterSet { } /** - * Returns the socket address for a given voter at a given listener. + * Returns the node information for all the given voter ids and listener. * - * @param voter the id of the voter - * @param listener the name of the listener - * @return the socket address if it exists, otherwise {@code Optional.empty()} + * @param voterIds the ids of the voters + * @param listenerName the name of the listener + * @return the node information for all of the voter ids + * @throws IllegalArgumentException if there are missing endpoints */ - public Optional<InetSocketAddress> voterAddress(int voter, String listener) { - return Optional.ofNullable(voters.get(voter)) - .flatMap(voterNode -> voterNode.address(listener)); + public Set<Node> voterNodes(Stream<Integer> voterIds, ListenerName listenerName) { Review Comment: Maybe. I had that as the original implementation but changed it to throw an `IllegalArgumentException`. If the user configured the cluster so that the default/preferred listener of one node/voter is not supported by all of the voters, it is clearly misconfigured. Should KRaft to continue silently knowing that the voter can never become leader? Or should Kafka catch the misconfiguration early and fail? I opted, and in KRaft we generally opt, towards fail fast. -- 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