-
Notifications
You must be signed in to change notification settings - Fork 288
core.py: fix exclusive write for small files #974
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
Conversation
|
Can we please have a test function added? Perhaps also a zero-length file would be nice. |
Sure let me work on that. |
|
@martindurant I updated the unit tests and also discovered a related bug in moto: getmoto/moto#9028 Once this bug is fixed in moto the xfail decorator can be removed from the remaining tests. |
|
Thank you. Thanks for filing the bug with moto - please let us know if something happens there. |
|
|
(check the version of moto and botocore you have versus the one in CI) |
|
It looks like the tests will fail if the botocore version is < 1.33.0 because that is when IfNoneMatch support for conditional writes was added to the s3 client. I'll see if we can conditionally mark the tests as xfail depending on the botocore version to ensure they continue passing on newer botocore versions moving forward. |
|
@martindurant is there anything else you want to see in this PR? |
|
Still catching aiobotocore versions >=2.8.0,<2.9.0 Also some formatting |
Prior to this change the exclusive write mode "x" did not behave properly for small files, instead acting the same as "w". This change solves that by passing the IfNotMatch header to put_object even when writing small files that don't require a multipart upload.
|
Thanks @martindurant I just took another stab at it. If you can trigger Ci that would be great. After manually searching through the botocore docs of different versions I found IfNoneMatch for put_object and complete_multipart_upload wasn't added to botocore until 1.36.0, not 1.33.0. |
|
+1 |
Prior to this change the exclusive write mode "x" did not behave properly for small files, instead acting the same as "w".
This change solves that by passing the IfNotMatch header to put_object even when writing small files that don't require a multipart upload.
Fixes #973
Tested by running the test script linked in the issue as well as updating the unit tests.