Skip to content

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

Closed
benesch wants to merge 1 commit intoapache:mainfrom
benesch:object-store-s3-put-if-match
Closed

object-store: support real S3's If-Match semantics#6801
benesch wants to merge 1 commit intoapache:mainfrom
benesch:object-store-s3-put-if-match

Conversation

@benesch
Copy link
Copy Markdown
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 apache/arrow-rs-object-store#33.

Which issue does this PR close?

apache/arrow-rs-object-store#33

Are there any user-facing changes?

None beyond what's described in the PR description.

cc @tustvold

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 #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
Copy link
Copy Markdown
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

😅

@benesch
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

benesch commented Nov 26, 2024

Sounds good.

@benesch
Copy link
Copy Markdown
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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support S3 Put IfMatch

2 participants