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


##########
clients/src/main/java/org/apache/kafka/clients/Metadata.java:
##########
@@ -267,11 +307,14 @@ public synchronized void update(int requestVersion, 
MetadataResponse response, b
 
         this.needPartialUpdate = requestVersion < this.requestVersion;
         this.lastRefreshMs = nowMs;
+        this.attempts = 0;
         this.updateVersion += 1;
         if (!isPartialUpdate) {
             this.needFullUpdate = false;
             this.lastSuccessfulRefreshMs = nowMs;
         }
+        this.backoffOnEquivalentResponses = true;
+        this.equivalentResponseCount++;

Review Comment:
   The flags to control metadata updates, including `needFullUpdate` and now 
`backoffOnEquivalentResponses` are reset when a metadata response is received. 
The second of these flags is new, but the conditions under which reset occurs 
are not changed with this PR. `needFullUpdate` resets to `false` while 
`backoffOnEquivalentResponses` resets to `true`. It is intentionally that way 
round; it prefers to delay on equivalent responses, rather than needing to be 
reminded for each request.
   
   When a call to `update(permitBackoffOnEquivalentResponses=false)` is made, 
it sets `permitBackoffOnEquivalentResponses` to `false` so that there is no 
extra delay calculated based on equivalent metadata responses.
   
   I think you are correct about the periodic metadata refresh not resetting 
the flag. Good catch. I will correct that.



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

Reply via email to