implement S3 conditional write IfMatch#11941
Conversation
S3 Image Test Results (AMD64 / ARM64) 2 files 2 suites 4m 37s ⏱️ Results for commit 0ed6453. ♻️ This comment has been updated with latest results. |
|
Thanks again for turning this around so fast, @bentsku! Very excited for this. |
bbd50e1 to
a879437
Compare
dominikschubert
left a comment
There was a problem hiding this comment.
Kudos on immediately jumping on this new feature.
Gave the logic a quick sanity check and didn't find any obvious issues with it 👍
Nice attention to edge cases as well 🚀
| # it seems that even if we overwrite the object with the same content, S3 will still reject the request if a | ||
| # write operation was done between creation and completion of the multipart upload, like the `Delete` | ||
| # counterpart of `IfNoneMatch` |
There was a problem hiding this comment.
question: because every write changes the ETag I assume?
There was a problem hiding this comment.
almost, if the content of the object is the same, the ETag does not change, it's most of the time a MD5 hash of the object content. Which is why it's a bit surprising! I also gave a quick write up here: https://github.com/apache/arrow-rs/issues/6799#issuecomment-2502344533
(I say most of the time because with encryption, sometimes it's the hash of the encrypted object)
This behavior was documented for IfNoneMatch, but not for IfMatch it seems, but I suspect it's because they use the same logic/primitive for both.
|
Thanks a lot for the review @dominikschubert 🙏 I've just pushed a new test because I thought of some edge case I wanted to test, as we never know... 😅 (overwrite a multipart which overwrite a multipart which overwrite a put object 🌀) but things are all good, no code change. I'll merge once it's green again! Thanks again for the very quick review! |
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 55m 29s ⏱️ - 54m 49s Results for commit 0ed6453. ± Comparison against base commit cf4b124. This pull request removes 2167 and adds 8 tests. Note that renamed tests count towards both. |
Motivation
Depends on #11940
AWS just released a new Conditional Write feature with
IfMatch(also called Compare-and-Swap) with https://aws.amazon.com/about-aws/whats-new/2024/11/amazon-s3-functionality-conditional-writes/Documented at: https://docs.aws.amazon.com/AmazonS3/latest/userguide/conditional-writes.html
This is a simple feature to implement now that we have everything is place already. Only issue is that we needed the latest ASF specs from the last botocore update.
This is needed for apache/arrow-rs-object-store#33 and would unblock the following PR: apache/arrow-rs#6802
Behavior is as expected by the documentation, except for
CompleteMultipartUploadwhere executing an operation between aCreateMultipartUploadandCompleteMultipartUploadwill trigger a 409 Conflict exception, and only a restart can unblock the situation (this was documented forIfNoneMatch, but not forIfMatch).Changes
IfMatchparameter and behavior forPutObjectandCompleteMultipartUpload