lucasbru commented on code in PR #22493:
URL: https://github.com/apache/kafka/pull/22493#discussion_r3380094780


##########
clients/src/main/java/org/apache/kafka/clients/admin/internals/AdminApiDriver.java:
##########
@@ -188,6 +188,33 @@ private void retryLookup(Collection<K> keys) {
         keys.forEach(this::unmap);
     }
 
+    /**
+     * Send the keys of a fulfillment request back to the Lookup stage. This 
is invoked when a
+     * fulfillment request cannot be routed because its target broker is no 
longer present in the
+     * cluster metadata, for example when a stale entry in the partition 
leader cache pointed at a
+     * broker that has since left the cluster. Re-running the lookup gives us 
a chance to discover
+     * the current leader. Without this, such a request would remain 
unassignable until the request
+     * deadline expires.
+     *
+     * <p>This is a no-op for lookup strategies that target a fixed broker 
(i.e. the lookup scope
+     * carries a destination broker id, as with {@link StaticBrokerStrategy}), 
since {@link #unmap}
+     * would simply remap the keys straight back to the same fulfillment 
broker without making any
+     * progress. In that case this returns {@code false} and the request is 
left untouched, so the
+     * caller can leave it pending rather than retrying in a loop and 
exhausting the retry budget.
+     *
+     * @return true if the keys were moved back to the Lookup stage, false if 
no lookup is possible
+     */
+    public boolean retryLookup(long currentTimeMs, RequestSpec<K> spec) {

Review Comment:
   Good point - renamed it to `maybeRetryLookup` to distinguish it from the 
private `retryLookup`, and the `maybe` also signals it can be a no-op (when the 
keys target a fixed broker and can't go back to lookup).



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