feat(oci): support conditional object uploads - #267
Conversation
|
I found and fixed an OCI multipart-specific issue while running the acceptance test against a real OCI Object Storage bucket. OCI SDK's UploadStream always uses multipart uploads for non-empty streams. Passing If-Match through that path caused the condition to be applied to UploadPart, resulting in a 412 IfMatchFailed even when the destination object's ETag was correct. Conditional uploads now use a single PutObject request, while unconditional uploads continue to use UploadStream/multipart. Verified against a real OCI bucket: go test -v -count=1 ./objtesting Result: This verifies IfNotExists, invalid IfMatch, valid IfMatch, content preservation after failed conditions, and successful conditional replacement. |
d631d7f to
04153b2
Compare
04153b2 to
0a3ed48
Compare
d6f2d60 to
cbbe9c2
Compare
|
Hi maintainers — a gentle follow-up on this PR. I have now confirmed that this change also addresses the OCI connection leak previously reported in grafana/loki#17818. I reproduced the issue against a real OCI Object Storage bucket using Instance Principal authentication. With the existing
After changing OCI metadata operations to use The OCI provider unit tests and the full acceptance test against a real OCI Object Storage bucket also pass. This PR is now needed by grafana/loki#23710 for two reasons:
Could a maintainer please review this PR and let me know if any further changes are required for approval? I am available to address feedback promptly. If the implementation is ready, merging it would unblock the corresponding Grafana Objstore synchronization and the Loki OCI backend PR. Thank you! |
|
Hey @felix0102, I'm not a maintainer (or at least I haven't noticed being made one!) but I will give this a review for you this evening when my work finishes, might expedite being accepted. |
alsenz
left a comment
There was a problem hiding this comment.
Full disclosure - I'm not super familiar with the OCI libary and can't integration test this but with some very minor comments looks good to me.
Once thing I noticed - I think the README would also need an update to flag that objstore supports OCI now!
Signed-off-by: felix0102 <felix0102@qq.com>
Signed-off-by: felix0102 <felix0102@qq.com>
Signed-off-by: felix0102 <felix0102@qq.com>
Signed-off-by: felix0102 <felix0102@qq.com>
Signed-off-by: felix0102 <felix0102@qq.com>
6ffbef9 to
e251cd9
Compare
|
Hi @fpetkovski — this PR adds OCI support for the conditional-upload API and already has an approval from @alsenz. Would you be able to review it when you have time? I’d appreciate any feedback. Thank you! |
Signed-off-by: felix0102 <felix0102@qq.com>
8359c9a to
dd57942
Compare
|
Sorry for the noise. The previous rebase caused many review comments to become outdated. I’ve handled all feedback. Please let me know if you want me to revisit anything. |
|
Hi @GiedriusS — gentle follow-up on this PR. I’ve addressed all feedback from the previous review, the branch is clean, and all required checks are green. Could you please take another look when you have time and let me know if anything else is needed for approval? Thank you! |
What this changes
Adds conditional write support to the OCI object storage provider:
AttributesWithIfMatchWithIfNotExistsWhy
OCI Object Storage supports
If-MatchandIf-None-Match: *,but the objstore OCI provider does not currently expose these through
ObjectUploadOption. This prevents consumers from safely performingoptimistic-concurrency updates.
Notes
IfNotMatchis not advertised because OCI PutObject only accepts*for
If-None-Match.