aloknnikhil commented on a change in pull request #9881: URL: https://github.com/apache/kafka/pull/9881#discussion_r557014650
########## File path: raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java ########## @@ -325,8 +341,30 @@ private void fireHandleResign() { } @Override - public void initialize() throws IOException { - quorum.initialize(new OffsetAndEpoch(log.endOffset().offset, log.lastFetchedEpoch())); + public void initialize(String quorumVoterStrings) throws IOException { + List<Node> quorumVoterNodes = quorumVoterStringsToNodes(quorumVoterStrings); + Set<Integer> quorumVoterIds = quorumVoterNodes.stream().map(Node::id).collect(Collectors.toSet()); + this.requestManager = new RequestManager(quorumVoterIds, retryBackoffMs, requestTimeoutMs, random); + + Map<Integer, InetSocketAddress> voterAddresses = quorumVoterNodes.stream() + .collect(Collectors.toMap(Node::id, node -> new InetSocketAddress(node.host(), node.port()))); + for (Map.Entry<Integer, InetSocketAddress> voterAddressEntry : voterAddresses.entrySet()) { + channel.updateEndpoint(voterAddressEntry.getKey(), voterAddressEntry.getValue()); + } + + QuorumState quorumState = new QuorumState( + nodeId, + quorumVoterIds, + electionTimeoutMs, + fetchTimeoutMs, + quorumStateStore, + time, + logContext, + random); + quorumState.initialize(new OffsetAndEpoch(log.endOffset().offset, log.lastFetchedEpoch())); + this.quorum = quorumState; + this.kafkaRaftMetrics = new KafkaRaftMetrics(metrics, "raft", quorum); Review comment: Good catch! ---------------------------------------------------------------- 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