Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object-store: support real S3's If-Match semantics #6801

Closed
wants to merge 1 commit into from

Conversation

benesch
Copy link
Contributor

@benesch benesch commented Nov 26, 2024

As of today (0) S3 now supports the If-Match for in-place conditional writes. This commit adjusts the existing support for S3ConditionalPut::Etag mode for compatibility with real S3's particular semantics, which vary slightly from MinIO and R2. Specifically:

  • Real S3 can occasionally return 409 Conflict when concurrent If-Match requests are in progress. These requests need to be retried.

  • Real S3 returns 404 Not Found instead of 412 Precondition Failed when issuing an If-Match request against an object that does not exist.

I tested this against real S3, since localstack doesn't yet support If-Match. #6802 is a follow-up PR that will update CI to test this new support once we have a version of localstack to test against.

Fix #6799.

Which issue does this PR close?

#6799

Are there any user-facing changes?

None beyond what's described in the PR description.

cc @tustvold

@github-actions github-actions bot added the object-store Object Store Interface label Nov 26, 2024
As of today [0] S3 now supports the If-Match for in-place conditional
writes. This commit adjusts the existing support for
S3ConditionalPut::Etag mode for compatibility with real S3's particular
semantics, which vary slightly from MinIO and R2. Specifically:

  * Real S3 can occasionally return 409 Conflict when concurrent
    If-Match requests are in progress. These requests need to be
    retried.

  * Real S3 returns 404 Not Found instead of 412 Precondition Failed
    when issuing an If-Match request against an object that does not
    exist.

Fix apache#6799.

[0]: https://aws.amazon.com/about-aws/whats-new/2024/11/amazon-s3-functionality-conditional-writes/
@benesch benesch force-pushed the object-store-s3-put-if-match branch from f2ba56a to 5535851 Compare November 26, 2024 05:37
@benesch benesch changed the title Support real S3's If-Match semantics object-store: support real S3's If-Match semantics Nov 26, 2024
@benesch benesch mentioned this pull request Nov 26, 2024
Copy link
Contributor

@tustvold tustvold left a comment

Choose a reason for hiding this comment

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

Makes sense to me, thank you.

{
// Real S3 reports NotFound rather than PreconditionFailed when the
// object doesn't exist. Convert to PreconditionFailed for
// consistency with R2. This also matches what the HTTP spec
Copy link
Contributor

Choose a reason for hiding this comment

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

😅

@benesch
Copy link
Contributor Author

benesch commented Nov 26, 2024

Makes sense to me, thank you.

You bet! Anything else you need from me to merge this?

@tustvold
Copy link
Contributor

No, I think this looks good, but given the localstack update may land shortly I was going to hold this until then just to ensure there aren't any gremlins lurking

@benesch
Copy link
Contributor Author

benesch commented Nov 26, 2024

No, I think this looks good, but given the localstack update may land shortly I was going to hold this until then just to ensure there aren't any gremlins lurking

Makes sense! In that case would you prefer if I closed this PR in favor of #6802, so there's just one PR to review and merge after the new localstack release comes out? Or is it still useful to have both PRs?

@tustvold
Copy link
Contributor

Let's keep it for now just in case there's some unforeseen hickup with the localstack release, but yes presuming localstack lands we'll probably just merge the other PR

@benesch
Copy link
Contributor Author

benesch commented Nov 26, 2024

Sounds good.

@benesch
Copy link
Contributor Author

benesch commented Nov 28, 2024

Since all seems to be working with the latest version of localstack, I'm going to go ahead and close this in favor of #6802. Can always reopen this if necessary!

@benesch benesch closed this Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
object-store Object Store Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support S3 Put IfMatch
2 participants