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


##########
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:
   I'm not a fan of this solution because it leads to timeouts, which we want 
to avoid. Perhaps `getReplicaAssignmentForPartitions` could return `Node` 
instead of `Integer`? Then we can reuse the `Node#isEmpty` check to skip 
fetching directories from offline nodes



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