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/trunk@1552920 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b9ae3087c0
commit
624703ed7b
@ -69,13 +69,6 @@ protected Random initialValue() {
|
|||||||
*/
|
*/
|
||||||
public static final RetryPolicy RETRY_FOREVER = new RetryForever();
|
public static final RetryPolicy RETRY_FOREVER = new RetryForever();
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Keep failing over forever
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public static final RetryPolicy FAILOVER_FOREVER = new FailoverForever();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Keep trying a limited number of times, waiting a fixed time between attempts,
|
* Keep trying a limited number of times, waiting a fixed time between attempts,
|
||||||
@ -174,14 +167,6 @@ public RetryAction shouldRetry(Exception e, int retries, int failovers,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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.
|
* Retry up to maxRetries.
|
||||||
* The actual sleep time of the n-th retry is f(n, sleepTime),
|
* The actual sleep time of the n-th retry is f(n, sleepTime),
|
||||||
|
@ -86,9 +86,7 @@ public static void setup() throws IOException {
|
|||||||
setRpcAddressForRM(RM1_NODE_ID, RM1_PORT_BASE);
|
setRpcAddressForRM(RM1_NODE_ID, RM1_PORT_BASE);
|
||||||
setRpcAddressForRM(RM2_NODE_ID, RM2_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_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_FIXED_PORTS, true);
|
||||||
conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_USE_RPC, true);
|
conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_USE_RPC, true);
|
||||||
|
|
||||||
|
@ -225,19 +225,17 @@ public static RetryPolicy createRetryPolicy(Configuration conf) {
|
|||||||
int maxFailoverAttempts = conf.getInt(
|
int maxFailoverAttempts = conf.getInt(
|
||||||
YarnConfiguration.CLIENT_FAILOVER_MAX_ATTEMPTS, -1);
|
YarnConfiguration.CLIENT_FAILOVER_MAX_ATTEMPTS, -1);
|
||||||
|
|
||||||
RetryPolicy basePolicy = RetryPolicies.TRY_ONCE_THEN_FAIL;
|
|
||||||
if (maxFailoverAttempts == -1) {
|
if (maxFailoverAttempts == -1) {
|
||||||
if (waitForEver) {
|
if (waitForEver) {
|
||||||
basePolicy = RetryPolicies.FAILOVER_FOREVER;
|
maxFailoverAttempts = Integer.MAX_VALUE;
|
||||||
} else {
|
} else {
|
||||||
basePolicy = new FailoverUptoMaximumTimePolicy(
|
maxFailoverAttempts = (int) (rmConnectWaitMS / failoverSleepBaseMs);
|
||||||
System.currentTimeMillis() + rmConnectWaitMS);
|
|
||||||
}
|
}
|
||||||
maxFailoverAttempts = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return RetryPolicies.failoverOnNetworkException(basePolicy,
|
return RetryPolicies.failoverOnNetworkException(
|
||||||
maxFailoverAttempts, failoverSleepBaseMs, failoverSleepMaxMs);
|
RetryPolicies.TRY_ONCE_THEN_FAIL, maxFailoverAttempts,
|
||||||
|
failoverSleepBaseMs, failoverSleepMaxMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (waitForEver) {
|
if (waitForEver) {
|
||||||
|
Loading…
Reference in New Issue
Block a user