siddhantsangwan commented on a change in pull request #2944:
URL: https://github.com/apache/ozone/pull/2944#discussion_r811644694



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancerConfiguration.java
##########
@@ -123,6 +123,14 @@
           "This configuration is false by default.")
   private boolean networkTopologyEnable = false;
 
+  @Config(key = "trigger.du.before.move.enable", type = ConfigType.BOOLEAN,
+      defaultValue = "false", tags = {ConfigTag.BALANCER},
+      description = "whether to send command to all the data nodes to run du " 
+
+          "immediately before starting a balance iteration. note that " +
+          "running du is very time consuming , especially when the disk " +
+          "usage rate of a data node is very high")

Review comment:
       We can update the description to `all healthy, in-service datanodes` or 
something similar.

##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java
##########
@@ -1008,6 +1009,33 @@ public void addDatanodeCommand(UUID dnId, SCMCommand 
command) {
     this.commandQueue.addCommand(dnId, command);
   }
 
+  /**
+   * send refresh command to all the healthy datanodes to refresh
+   * volume usage info immediately.
+   */
+  @Override
+  public void refreshAllHealthyDnUsageInfo() {
+    RefreshVolumeUsageCommand refreshVolumeUsageCommand =
+        new RefreshVolumeUsageCommand();
+    try {
+      refreshVolumeUsageCommand.setTerm(scmContext.getTermOfLeader());
+    } catch (NotLeaderException nle) {
+      LOG.warn("Skip sending refreshVolumeUsage command,"
+          + " since current SCM is not leader.", nle);
+      return;
+    }
+    getAllNodes().stream().filter(dn -> {
+      boolean isHealthy = false;
+      try {
+        isHealthy = getNodeStatus(dn).isHealthy();
+      } catch (NodeNotFoundException nnfe) {
+        LOG.warn("datanode {} is not found", dn.getIpAddress());
+      }
+      return isHealthy;

Review comment:
        Can we use the `getNodes(
         NodeOperationalState opState, NodeState health)` method here? Is there 
a reason for not filtering DNs with `NodeOperationalState` as well as 
`NodeState`?




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