HBASE-17429 HBase bulkload cannot support HDFS viewFs (shenxianqiang)
This commit is contained in:
parent
dd1ae37148
commit
8dd35631ca
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue