YARN-11237. Fix Bug while disabling proxy failover with Federation (#4658)
This commit is contained in:
parent
977f4b6165
commit
92abd99450
|
@ -107,7 +107,8 @@ public class TestFederationRMFailoverProxyProvider {
|
||||||
conf.setBoolean(YarnConfiguration.FEDERATION_FLUSH_CACHE_FOR_RM_ADDR,
|
conf.setBoolean(YarnConfiguration.FEDERATION_FLUSH_CACHE_FOR_RM_ADDR,
|
||||||
facadeFlushCache);
|
facadeFlushCache);
|
||||||
|
|
||||||
conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, true);
|
conf.setBoolean(YarnConfiguration.FEDERATION_ENABLED, true);
|
||||||
|
conf.setBoolean(YarnConfiguration.FEDERATION_FAILOVER_ENABLED, true);
|
||||||
conf.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
|
conf.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
|
||||||
conf.set(YarnConfiguration.RM_CLUSTER_ID, "cluster1");
|
conf.set(YarnConfiguration.RM_CLUSTER_ID, "cluster1");
|
||||||
conf.set(YarnConfiguration.RM_HA_IDS, "rm1,rm2,rm3");
|
conf.set(YarnConfiguration.RM_HA_IDS, "rm1,rm2,rm3");
|
||||||
|
|
|
@ -98,8 +98,7 @@ public class RMProxy<T> {
|
||||||
YarnConfiguration conf = (configuration instanceof YarnConfiguration)
|
YarnConfiguration conf = (configuration instanceof YarnConfiguration)
|
||||||
? (YarnConfiguration) configuration
|
? (YarnConfiguration) configuration
|
||||||
: new YarnConfiguration(configuration);
|
: new YarnConfiguration(configuration);
|
||||||
RetryPolicy retryPolicy = createRetryPolicy(conf,
|
RetryPolicy retryPolicy = createRetryPolicy(conf, isFailoverEnabled(conf));
|
||||||
(HAUtil.isHAEnabled(conf) || HAUtil.isFederationFailoverEnabled(conf)));
|
|
||||||
return newProxyInstance(conf, protocol, instance, retryPolicy);
|
return newProxyInstance(conf, protocol, instance, retryPolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +125,7 @@ public class RMProxy<T> {
|
||||||
final Class<T> protocol, RMProxy<T> instance, RetryPolicy retryPolicy)
|
final Class<T> protocol, RMProxy<T> instance, RetryPolicy retryPolicy)
|
||||||
throws IOException{
|
throws IOException{
|
||||||
RMFailoverProxyProvider<T> provider;
|
RMFailoverProxyProvider<T> provider;
|
||||||
if (HAUtil.isHAEnabled(conf) || HAUtil.isFederationEnabled(conf)) {
|
if (isFailoverEnabled(conf)) {
|
||||||
provider = instance.createRMFailoverProxyProvider(conf, protocol);
|
provider = instance.createRMFailoverProxyProvider(conf, protocol);
|
||||||
} else {
|
} else {
|
||||||
provider = instance.createNonHaRMFailoverProxyProvider(conf, protocol);
|
provider = instance.createNonHaRMFailoverProxyProvider(conf, protocol);
|
||||||
|
@ -303,4 +302,17 @@ public class RMProxy<T> {
|
||||||
return RetryPolicies.retryOtherThanRemoteAndSaslException(
|
return RetryPolicies.retryOtherThanRemoteAndSaslException(
|
||||||
RetryPolicies.TRY_ONCE_THEN_FAIL, exceptionToPolicyMap);
|
RetryPolicies.TRY_ONCE_THEN_FAIL, exceptionToPolicyMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isFailoverEnabled(YarnConfiguration conf) {
|
||||||
|
if (HAUtil.isHAEnabled(conf)) {
|
||||||
|
// Considering Resource Manager HA is enabled.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (HAUtil.isFederationEnabled(conf) && HAUtil.isFederationFailoverEnabled(conf)) {
|
||||||
|
// Considering both federation and federation failover are enabled.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue