muralibasani commented on code in PR #24098:
URL: https://github.com/apache/kafka/pull/24098#discussion_r4497144666


##########
tools/src/main/java/org/apache/kafka/tools/GroupOffsetsResetter.java:
##########
@@ -459,17 +459,22 @@ public List<TopicPartition> 
filterNoneLeaderPartitions(Collection<TopicPartition
         // collect all topics
         Set<String> topics = 
topicPartitions.stream().map(TopicPartition::topic).collect(Collectors.toSet());
 
-        try {
-            return adminClient.describeTopics(topics, withTimeoutMs(new 
DescribeTopicsOptions())).allTopicNames().get().entrySet()
-                .stream()
-                .flatMap(entry -> entry.getValue().partitions().stream()
+        List<TopicPartition> noneLeaderPartitions = new ArrayList<>();
+        adminClient.describeTopics(topics, withTimeoutMs(new 
DescribeTopicsOptions())).topicNameValues().forEach((topic, future) -> {
+            try {
+                future.get().partitions().stream()
                     .filter(partitionInfo -> partitionInfo.leader() == null)
-                    .map(partitionInfo -> new TopicPartition(entry.getKey(), 
partitionInfo.partition())))
+                    .map(partitionInfo -> new TopicPartition(topic, 
partitionInfo.partition()))
                     .filter(topicPartitions::contains)
-                .toList();
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
+                    .forEach(noneLeaderPartitions::add);
+            } catch (InterruptedException | ExecutionException e) {

Review Comment:
   In case of InterruptedException, I think we missed to restore the interrupt 
flag ?



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