appchemist commented on code in PR #15647:
URL: https://github.com/apache/kafka/pull/15647#discussion_r1580510829


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchCollector.java:
##########
@@ -327,21 +327,27 @@ private void handleInitializeErrors(final CompletedFetch 
completedFetch, final E
         final long fetchOffset = completedFetch.nextFetchOffset();
 
         if (error == Errors.NOT_LEADER_OR_FOLLOWER ||
-                error == Errors.REPLICA_NOT_AVAILABLE ||
+                error == Errors.FENCED_LEADER_EPOCH) {
+            log.debug("Error in fetch for partition {}: {}", tp, 
error.exceptionName());
+            requestMetadataUpdate(metadata, subscriptions, tp);
+        } else if (error == Errors.REPLICA_NOT_AVAILABLE ||
                 error == Errors.KAFKA_STORAGE_ERROR ||
-                error == Errors.FENCED_LEADER_EPOCH ||
                 error == Errors.OFFSET_NOT_AVAILABLE) {
             log.debug("Error in fetch for partition {}: {}", tp, 
error.exceptionName());
             requestMetadataUpdate(metadata, subscriptions, tp);
+            subscriptions.awaitUpdate(tp);

Review Comment:
   I missed that. For this case, there is no need to await a metadata update.
   I think simply initializing the PreferredReadReplica should be enough.
   Since `FetchUtils.requestMetadataUpdate()` is already being called, it 
should also be initializing.



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