dajac commented on a change in pull request #10760:
URL: https://github.com/apache/kafka/pull/10760#discussion_r655535240



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
##########
@@ -4298,6 +4296,28 @@ void handleFailure(Throwable throwable) {
                         }
                     }
                 }
+
+                @Override
+                boolean 
handleUnsupportedVersionException(UnsupportedVersionException exception) {
+                    if (supportsMaxTimestamp) {
+                        supportsMaxTimestamp = false;
+
+                        // fail any unsupported futures
+                        partitionsToQuery.stream().forEach(
+                            t -> t.partitions().stream()
+                                .filter(p -> p.timestamp() == 
ListOffsetsRequest.MAX_TIMESTAMP)
+                                .forEach(
+                                    p -> futures.get(new 
TopicPartition(t.name(), p.partitionIndex()))
+                                        .completeExceptionally(
+                                            new UnsupportedVersionException(
+                                                "Broker " + brokerId
+                                                    + " does not support 
MAX_TIMESTAMP offset spec"))
+                                )
+                        );

Review comment:
       Should we removed the `MAX_TIMESTAMP` ones from `partitionsToQuery` as 
well? Otherwise, they will be retried.

##########
File path: 
clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
##########
@@ -4298,6 +4296,28 @@ void handleFailure(Throwable throwable) {
                         }
                     }
                 }
+
+                @Override
+                boolean 
handleUnsupportedVersionException(UnsupportedVersionException exception) {
+                    if (supportsMaxTimestamp) {
+                        supportsMaxTimestamp = false;
+
+                        // fail any unsupported futures
+                        partitionsToQuery.stream().forEach(
+                            t -> t.partitions().stream()
+                                .filter(p -> p.timestamp() == 
ListOffsetsRequest.MAX_TIMESTAMP)
+                                .forEach(
+                                    p -> futures.get(new 
TopicPartition(t.name(), p.partitionIndex()))
+                                        .completeExceptionally(
+                                            new UnsupportedVersionException(
+                                                "Broker " + brokerId
+                                                    + " does not support 
MAX_TIMESTAMP offset spec"))
+                                )
+                        );
+                        return true;

Review comment:
       Could we return `true` only if they were `MAX_TIMESTAMP`? We won't need 
to retry if they were none.




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