YARN-1028. Addendum patch. Added FailoverProxyProvider capability to ResourceManager to help with RM failover.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1552921 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
68164b197b
commit
2dc61dea3c
|
@ -69,13 +69,6 @@ public class RetryPolicies {
|
|||
*/
|
||||
public static final RetryPolicy RETRY_FOREVER = new RetryForever();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Keep failing over forever
|
||||
* </p>
|
||||
*/
|
||||
public static final RetryPolicy FAILOVER_FOREVER = new FailoverForever();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Keep trying a limited number of times, waiting a fixed time between attempts,
|
||||
|
@ -173,14 +166,6 @@ public class RetryPolicies {
|
|||
return RetryAction.RETRY;
|
||||
}
|
||||
}
|
||||
|
||||
static class FailoverForever implements RetryPolicy {
|
||||
@Override
|
||||
public RetryAction shouldRetry(Exception e, int retries, int failovers,
|
||||
boolean isIdempotentOrAtMostOnce) throws Exception {
|
||||
return RetryAction.FAILOVER_AND_RETRY;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retry up to maxRetries.
|
||||
|
|
|
@ -86,9 +86,7 @@ public class TestRMFailover {
|
|||
setRpcAddressForRM(RM1_NODE_ID, RM1_PORT_BASE);
|
||||
setRpcAddressForRM(RM2_NODE_ID, RM2_PORT_BASE);
|
||||
|
||||
conf.setInt(YarnConfiguration.CLIENT_FAILOVER_MAX_ATTEMPTS, 100);
|
||||
conf.setLong(YarnConfiguration.CLIENT_FAILOVER_SLEEPTIME_BASE_MS, 100L);
|
||||
conf.setLong(YarnConfiguration.CLIENT_FAILOVER_SLEEPTIME_MAX_MS, 1000L);
|
||||
conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_FIXED_PORTS, true);
|
||||
conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_USE_RPC, true);
|
||||
|
||||
|
|
|
@ -225,19 +225,17 @@ public class RMProxy<T> {
|
|||
int maxFailoverAttempts = conf.getInt(
|
||||
YarnConfiguration.CLIENT_FAILOVER_MAX_ATTEMPTS, -1);
|
||||
|
||||
RetryPolicy basePolicy = RetryPolicies.TRY_ONCE_THEN_FAIL;
|
||||
if (maxFailoverAttempts == -1) {
|
||||
if (waitForEver) {
|
||||
basePolicy = RetryPolicies.FAILOVER_FOREVER;
|
||||
maxFailoverAttempts = Integer.MAX_VALUE;
|
||||
} else {
|
||||
basePolicy = new FailoverUptoMaximumTimePolicy(
|
||||
System.currentTimeMillis() + rmConnectWaitMS);
|
||||
maxFailoverAttempts = (int) (rmConnectWaitMS / failoverSleepBaseMs);
|
||||
}
|
||||
maxFailoverAttempts = 0;
|
||||
}
|
||||
|
||||
return RetryPolicies.failoverOnNetworkException(basePolicy,
|
||||
maxFailoverAttempts, failoverSleepBaseMs, failoverSleepMaxMs);
|
||||
return RetryPolicies.failoverOnNetworkException(
|
||||
RetryPolicies.TRY_ONCE_THEN_FAIL, maxFailoverAttempts,
|
||||
failoverSleepBaseMs, failoverSleepMaxMs);
|
||||
}
|
||||
|
||||
if (waitForEver) {
|
||||
|
|
Loading…
Reference in New Issue