Skip to content

Commit

Permalink
HDFS-14935. Refactor DFSNetworkTopology#isNodeInScope. Contributed by…
Browse files Browse the repository at this point in the history
… Lisheng Sun.
  • Loading branch information
ayushtkn committed Oct 29, 2019
1 parent 30ed24a commit fa4904c
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,11 @@ Node chooseRandomWithStorageType(final String scope,
}

private boolean isNodeInScope(Node node, String scope) {
if (!scope.endsWith("/")) {
scope += "/";
if (!scope.endsWith(NodeBase.PATH_SEPARATOR_STR)) {
scope += NodeBase.PATH_SEPARATOR_STR;
}
String nodeLocation = node.getNetworkLocation() + "/";
String nodeLocation =
node.getNetworkLocation() + NodeBase.PATH_SEPARATOR_STR;
return nodeLocation.startsWith(scope);
}

Expand Down

0 comments on commit fa4904c

Please sign in to comment.