lianetm commented on code in PR #17440:
URL: https://github.com/apache/kafka/pull/17440#discussion_r1870240540


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThread.java:
##########
@@ -325,4 +331,15 @@ void cleanup() {
             log.debug("Closed the consumer network thread");
         }
     }
+
+    /**
+     * If there is a metadata error, completed all uncompleted events with the 
metadata error.
+     */
+    private void maybeFailOnMetadataError(List<CompletableEvent<?>> events) {
+        if (events.isEmpty())
+            return;
+        
networkClientDelegate.getAndClearMetadataError().ifPresent(metadataError ->
+                events.forEach(event -> 
event.future().completeExceptionally(metadataError))

Review Comment:
   I wonder if we still need to tune this a bit more. Here we're failing all 
completable events we may have if there is a metadata error, but there are lots 
of events that are not concerned about subscription metadata and should not 
fail right? Actually, I expect we only need to fail on the 
`CheckAndUpdatePositions` event, that is triggered from poll and positions 
(aligned with how the classic consumer does client.poll on those 2 calls 
propagating the metadata error, all other calls that do not call client.poll 
will never get metadata errors and we should ensure the same).
   
   Makes sense? (if so, one options could be to have all events implement a 
kind of requiresSubcriptionMetadata() that returns false by default, and 
CheckAndUpdatePositions returns true). Thoughts? 



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