cmccabe commented on code in PR #16008: URL: https://github.com/apache/kafka/pull/16008#discussion_r1608906143
########## raft/src/main/java/org/apache/kafka/raft/internals/VoterSet.java: ########## @@ -366,4 +368,16 @@ public static VoterSet fromInetSocketAddresses(String listener, Map<Integer, Ine return new VoterSet(voterNodes); } + + public Optional<Node> idToNode(int id, String listener) { + VoterNode voterNode = voters.get(id); + if (voterNode == null) { + return Optional.empty(); + } + InetSocketAddress address = voterNode.listeners.get(listener); + if (address == null) { + return Optional.empty(); + } + return Optional.of(new Node(id, address.getHostString(), address.getPort())); + } Review Comment: ok ########## raft/src/main/java/org/apache/kafka/raft/QuorumState.java: ########## @@ -548,6 +550,10 @@ public VotedState votedStateOrThrow() { .orElseThrow(() -> new IllegalStateException("Expected to be Voted, but current state is " + state)); } + public Optional<Node> idToNode(int id, String listener) { + return latestVoterSet.get().idToNode(id, listener); + } Review Comment: removed -- 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