Repository: hadoop
Updated Branches:
  refs/heads/branch-3.1 cb6555df2 -> 86f543aa8


HADOOP-15346 S3ARetryPolicy for 400/BadArgument to be "fail". Contributed by 
Steve Loughran.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/86f543aa
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/86f543aa
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/86f543aa

Branch: refs/heads/branch-3.1
Commit: 86f543aa858920a0e03dbdfe8c80984877485cec
Parents: cb6555d
Author: Aaron Fabbri <fab...@apache.org>
Authored: Tue Apr 10 23:55:38 2018 -0700
Committer: Aaron Fabbri <fab...@apache.org>
Committed: Tue Apr 10 23:58:22 2018 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/fs/s3a/S3ARetryPolicy.java |  6 +++---
 .../java/org/apache/hadoop/fs/s3a/TestInvoker.java    | 14 ++++----------
 2 files changed, 7 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/86f543aa/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ARetryPolicy.java
----------------------------------------------------------------------
diff --git 
a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ARetryPolicy.java
 
b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ARetryPolicy.java
index d857330..2b361fd 100644
--- 
a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ARetryPolicy.java
+++ 
b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ARetryPolicy.java
@@ -175,9 +175,9 @@ public class S3ARetryPolicy implements RetryPolicy {
     // which isn't going to be recovered from
     policyMap.put(EOFException.class, retryIdempotentCalls);
 
-    // policy on a 400/bad request still ambiguous. Given it
-    // comes and goes on test runs: try again
-    policyMap.put(AWSBadRequestException.class, connectivityFailure);
+    // policy on a 400/bad request still ambiguous.
+    // Treated as an immediate failure
+    policyMap.put(AWSBadRequestException.class, fail);
 
     // Status 500 error code is also treated as a connectivity problem
     policyMap.put(AWSStatus500Exception.class, connectivityFailure);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/86f543aa/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestInvoker.java
----------------------------------------------------------------------
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestInvoker.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestInvoker.java
index d29e2df..5da665c 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestInvoker.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestInvoker.java
@@ -283,18 +283,12 @@ public class TestInvoker extends Assert {
   /**
    * Repeatedly retry until eventually a bad request succeeds.
    */
-  @Test
-  public void testRetryBadRequestIdempotent() throws Throwable {
-    final AtomicInteger counter = new AtomicInteger(0);
-    final int attemptsBeforeSuccess = ACTIVE_RETRY_LIMIT;
-    invoker.retry("test", null, true,
+  @Test(expected = AWSBadRequestException.class)
+  public void testRetryBadRequestNotIdempotent() throws Throwable {
+    invoker.retry("test", null, false,
         () -> {
-          if (counter.incrementAndGet() < attemptsBeforeSuccess) {
-            throw BAD_REQUEST;
-          }
+          throw BAD_REQUEST;
         });
-    assertEquals(attemptsBeforeSuccess, counter.get());
-    assertEquals("retry count ", attemptsBeforeSuccess - 1, retryCount);
   }
 
   @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to