ivanyu commented on code in PR #13277: URL: https://github.com/apache/kafka/pull/13277#discussion_r1636356455
########## clients/src/main/java/org/apache/kafka/clients/NetworkClient.java: ########## @@ -1121,13 +1140,25 @@ public long maybeUpdate(long now) { // Beware that the behavior of this method and the computation of timeouts for poll() are // highly dependent on the behavior of leastLoadedNode. - Node node = leastLoadedNode(now); - if (node == null) { + LeastLoadedNode leastLoadedNode = leastLoadedNode(now); + + // Rebootstrap if needed and configured. + if (!leastLoadedNode.hasNodeAvailableOrConnectionReady() + && metadataRecoveryStrategy == MetadataRecoveryStrategy.REBOOTSTRAP) { + for (final Node oldNode : metadata.fetch().nodes()) { + NetworkClient.this.close(oldNode.idString()); Review Comment: Oh that's right: if `!leastLoadedNode.hasNodeAvailableOrConnectionReady()`, there shouldn't be open connections. I removed this closing. -- 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