|
@@ -276,24 +276,34 @@ public abstract class HATestUtil {
|
|
/** Sets the required configurations for performing failover. */
|
|
/** Sets the required configurations for performing failover. */
|
|
public static void setFailoverConfigurations(MiniDFSCluster cluster,
|
|
public static void setFailoverConfigurations(MiniDFSCluster cluster,
|
|
Configuration conf, String logicalName, int nsIndex) {
|
|
Configuration conf, String logicalName, int nsIndex) {
|
|
|
|
+ setFailoverConfigurations(cluster, conf, logicalName, nsIndex,
|
|
|
|
+ ConfiguredFailoverProxyProvider.class);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /** Sets the required configurations for performing failover. */
|
|
|
|
+ public static <P extends FailoverProxyProvider<?>> void
|
|
|
|
+ setFailoverConfigurations(MiniDFSCluster cluster, Configuration conf,
|
|
|
|
+ String logicalName, int nsIndex, Class<P> classFPP) {
|
|
MiniDFSCluster.NameNodeInfo[] nns = cluster.getNameNodeInfos(nsIndex);
|
|
MiniDFSCluster.NameNodeInfo[] nns = cluster.getNameNodeInfos(nsIndex);
|
|
List<InetSocketAddress> nnAddresses = new ArrayList<InetSocketAddress>(3);
|
|
List<InetSocketAddress> nnAddresses = new ArrayList<InetSocketAddress>(3);
|
|
for (MiniDFSCluster.NameNodeInfo nn : nns) {
|
|
for (MiniDFSCluster.NameNodeInfo nn : nns) {
|
|
nnAddresses.add(nn.nameNode.getNameNodeAddress());
|
|
nnAddresses.add(nn.nameNode.getNameNodeAddress());
|
|
}
|
|
}
|
|
- setFailoverConfigurations(conf, logicalName, nnAddresses);
|
|
|
|
|
|
+ setFailoverConfigurations(conf, logicalName, nnAddresses, classFPP);
|
|
}
|
|
}
|
|
|
|
|
|
public static void setFailoverConfigurations(Configuration conf, String logicalName,
|
|
public static void setFailoverConfigurations(Configuration conf, String logicalName,
|
|
InetSocketAddress ... nnAddresses){
|
|
InetSocketAddress ... nnAddresses){
|
|
- setFailoverConfigurations(conf, logicalName, Arrays.asList(nnAddresses));
|
|
|
|
|
|
+ setFailoverConfigurations(conf, logicalName, Arrays.asList(nnAddresses),
|
|
|
|
+ ConfiguredFailoverProxyProvider.class);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* Sets the required configurations for performing failover
|
|
* Sets the required configurations for performing failover
|
|
*/
|
|
*/
|
|
- public static void setFailoverConfigurations(Configuration conf,
|
|
|
|
- String logicalName, List<InetSocketAddress> nnAddresses) {
|
|
|
|
|
|
+ public static <P extends FailoverProxyProvider<?>> void
|
|
|
|
+ setFailoverConfigurations(Configuration conf, String logicalName,
|
|
|
|
+ List<InetSocketAddress> nnAddresses, Class<P> classFPP) {
|
|
setFailoverConfigurations(conf, logicalName,
|
|
setFailoverConfigurations(conf, logicalName,
|
|
Iterables.transform(nnAddresses, new Function<InetSocketAddress, String>() {
|
|
Iterables.transform(nnAddresses, new Function<InetSocketAddress, String>() {
|
|
|
|
|
|
@@ -302,7 +312,7 @@ public abstract class HATestUtil {
|
|
public String apply(InetSocketAddress addr) {
|
|
public String apply(InetSocketAddress addr) {
|
|
return "hdfs://" + addr.getHostName() + ":" + addr.getPort();
|
|
return "hdfs://" + addr.getHostName() + ":" + addr.getPort();
|
|
}
|
|
}
|
|
- }), ConfiguredFailoverProxyProvider.class);
|
|
|
|
|
|
+ }), classFPP);
|
|
}
|
|
}
|
|
|
|
|
|
public static <P extends FailoverProxyProvider<?>>
|
|
public static <P extends FailoverProxyProvider<?>>
|