Class S3ARetryPolicy
- All Implemented Interfaces:
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.
- Those exceptions considered unrecoverable (networking) are failed fast.
- All non-IOEs are failed immediately. Assumed: bugs in code, unrecoverable errors, etc
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.io.retry.RetryPolicy
org.apache.hadoop.io.retry.RetryPolicy.RetryAction -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.hadoop.io.retry.RetryPolicyExponential policy for the base of normal failures.protected final org.apache.hadoop.io.retry.RetryPolicyClient connectivity: baseExponentialRetry without worrying about whether or not the command is idempotent.protected final org.apache.hadoop.io.retry.RetryPolicyNo retry on network and tangible API issues.protected final org.apache.hadoop.io.retry.RetryPolicyRetry policy for all http 5xx errors not handled explicitly.protected final org.apache.hadoop.io.retry.RetryPolicyHandling of AWSClientIOException and subclasses.protected final org.apache.hadoop.io.retry.RetryPolicyIdempotent calls which raise IOEs are retried.protected final org.apache.hadoop.io.retry.RetryPolicyPolicy for throttle requests, which are considered repeatable, even for non-idempotent calls, as the service rejected the call entirely. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSubclasses 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.RetryPolicycreateThrottleRetryPolicy(org.apache.hadoop.conf.Configuration conf) Create the throttling policy.protected org.apache.hadoop.conf.ConfigurationGet the configuration this policy was created from.org.apache.hadoop.io.retry.RetryPolicy.RetryActionshouldRetry(Exception exception, int retries, int failovers, boolean idempotent)
-
Field Details
-
baseExponentialRetry
protected final org.apache.hadoop.io.retry.RetryPolicy baseExponentialRetryExponential policy for the base of normal failures. -
retryIdempotentCalls
protected final org.apache.hadoop.io.retry.RetryPolicy retryIdempotentCallsIdempotent calls which raise IOEs are retried. -
throttlePolicy
protected final org.apache.hadoop.io.retry.RetryPolicy throttlePolicyPolicy for throttle requests, which are considered repeatable, even for non-idempotent calls, as the service rejected the call entirely. -
fail
protected final org.apache.hadoop.io.retry.RetryPolicy failNo retry on network and tangible API issues. -
connectivityFailure
protected final org.apache.hadoop.io.retry.RetryPolicy connectivityFailureClient connectivity: baseExponentialRetry without worrying about whether or not the command is idempotent. -
retryAwsClientExceptions
protected final org.apache.hadoop.io.retry.RetryPolicy retryAwsClientExceptionsHandling of AWSClientIOException and subclasses. -
http5xxRetryPolicy
protected final org.apache.hadoop.io.retry.RetryPolicy http5xxRetryPolicyRetry policy for all http 5xx errors not handled explicitly.
-
-
Constructor Details
-
S3ARetryPolicy
public S3ARetryPolicy(org.apache.hadoop.conf.Configuration conf) Instantiate.- Parameters:
conf- configuration to read.
-
-
Method Details
-
createThrottleRetryPolicy
protected org.apache.hadoop.io.retry.RetryPolicy createThrottleRetryPolicy(org.apache.hadoop.conf.Configuration conf) Create the throttling policy. This will be called from the S3ARetryPolicy constructor, so subclasses must assume they are not initialized.- Parameters:
conf- configuration to use.- Returns:
- the retry policy for throttling events.
-
createExceptionMap
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.- Returns:
- Map from exception type to RetryPolicy
-
shouldRetry
public org.apache.hadoop.io.retry.RetryPolicy.RetryAction shouldRetry(Exception exception, int retries, int failovers, boolean idempotent) throws Exception - Specified by:
shouldRetryin interfaceorg.apache.hadoop.io.retry.RetryPolicy- Throws:
Exception
-
getConfiguration
protected org.apache.hadoop.conf.Configuration getConfiguration()Get the configuration this policy was created from.- Returns:
- the configuration.
-