From fa4904cdcaaa294149a1c92465c71359407de93f Mon Sep 17 00:00:00 2001 From: Ayush Saxena Date: Tue, 29 Oct 2019 12:30:24 +0530 Subject: [PATCH] HDFS-14935. Refactor DFSNetworkTopology#isNodeInScope. Contributed by Lisheng Sun. --- .../org/apache/hadoop/hdfs/net/DFSNetworkTopology.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/net/DFSNetworkTopology.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/net/DFSNetworkTopology.java index 886411a62d..bd02768bda 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/net/DFSNetworkTopology.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/net/DFSNetworkTopology.java @@ -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); }