diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java index c5091c2..e62f11d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java @@ -435,16 +435,18 @@ public class HRegionFileSystem { throws IOException { // Copy the file if it's on another filesystem FileSystem srcFs = srcPath.getFileSystem(conf); + srcPath = srcFs.resolvePath(srcPath); + FileSystem realSrcFs = srcPath.getFileSystem(conf); FileSystem desFs = fs instanceof HFileSystem ? ((HFileSystem)fs).getBackingFs() : fs; // We can't compare FileSystem instances as equals() includes UGI instance // as part of the comparison and won't work when doing SecureBulkLoad // TODO deal with viewFS - if (!FSHDFSUtils.isSameHdfs(conf, srcFs, desFs)) { + if (!FSHDFSUtils.isSameHdfs(conf, realSrcFs, desFs)) { LOG.info("Bulk-load file " + srcPath + " is on different filesystem than " + "the destination store. Copying file over to destination filesystem."); Path tmpPath = createTempName(); - FileUtil.copy(srcFs, srcPath, fs, tmpPath, false, conf); + FileUtil.copy(realSrcFs, srcPath, fs, tmpPath, false, conf); LOG.info("Copied " + srcPath + " to temporary path on destination filesystem: " + tmpPath); srcPath = tmpPath; } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java index acdbd08..426c047 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java @@ -73,8 +73,9 @@ public class FSHDFSUtils extends FSUtils { Map> addressMap = (Map>) getNNAddressesMethod .invoke(null, conf); - for (Map.Entry> entry : addressMap.entrySet()) { - Map nnMap = entry.getValue(); + String nameService = serviceName.substring(serviceName.indexOf(":") + 1); + if (addressMap.containsKey(nameService)) { + Map nnMap = addressMap.get(nameService); for (Map.Entry e2 : nnMap.entrySet()) { InetSocketAddress addr = e2.getValue(); addresses.add(addr);