public class S3ARetryPolicy extends Object implements org.apache.hadoop.io.retry.RetryPolicy
This uses the retry options in the configuration file to determine retry count and delays for "normal" retries and separately, for throttling; the latter is best handled for longer with an exponential back-off.
The retry policy is all built around that of the normal IO exceptions,
particularly those extracted from
S3AUtils.translateException(String, Path, SdkException)
.
Because the shouldRetry(Exception, int, int, boolean)
method
does this translation if an SdkException
is processed,
the policy defined for the IOEs also applies to the original exceptions.
Put differently: this retry policy aims to work for handlers of the untranslated exceptions, as well as the translated ones.
Note that because delete is considered idempotent, all s3a operations currently declare themselves idempotent. This means the retry policy here is more complex than it needs to be -but it does force us to consider when retrying operations would not be safe.
Modifier and Type | Field and Description |
---|---|
protected org.apache.hadoop.io.retry.RetryPolicy |
baseExponentialRetry
Exponential policy for the base of normal failures.
|
protected org.apache.hadoop.io.retry.RetryPolicy |
connectivityFailure
Client connectivity: baseExponentialRetry without worrying about whether
or not the command is idempotent.
|
protected org.apache.hadoop.io.retry.RetryPolicy |
fail
No retry on network and tangible API issues.
|
protected org.apache.hadoop.io.retry.RetryPolicy |
retryAwsClientExceptions
Handling of AWSClientIOException and subclasses.
|
protected org.apache.hadoop.io.retry.RetryPolicy |
retryIdempotentCalls
Idempotent calls which raise IOEs are retried.
|
protected org.apache.hadoop.io.retry.RetryPolicy |
throttlePolicy
Policy for throttle requests, which are considered repeatable, even for
non-idempotent calls, as the service rejected the call entirely.
|
Constructor and Description |
---|
S3ARetryPolicy(org.apache.hadoop.conf.Configuration conf)
Instantiate.
|
Modifier and Type | Method and Description |
---|---|
protected Map<Class<? extends Exception>,org.apache.hadoop.io.retry.RetryPolicy> |
createExceptionMap()
Subclasses can override this like a constructor to change behavior: call
superclass method, then modify it as needed, and return it.
|
protected org.apache.hadoop.io.retry.RetryPolicy |
createThrottleRetryPolicy(org.apache.hadoop.conf.Configuration conf)
Create the throttling policy.
|
protected org.apache.hadoop.conf.Configuration |
getConfiguration()
Get the configuration this policy was created from.
|
org.apache.hadoop.io.retry.RetryPolicy.RetryAction |
shouldRetry(Exception exception,
int retries,
int failovers,
boolean idempotent) |
protected final org.apache.hadoop.io.retry.RetryPolicy baseExponentialRetry
protected final org.apache.hadoop.io.retry.RetryPolicy retryIdempotentCalls
protected final org.apache.hadoop.io.retry.RetryPolicy throttlePolicy
protected final org.apache.hadoop.io.retry.RetryPolicy fail
protected final org.apache.hadoop.io.retry.RetryPolicy connectivityFailure
protected final org.apache.hadoop.io.retry.RetryPolicy retryAwsClientExceptions
public S3ARetryPolicy(org.apache.hadoop.conf.Configuration conf)
conf
- configuration to read.protected org.apache.hadoop.io.retry.RetryPolicy createThrottleRetryPolicy(org.apache.hadoop.conf.Configuration conf)
conf
- configuration to use.protected Map<Class<? extends Exception>,org.apache.hadoop.io.retry.RetryPolicy> createExceptionMap()
public org.apache.hadoop.io.retry.RetryPolicy.RetryAction shouldRetry(Exception exception, int retries, int failovers, boolean idempotent) throws Exception
shouldRetry
in interface org.apache.hadoop.io.retry.RetryPolicy
Exception
protected org.apache.hadoop.conf.Configuration getConfiguration()
Copyright © 2008–2024 Apache Software Foundation. All rights reserved.