YARN-6970. Add PoolInitializationException as retriable exception in FederationFacade. (Giovanni Matteo Fumarola via Subru).
This commit is contained in:
parent
1db4788b7d
commit
ad2a350662
@ -70,6 +70,7 @@
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.zaxxer.hikari.pool.HikariPool.PoolInitializationException;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -162,6 +163,7 @@ public static RetryPolicy createRetryPolicy(Configuration conf) {
|
||||
exceptionToPolicyMap.put(FederationStateStoreRetriableException.class,
|
||||
basePolicy);
|
||||
exceptionToPolicyMap.put(CacheLoaderException.class, basePolicy);
|
||||
exceptionToPolicyMap.put(PoolInitializationException.class, basePolicy);
|
||||
|
||||
RetryPolicy retryPolicy = RetryPolicies.retryByException(
|
||||
RetryPolicies.TRY_ONCE_THEN_FAIL, exceptionToPolicyMap);
|
||||
|
@ -30,6 +30,8 @@
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.zaxxer.hikari.pool.HikariPool.PoolInitializationException;
|
||||
|
||||
/**
|
||||
* Test class to validate FederationStateStoreFacade retry policy.
|
||||
*/
|
||||
@ -119,4 +121,26 @@ public void testFacadeCacheRetriableException() throws Exception {
|
||||
policy.shouldRetry(new CacheLoaderException(""), maxRetries, 0, false);
|
||||
Assert.assertEquals(RetryAction.FAIL.action, action.action);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test to validate that PoolInitializationException is a retriable exception.
|
||||
*/
|
||||
@Test
|
||||
public void testFacadePoolInitRetriableException() throws Exception {
|
||||
// PoolInitializationException is a retriable exception
|
||||
conf = new Configuration();
|
||||
conf.setInt(YarnConfiguration.CLIENT_FAILOVER_RETRIES, maxRetries);
|
||||
RetryPolicy policy = FederationStateStoreFacade.createRetryPolicy(conf);
|
||||
RetryAction action = policy.shouldRetry(
|
||||
new PoolInitializationException(new YarnException()), 0, 0, false);
|
||||
// We compare only the action, delay and the reason are random value
|
||||
// during this test
|
||||
Assert.assertEquals(RetryAction.RETRY.action, action.action);
|
||||
|
||||
// After maxRetries we stop to retry
|
||||
action =
|
||||
policy.shouldRetry(new PoolInitializationException(new YarnException()),
|
||||
maxRetries, 0, false);
|
||||
Assert.assertEquals(RetryAction.FAIL.action, action.action);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user