Skip to content

Conversation

@DaveCTurner
Copy link
Contributor

If a CompleteMultipartUpload request fails then we attempt to clean up
by calling the AbortMultipartUpload API. This cleanup may also fail,
and a failure here will supersede the original failure. The cleanup is
really a best-effort thing so we should ignore failures. In particular
if the CompleteMultipartUpload has an If-None-Match precondition
then this may fail with a 409 Conflict and in that case the upload no
longer exists, so we would expect the AbortMultipartUpload call to
fail with a 404.

This commit extends S3HttpHandler to respond with both 412 and 409s on
precondition failures, cleaning up the upload on a 409 but not a 412,
triggering the unwanted failure path in some tests, and adds exception
handling to deal with it.

If a `CompleteMultipartUpload` request fails then we attempt to clean up
by calling the `AbortMultipartUpload` API. This cleanup may also fail,
and a failure here will supersede the original failure. The cleanup is
really a best-effort thing so we should ignore failures. In particular
if the `CompleteMultipartUpload` has an `If-None-Match` precondition
then this may fail with a `409 Conflict` and in that case the upload no
longer exists, so we would expect the `AbortMultipartUpload` call to
fail with a 404.

This commit extends `S3HttpHandler` to respond with both 412 and 409s on
precondition failures, cleaning up the upload on a 409 but not a 412,
triggering the unwanted failure path in some tests, and adds exception
handling to deal with it.
@DaveCTurner DaveCTurner added >bug :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v9.3.0 labels Nov 25, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Coordination Meta label for Distributed Coordination team label Nov 25, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @DaveCTurner, I've created a changelog YAML for you.

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination)

@joshua-adams-1
Copy link
Contributor

Hey, this change partially includes changes from #138542. Is it to be merged first or second?

@DaveCTurner
Copy link
Contributor Author

This one goes in first, fixing the missing exception handling, then #138542 will just be about adding the If-Match support and won't change any production behaviour.

Copy link
Contributor

@joshua-adams-1 joshua-adams-1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DaveCTurner DaveCTurner merged commit 4356a3e into elastic:main Nov 25, 2025
34 checks passed
@DaveCTurner DaveCTurner deleted the 2025/11/25/s3-handle-abort-cleanup-failure branch November 25, 2025 15:07
ncordon pushed a commit to ncordon/elasticsearch that referenced this pull request Nov 26, 2025
If a `CompleteMultipartUpload` request fails then we attempt to clean up
by calling the `AbortMultipartUpload` API. This cleanup may also fail,
and a failure here will supersede the original failure. The cleanup is
really a best-effort thing so we should ignore failures. In particular
if the `CompleteMultipartUpload` has an `If-None-Match` precondition
then this may fail with a `409 Conflict` and in that case the upload no
longer exists, so we would expect the `AbortMultipartUpload` call to
fail with a 404.

This commit extends `S3HttpHandler` to respond with both 412 and 409s on
precondition failures, cleaning up the upload on a 409 but not a 412,
triggering the unwanted failure path in some tests, and adds exception
handling to deal with it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs Team:Distributed Coordination Meta label for Distributed Coordination team v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants