hachikuji commented on a change in pull request #8376:
URL: https://github.com/apache/kafka/pull/8376#discussion_r427535098



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java
##########
@@ -1098,8 +1098,20 @@ Node selectReadReplica(TopicPartition partition, Node 
leaderReplica, long curren
         Map<Node, FetchSessionHandler.Builder> fetchable = new 
LinkedHashMap<>();
 
         // Ensure the position has an up-to-date leader
-        subscriptions.assignedPartitions().forEach(
-            tp -> subscriptions.maybeValidatePositionForCurrentLeader(tp, 
metadata.currentLeader(tp)));
+        subscriptions.assignedPartitions().forEach(tp -> {
+            Metadata.LeaderAndEpoch leaderAndEpoch = 
metadata.currentLeader(tp);
+            if (leaderAndEpoch.leader.isPresent()) {
+                NodeApiVersions nodeApiVersions = 
apiVersions.get(leaderAndEpoch.leader.get().idString());

Review comment:
       Yes, that makes sense to me.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to