Skip to content

Commit 850249b

Browse files
authored
Handle status code 200 for s3 CMU response (#122815)
When a CopmleteMultipartUpload request fails after the initial 200 response, the status code of the failure response use to be not set and hence got translated to status code 0. With #116212, we handle this case accordingly. Since AWS SDK 1.12.691, the status code is now set to 200 instead of 0. This PR changes our error handling code accordingly. Relates: #122431 Relates: #116212 Resolves: #122799 Relevant AWS SDK change https://github.com/aws/aws-sdk-java/blame/430899c217f34fae63b35c77f4d9bfd361c9de77/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java#L3696-L3709
1 parent 19fe0a4 commit 850249b

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

modules/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobContainer.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -899,11 +899,10 @@ public void compareAndExchangeRegister(
899899
logger.trace(() -> Strings.format("[%s]: compareAndExchangeRegister failed", key), e);
900900
if (e instanceof AmazonS3Exception amazonS3Exception
901901
&& (amazonS3Exception.getStatusCode() == 404
902-
|| amazonS3Exception.getStatusCode() == 0 && "NoSuchUpload".equals(amazonS3Exception.getErrorCode()))) {
902+
|| amazonS3Exception.getStatusCode() == 200 && "NoSuchUpload".equals(amazonS3Exception.getErrorCode()))) {
903903
// An uncaught 404 means that our multipart upload was aborted by a concurrent operation before we could complete it.
904904
// Also (rarely) S3 can start processing the request during a concurrent abort and this can result in a 200 OK with an
905-
// <Error><Code>NoSuchUpload</Code>... in the response, which the SDK translates to status code 0. Either way, this means
906-
// that our write encountered contention:
905+
// <Error><Code>NoSuchUpload</Code>... in the response. Either way, this means that our write encountered contention:
907906
delegate.onResponse(OptionalBytesReference.MISSING);
908907
} else {
909908
delegate.onFailure(e);

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,6 @@ tests:
394394
issue: https://github.com/elastic/elasticsearch/issues/122680
395395
- class: org.elasticsearch.entitlement.qa.EntitlementsDeniedIT
396396
issue: https://github.com/elastic/elasticsearch/issues/122566
397-
- class: org.elasticsearch.repositories.blobstore.testkit.analyze.S3RepositoryAnalysisRestIT
398-
method: testRepositoryAnalysis
399-
issue: https://github.com/elastic/elasticsearch/issues/122799
400397
- class: org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT
401398
issue: https://github.com/elastic/elasticsearch/issues/122810
402399

0 commit comments

Comments
 (0)