[ 
https://issues.apache.org/jira/browse/HDFS-14935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16960293#comment-16960293
 ] 

Lisheng Sun commented on HDFS-14935:
------------------------------------

[~ayushtkn]

i think if there is illegalArgumentException, it should throw this Exception 
and stop.

As NetworkTopology#countNumOfAvailableNodes() is also done.
{code:java}
@VisibleForTesting
public int countNumOfAvailableNodes(String scope,
                                    Collection<Node> excludedNodes) {
  boolean isExcluded=false;
  if (scope.startsWith("~")) {
    isExcluded=true;
    scope=scope.substring(1);
  }
  scope = NodeBase.normalize(scope);
 .....
}{code}
Please correct me if i was wrong. Thank you [~ayushtkn]

> Refactor DFSNetworkTopology#isNodeInScope
> -----------------------------------------
>
>                 Key: HDFS-14935
>                 URL: https://issues.apache.org/jira/browse/HDFS-14935
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: Lisheng Sun
>            Assignee: Lisheng Sun
>            Priority: Major
>         Attachments: HDFS-14935.001.patch, HDFS-14935.002.patch
>
>
> {code:java}
> private boolean isNodeInScope(Node node, String scope) {
>   if (!scope.endsWith("/")) {
>     scope += "/";
>   }
>   String nodeLocation = node.getNetworkLocation() + "/";
>   return nodeLocation.startsWith(scope);
> }
> {code}
> NodeBase#normalize() is used to normalize scope.
> so i refator DFSNetworkTopology#isNodeInScope.
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to