HDFS-14935. Refactor DFSNetworkTopology#isNodeInScope. Contributed by Lisheng Sun.
This commit is contained in:
parent
30ed24a421
commit
fa4904cdca
@ -259,10 +259,11 @@ Node chooseRandomWithStorageType(final String scope,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isNodeInScope(Node node, String scope) {
|
private boolean isNodeInScope(Node node, String scope) {
|
||||||
if (!scope.endsWith("/")) {
|
if (!scope.endsWith(NodeBase.PATH_SEPARATOR_STR)) {
|
||||||
scope += "/";
|
scope += NodeBase.PATH_SEPARATOR_STR;
|
||||||
}
|
}
|
||||||
String nodeLocation = node.getNetworkLocation() + "/";
|
String nodeLocation =
|
||||||
|
node.getNetworkLocation() + NodeBase.PATH_SEPARATOR_STR;
|
||||||
return nodeLocation.startsWith(scope);
|
return nodeLocation.startsWith(scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user