gabriellefu commented on code in PR #24115:
URL: https://github.com/apache/kafka/pull/24115#discussion_r4621288029
##########
clients/src/main/java/org/apache/kafka/clients/admin/internals/AdminMetadataManager.java:
##########
@@ -354,6 +371,14 @@ public void update(Cluster cluster, long now) {
bootstrapCluster = cluster;
} else {
log.debug("Updating cluster metadata to {}", cluster);
+ // A response is equivalent if it has the same nodes as the
previous one and that one has not expired.
+ // The controller is not compared because brokers return a random
alive broker as the controller.
+ if (now - lastMetadataUpdateMs < metadataExpireMs &&
+ new HashSet<>(cluster.nodes()).equals(new
HashSet<>(this.cluster.nodes()))) {
Review Comment:
thanks, I have updated it. Now it compares the node count and then looks up
each node by id in the previous cluster, so no sets are allocated.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]