Class S3ARetryPolicy

java.lang.Object
org.apache.hadoop.fs.s3a.S3ARetryPolicy
All Implemented Interfaces:
org.apache.hadoop.io.retry.RetryPolicy

public class S3ARetryPolicy extends Object implements org.apache.hadoop.io.retry.RetryPolicy
The S3A request retry policy.

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.

  1. Those exceptions considered unrecoverable (networking) are failed fast.
  2. All non-IOEs are failed immediately. Assumed: bugs in code, unrecoverable errors, etc
For non-idempotent operations, only failures due to throttling or from failures which are known to only arise prior to talking to S3 are retried.

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.

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.hadoop.io.retry.RetryPolicy

    org.apache.hadoop.io.retry.RetryPolicy.RetryAction
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.apache.hadoop.io.retry.RetryPolicy
    Exponential policy for the base of normal failures.
    protected final org.apache.hadoop.io.retry.RetryPolicy
    Client connectivity: baseExponentialRetry without worrying about whether or not the command is idempotent.
    protected final org.apache.hadoop.io.retry.RetryPolicy
    No retry on network and tangible API issues.
    protected final org.apache.hadoop.io.retry.RetryPolicy
    Retry policy for all http 5xx errors not handled explicitly.
    protected final org.apache.hadoop.io.retry.RetryPolicy
    Handling of AWSClientIOException and subclasses.
    protected final org.apache.hadoop.io.retry.RetryPolicy
    Idempotent calls which raise IOEs are retried.
    protected final org.apache.hadoop.io.retry.RetryPolicy
    Policy for throttle requests, which are considered repeatable, even for non-idempotent calls, as the service rejected the call entirely.
  • Constructor Summary

    Constructors
    Constructor
    Description
    S3ARetryPolicy(org.apache.hadoop.conf.Configuration conf)
    Instantiate.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Map<Class<? extends Exception>,org.apache.hadoop.io.retry.RetryPolicy>
    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
    Get the configuration this policy was created from.
    org.apache.hadoop.io.retry.RetryPolicy.RetryAction
    shouldRetry(Exception exception, int retries, int failovers, boolean idempotent)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • baseExponentialRetry

      protected final org.apache.hadoop.io.retry.RetryPolicy baseExponentialRetry
      Exponential policy for the base of normal failures.
    • retryIdempotentCalls

      protected final org.apache.hadoop.io.retry.RetryPolicy retryIdempotentCalls
      Idempotent calls which raise IOEs are retried.
    • throttlePolicy

      protected final 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.
    • fail

      protected final org.apache.hadoop.io.retry.RetryPolicy fail
      No retry on network and tangible API issues.
    • connectivityFailure

      protected final org.apache.hadoop.io.retry.RetryPolicy connectivityFailure
      Client connectivity: baseExponentialRetry without worrying about whether or not the command is idempotent.
    • retryAwsClientExceptions

      protected final org.apache.hadoop.io.retry.RetryPolicy retryAwsClientExceptions
      Handling of AWSClientIOException and subclasses.
    • http5xxRetryPolicy

      protected final org.apache.hadoop.io.retry.RetryPolicy http5xxRetryPolicy
      Retry 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:
      shouldRetry in interface org.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.