-
Notifications
You must be signed in to change notification settings - Fork 817
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: Conditional put and rename_if_not_exist on S3 #6285
Comments
We are implementing it on LocalStack, should be available in From what I've seen, it's less powerful than R2, as you cannot specify any value other than I was already looking for the PR/feature request here when I read about that feature 😄 |
@wjones127 👋 if you find yourself too busy with other things, I could probably take a crack at this 😄 |
I haven't finished this. But from what's I've looked at, it's already implemented. It's just a matter of changing the default behavior / configuration and documenting and testing that. |
How do you plan on implementing Minio already supported these headers prior to AWS, but has anyone tried to use Minio for the conditional operations without dynamodb? |
One idea maybe would be to use the conditional Put with the Is this that bad? In the cases where clients use conditonal operations everything is safeguarded and in the cases where clients already just overwrite a file it does not change anything because there is no guarantee that another client will not overwrite anything. In terms of clients making sure that there is no overwriting happening, conditional put on a client and then force copying should semantically be the same as conditional copy. Deleting and other operations would be a problem though. What happens if the dummy file is deleted prior to copying? Get with have empty files, etc. Clients need to then ignore markers on list, delete and get and only honor them for put and copy. |
After playing around a bit, I found out that this can be worked around just by using multipart copy:
Using the header just for |
Add support for `PutMode::Create` and `copy_if_not_exists` on native AWS S3, which uses the underlying conditional write primitive that Amazon launched earlier this year [0]. The conditional write primitive is simpler than what's available in other S3-like products (e.g., R2), so new modes for `s3_copy_if_not_exists` and `s3_conditional_put` are added to select the native S3-specific behavior. To maintain strict backwards compatibility (e.g. with older versions of LocalStack), the new behavior is not on by default. It must be explicitly requested by the end user. The implementation for `PutMode::Create` is straightforward. The implementation of `copy_if_not_exists` is a bit more involved, as it requires managing a multipart upload that uses the UploadPartCopy operation, which was not previously supported by this crate's S3 client. To ensure test coverage, the object store workflow now runs the AWS integration tests with conditional put both disabled and enabled. Fix apache#6285. [0]: https://aws.amazon.com/about-aws/whats-new/2024/08/amazon-s3-conditional-writes/
I put up #6682, which implements both
@fhilgers thanks for the pointer here. Indeed that seems to work as expected. |
Add support for `PutMode::Create` and `copy_if_not_exists` on native AWS S3, which uses the underlying conditional write primitive that Amazon launched earlier this year [0]. The conditional write primitive is simpler than what's available in other S3-like products (e.g., R2), so new modes for `s3_copy_if_not_exists` and `s3_conditional_put` are added to select the native S3-specific behavior. To maintain strict backwards compatibility (e.g. with older versions of LocalStack), the new behavior is not on by default. It must be explicitly requested by the end user. The implementation for `PutMode::Create` is straightforward. The implementation of `copy_if_not_exists` is a bit more involved, as it requires managing a multipart upload that uses the UploadPartCopy operation, which was not previously supported by this crate's S3 client. To ensure test coverage, the object store workflow now runs the AWS integration tests with conditional put both disabled and enabled. Fix apache#6285. [0]: https://aws.amazon.com/about-aws/whats-new/2024/08/amazon-s3-conditional-writes/
FYI the support has been broadened to not just wildcards |
PRs are up! #6799 (comment) |
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
This is now supported on S3: https://aws.amazon.com/about-aws/whats-new/2024/08/amazon-s3-conditional-writes/
Describe the solution you'd like
We should make sure this works out-of-the-box. Also need to maintain compatibility with Minio, Localstack, and CloudFlare R2.
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: