HBASE-14280 Bulk Upload from HA cluster to remote HA hbase cluster fails (Ankit Singhal)
This commit is contained in:
parent
1545e1ed8d
commit
a7afc132e2
|
@ -27,6 +27,7 @@ import java.net.URI;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -66,8 +67,17 @@ public class FSHDFSUtils extends FSUtils {
|
||||||
dfsUtilClazz = Class.forName("org.apache.hadoop.hdfs.DFSUtil");
|
dfsUtilClazz = Class.forName("org.apache.hadoop.hdfs.DFSUtil");
|
||||||
}
|
}
|
||||||
if (getNNAddressesMethod == null) {
|
if (getNNAddressesMethod == null) {
|
||||||
getNNAddressesMethod =
|
try {
|
||||||
dfsUtilClazz.getMethod("getNNServiceRpcAddresses", Configuration.class);
|
// getNNServiceRpcAddressesForCluster is available only in version
|
||||||
|
// equal to or later than Hadoop 2.6
|
||||||
|
getNNAddressesMethod =
|
||||||
|
dfsUtilClazz.getMethod("getNNServiceRpcAddressesForCluster", Configuration.class);
|
||||||
|
} catch (NoSuchMethodError e) {
|
||||||
|
// If hadoop version is older than hadoop 2.6
|
||||||
|
getNNAddressesMethod =
|
||||||
|
dfsUtilClazz.getMethod("getNNServiceRpcAddresses", Configuration.class);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Map<String, InetSocketAddress>> addressMap =
|
Map<String, Map<String, InetSocketAddress>> addressMap =
|
||||||
|
@ -115,6 +125,17 @@ public class FSHDFSUtils extends FSUtils {
|
||||||
if (srcServiceName.equals(desServiceName)) {
|
if (srcServiceName.equals(desServiceName)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (srcServiceName.startsWith("ha-hdfs") && desServiceName.startsWith("ha-hdfs")) {
|
||||||
|
Collection<String> internalNameServices =
|
||||||
|
conf.getTrimmedStringCollection("dfs.internal.nameservices");
|
||||||
|
if (!internalNameServices.isEmpty()) {
|
||||||
|
if (internalNameServices.contains(srcServiceName.split(":")[1])) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (srcFs instanceof DistributedFileSystem && desFs instanceof DistributedFileSystem) {
|
if (srcFs instanceof DistributedFileSystem && desFs instanceof DistributedFileSystem) {
|
||||||
//If one serviceName is an HA format while the other is a non-HA format,
|
//If one serviceName is an HA format while the other is a non-HA format,
|
||||||
// maybe they refer to the same FileSystem.
|
// maybe they refer to the same FileSystem.
|
||||||
|
|
Loading…
Reference in New Issue