You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2017/01/09 22:48:57 UTC
hbase git commit: HBASE-17429 HBase bulkload cannot support HDFS
viewFs (shenxianqiang)
Repository: hbase
Updated Branches:
refs/heads/master dd1ae3714 -> 8dd35631c
HBASE-17429 HBase bulkload cannot support HDFS viewFs (shenxianqiang)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/8dd35631
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/8dd35631
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/8dd35631
Branch: refs/heads/master
Commit: 8dd35631cab14e9ae8ac64b4cd034712f7e6d8e9
Parents: dd1ae37
Author: tedyu <yu...@gmail.com>
Authored: Mon Jan 9 14:48:51 2017 -0800
Committer: tedyu <yu...@gmail.com>
Committed: Mon Jan 9 14:48:51 2017 -0800
----------------------------------------------------------------------
.../apache/hadoop/hbase/regionserver/HRegionFileSystem.java | 6 ++++--
.../main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java | 5 +++--
2 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/8dd35631/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java
----------------------------------------------------------------------
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 9ac9402..4fcea64 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
@@ -533,16 +533,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;
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/8dd35631/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java
----------------------------------------------------------------------
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 a2b2935..0d880d0 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
@@ -83,8 +83,9 @@ public class FSHDFSUtils extends FSUtils {
Map<String, Map<String, InetSocketAddress>> addressMap =
(Map<String, Map<String, InetSocketAddress>>) getNNAddressesMethod
.invoke(null, conf);
- for (Map.Entry<String, Map<String, InetSocketAddress>> entry : addressMap.entrySet()) {
- Map<String, InetSocketAddress> nnMap = entry.getValue();
+ String nameService = serviceName.substring(serviceName.indexOf(":") + 1);
+ if (addressMap.containsKey(nameService)) {
+ Map<String, InetSocketAddress> nnMap = addressMap.get(nameService);
for (Map.Entry<String, InetSocketAddress> e2 : nnMap.entrySet()) {
InetSocketAddress addr = e2.getValue();
addresses.add(addr);