peterxcli commented on code in PR #8610:
URL: https://github.com/apache/ozone/pull/8610#discussion_r2142278013


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerManager.java:
##########
@@ -107,7 +108,23 @@ public List<HddsProtos.DatanodeDiskBalancerInfoProto> 
getDiskBalancerStatus(
     List<DatanodeDetails> filterDns = null;
     if (hosts.isPresent() && !hosts.get().isEmpty()) {
       filterDns = NodeUtils.mapHostnamesToDatanodes(nodeManager, hosts.get(),
-          useHostnames);
+          useHostnames).stream()
+          .filter(dn -> {
+            try {
+              NodeStatus nodeStatus = nodeManager.getNodeStatus(dn);
+              boolean isInService = nodeStatus.isInService();
+              boolean isHealthy = nodeStatus.isHealthy();
+              if (!isInService || !isHealthy) {

Review Comment:
   ```suggestion
               if (!nodeManager.getNodeStatus(dn) != 
NodeStatus.inServiceHealthy()) {
   ```
   
   also the line 140-144 could be:
   ```java
    return nodeManager.getNodes(NodeStatus.inServiceHealthy()).stream()
          .filter(dn -> shouldReturnDatanode(filterStatus, dn))
          .map(dn -> getInfoProto((DatanodeInfo)dn, clientVersion))
          .collect(Collectors.toList());
   ```
   
   Makes the filter semantic be more consistent.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to