adoroszlai commented on a change in pull request #2786:
URL: https://github.com/apache/ozone/pull/2786#discussion_r742662663



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancerConfiguration.java
##########
@@ -109,6 +109,20 @@
       "iteration of Container Balancer.")
   private long balancingInterval;
 
+  @Config(key = "include.datanodes", type = ConfigType.STRING, defaultValue =
+      "", tags = {ConfigTag.BALANCER}, description = "A list of Datanode " +
+      "hostnames or ip addresses separated by commas. Only the Datanodes " +
+      "specified in this list are balanced. This configuration is empty by " +
+      "default.")

Review comment:
       Can you please mention that the include list is only applicable if it is 
not empty?

##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancerConfiguration.java
##########
@@ -292,6 +306,42 @@ public void setBalancingInterval(Duration 
balancingInterval) {
     }
   }
 
+  /**
+   * Gets a set of datanode hostnames or ip addresses that will be the 
exclusive
+   * participants in balancing.
+   * @return Set of hostname strings
+   */
+  public Set<String> getIncludeNodes() {
+    if (includeNodes.isEmpty()) {
+      return new HashSet<>();
+    }
+    return Arrays.stream(includeNodes.split(","))
+        .map(String::trim)
+        .collect(Collectors.toSet());
+  }
+
+  public void setIncludeNodes(String includeNodes) {
+    this.includeNodes = includeNodes;
+  }
+
+  /**
+   * Gets a set of datanode hostnames or ip addresses that will be excluded
+   * from balancing.
+   * @return Set of hostname strings
+   */
+  public Set<String> getExcludeNodes() {
+    if (excludeNodes.isEmpty()) {
+      return new HashSet<>();

Review comment:
       Please use `Collections.emptySet()` here, too.

##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancerConfiguration.java
##########
@@ -292,6 +306,42 @@ public void setBalancingInterval(Duration 
balancingInterval) {
     }
   }
 
+  /**
+   * Gets a set of datanode hostnames or ip addresses that will be the 
exclusive
+   * participants in balancing.
+   * @return Set of hostname strings
+   */
+  public Set<String> getIncludeNodes() {
+    if (includeNodes.isEmpty()) {
+      return new HashSet<>();

Review comment:
       Nit: `Collections.emptySet()` is cheaper.




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