[ https://issues.apache.org/jira/browse/HDFS-17642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17892184#comment-17892184 ]
ASF GitHub Bot commented on HDFS-17642: --------------------------------------- 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 > Support specifying Datanodes to exclude for balancing at source/target > granularity > ---------------------------------------------------------------------------------- > > Key: HDFS-17642 > URL: https://issues.apache.org/jira/browse/HDFS-17642 > Project: Hadoop HDFS > Issue Type: Improvement > Components: balancer & mover > Reporter: Joseph Dell'Aringa > Assignee: Joseph Dell'Aringa > Priority: Major > Labels: pull-request-available > > In some cases it can be useful to exclude a list of datanodes from being > selected as a target but remaining an option for a source and vice-versa. > The fix for this ticket will add an additional exclude list for source and > target datanodes. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org