aQuigs commented on code in PR #7127:
URL: https://github.com/apache/hadoop/pull/7127#discussion_r1812945373


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java:
##########
@@ -408,17 +420,26 @@ private long init(List<DatanodeStorageReport> reports) {
     for(DatanodeStorageReport r : reports) {
       final DDatanode dn = dispatcher.newDatanode(r.getDatanodeInfo());
       final boolean isSource = Util.isIncluded(sourceNodes, 
dn.getDatanodeInfo());
+      final boolean isExcludedSource = Util.isIncluded(sourceNodes, 
dn.getDatanodeInfo());
+      final boolean isTarget = Util.isIncluded(targetNodes, 
dn.getDatanodeInfo());
+      final boolean isExcludedTarget = Util.isIncluded(targetNodes, 
dn.getDatanodeInfo());

Review Comment:
   Might be simpler to extend these conditions to check the exclusion rather 
than make every `if` check below more complex



##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java:
##########
@@ -1031,9 +1059,21 @@ static BalancerParameters parse(String[] args) {
               i = processHostList(args, i, "include", includedNodes);
               b.setIncludedNodes(includedNodes);
             } else if ("-source".equalsIgnoreCase(args[i])) {
-              Set<String> sourceNodes = new HashSet<>();
+              sourceNodes = new HashSet<>();
               i = processHostList(args, i, "source", sourceNodes);
               b.setSourceNodes(sourceNodes);
+            } else if ("-excludeSource".equalsIgnoreCase(args[i])) {
+              excludedSourceNodes = new HashSet<>();
+              i = processHostList(args, i, "source", excludedSourceNodes);

Review Comment:
   Should "source" be something like "excludedSource" here? Afaict it's just 
used for log messages
   
   Same for target below



-- 
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: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to