AndrewJSchofield commented on code in PR #24115:
URL: https://github.com/apache/kafka/pull/24115#discussion_r4666985558


##########
clients/src/main/java/org/apache/kafka/clients/admin/internals/AdminMetadataManager.java:
##########
@@ -257,7 +271,10 @@ public Node nodeById(int nodeId) {
         return cluster.nodeById(nodeId);
     }
 

Review Comment:
   I'm not quite happy with how the equivalent response count is being reset. 
How about when the required node is found, reset the count so that a subsequent 
metadata request starts with a fresh count? Otherwise, I think you can get the 
backoff piling up. You could, for example, have a method in this class to reset 
the `equivalentResponseCount` and call it from the node providers in 
`KafkaAdminClient` when they have actually found a node.



##########
clients/src/main/java/org/apache/kafka/clients/admin/internals/AdminMetadataManager.java:
##########
@@ -84,6 +87,11 @@ public class AdminMetadataManager {
      */
     private long lastMetadataFetchAttemptMs = 0;
 
+    /**
+     * The number of successive metadata responses that did not change the 
cluster nodes.
+     */
+    private final AtomicLong equivalentResponseCount = new AtomicLong(0);

Review Comment:
   Yes, I see. I was wondering whether you would have used `synchronized` 
instead to remove the findbug exclusion for the other fields too. Anyway, this 
is fine with me. Thanks.



-- 
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]

Reply via email to