m1a2st commented on code in PR #21222:
URL: https://github.com/apache/kafka/pull/21222#discussion_r2655149137


##########
tools/src/main/java/org/apache/kafka/tools/reassign/ReassignPartitionsCommand.java:
##########
@@ -1531,13 +1532,27 @@ static Map<TopicPartitionReplica, String> 
getReplicaToLogDir(
                     .map(id -> new 
TopicPartitionReplica(entry.getKey().topic(), entry.getKey().partition(), id)))
                 .collect(Collectors.toUnmodifiableSet());
 
-        return adminClient.describeReplicaLogDirs(replicaLogDirs).all().get()
-                .entrySet()
+        var futureMap = 
adminClient.describeReplicaLogDirs(replicaLogDirs).values();
+
+        return futureMap.entrySet()
                 .stream()
-                .filter(entry -> entry.getValue().getCurrentReplicaLogDir() != 
null)
                 .collect(Collectors.toMap(
-                    Entry::getKey,
-                    entry -> entry.getValue().getCurrentReplicaLogDir()
+                        Entry::getKey,
+                        entry -> {
+                            try {
+                                var logDir = 
entry.getValue().get().getCurrentReplicaLogDir();
+                                return logDir != null ? logDir : "any";
+                            } catch (ExecutionException e) {

Review Comment:
   Good point! You're right that fetching from offline nodes can cause 
timeouts. Let me refactor to return Node objects instead and use 
`Node#isEmpty()` to filter them out before querying.



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