S3BlobContainer: Revert broadened exception handler (#126731)

Catching Exception instead of AmazonClientException in copyBlob and
executeMultipart led to failures in S3RepositoryAnalysisRestIT due to
the injected exceptions getting wrapped in IOExceptions that prevented
them from being caught and handled in BlobAnalyzeAction.

Closes #126576
This commit is contained in:
Brendan Cully 2025-04-14 10:20:11 -07:00 committed by GitHub
parent 2a2491897f
commit d02b65308e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 5 deletions

View file

@ -377,7 +377,7 @@ class S3BlobContainer extends AbstractBlobContainer {
SocketAccess.doPrivilegedVoid(() -> { clientReference.client().copyObject(copyRequest); });
}
}
} catch (final Exception e) {
} catch (final AmazonClientException e) {
if (e instanceof AmazonServiceException ase && ase.getStatusCode() == RestStatus.NOT_FOUND.getStatus()) {
throw new NoSuchFileException(
"Copy source [" + s3SourceBlobContainer.buildKey(sourceBlobName) + "] not found: " + ase.getMessage()
@ -618,7 +618,7 @@ class S3BlobContainer extends AbstractBlobContainer {
SocketAccess.doPrivilegedVoid(() -> clientReference.client().completeMultipartUpload(complRequest));
}
success = true;
} catch (final Exception e) {
} catch (final AmazonClientException e) {
if (e instanceof AmazonServiceException ase && ase.getStatusCode() == RestStatus.NOT_FOUND.getStatus()) {
throw new NoSuchFileException(blobName, null, e.getMessage());
}

View file

@ -402,9 +402,6 @@ tests:
- class: org.elasticsearch.xpack.esql.action.EsqlActionIT
method: testQueryOnEmptyDataIndex
issue: https://github.com/elastic/elasticsearch/issues/126580
- class: org.elasticsearch.repositories.blobstore.testkit.analyze.S3RepositoryAnalysisRestIT
method: testRepositoryAnalysis
issue: https://github.com/elastic/elasticsearch/issues/126576
- class: org.elasticsearch.xpack.ilm.TimeSeriesDataStreamsIT
method: testShrinkActionInPolicyWithoutHotPhase
issue: https://github.com/elastic/elasticsearch/issues/126746