diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/CommonFSUtils.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/CommonFSUtils.java index eba3b12abc87..0e0372c94ea9 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/CommonFSUtils.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/CommonFSUtils.java @@ -356,7 +356,7 @@ public static String getPath(Path p) { public static Path getRootDir(final Configuration c) throws IOException { Path p = new Path(c.get(HConstants.HBASE_DIR)); FileSystem fs = p.getFileSystem(c); - return p.makeQualified(fs); + return p.makeQualified(fs.getUri(), fs.getWorkingDirectory()); } public static void setRootDir(final Configuration c, final Path root) throws IOException { @@ -384,7 +384,7 @@ public static Path getWALRootDir(final Configuration c) throws IOException { return getRootDir(c); } FileSystem fs = p.getFileSystem(c); - return p.makeQualified(fs); + return p.makeQualified(fs.getUri(), fs.getWorkingDirectory()); } @VisibleForTesting @@ -399,8 +399,10 @@ public static FileSystem getWALFileSystem(final Configuration c) throws IOExcept private static boolean isValidWALRootDir(Path walDir, final Configuration c) throws IOException { Path rootDir = getRootDir(c); - if (!walDir.equals(rootDir)) { - if (walDir.toString().startsWith(rootDir.toString() + "/")) { + FileSystem fs = walDir.getFileSystem(c); + Path qualifiedWalDir = walDir.makeQualified(fs.getUri(), fs.getWorkingDirectory()); + if (!qualifiedWalDir.equals(rootDir)) { + if (qualifiedWalDir.toString().startsWith(rootDir.toString() + "/")) { throw new IllegalStateException("Illegal WAL directory specified. " + "WAL directories are not permitted to be under the root directory if set."); } diff --git a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java index c37f28404968..dc3bb61a64e1 100644 --- a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java +++ b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java @@ -965,7 +965,7 @@ private static Path findOrCreateJar(Class my_class, FileSystem fs, } LOG.debug(String.format("For class %s, using jar %s", my_class.getName(), jar)); - return new Path(jar).makeQualified(fs); + return new Path(jar).makeQualified(fs.getUri(), fs.getWorkingDirectory()); } /**