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..aca51cf 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 @@ -27,6 +27,7 @@ import java.net.URI; import java.util.HashSet; import java.util.Map; import java.util.Set; +import java.util.Collection; import com.google.common.collect.Sets; import org.apache.commons.logging.Log; @@ -38,6 +39,7 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.DistributedFileSystem; import org.apache.hadoop.hdfs.server.namenode.LeaseExpiredException; +import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_INTERNAL_NAMESERVICES_KEY; /** @@ -59,7 +61,6 @@ public class FSHDFSUtils extends FSUtils { Configuration conf) { Set addresses = new HashSet(); String serviceName = fs.getCanonicalServiceName(); - if (serviceName.startsWith("ha-hdfs")) { try { if (dfsUtilClazz == null) { @@ -67,7 +68,7 @@ public class FSHDFSUtils extends FSUtils { } if (getNNAddressesMethod == null) { getNNAddressesMethod = - dfsUtilClazz.getMethod("getNNServiceRpcAddresses", Configuration.class); + dfsUtilClazz.getMethod("getNNServiceRpcAddressesForCluster", Configuration.class); } Map> addressMap = @@ -115,6 +116,12 @@ public class FSHDFSUtils extends FSUtils { if (srcServiceName.equals(desServiceName)) { return true; } + if (srcServiceName.startsWith("ha-hdfs") && desServiceName.startsWith("ha-hdfs")) { + Collection parentNameServices = conf.getTrimmedStringCollection + (DFS_INTERNAL_NAMESERVICES_KEY); + if(parentNameServices.contains(srcServiceName.split(":")[1])){return true;} + else{return false;} + } if (srcFs instanceof DistributedFileSystem && desFs instanceof DistributedFileSystem) { //If one serviceName is an HA format while the other is a non-HA format, // maybe they refer to the same FileSystem. diff --git a/pom.xml b/pom.xml index fbfa819..95da2cc 100644 --- a/pom.xml +++ b/pom.xml @@ -881,7 +881,7 @@ ${maven.build.timestamp} 1.6 - 2.2.0 + 2.6.0 1.2.1 1.2 1.7