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!
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! |
8359c9a to
dd57942
Compare
|
Hi @GiedriusS, this PR has been rebased onto the latest main and updated based on the previous feedback. The latest version:
All checks are now passing. When you have time, could you please take another look? Thanks! |
Signed-off-by: Felix <felix0102@qq.com>
d8af8b0 to
9a4ddd3
Compare
Signed-off-by: Felix <felix0102@qq.com>
9a4ddd3 to
3105a50
Compare
|
Hi @petkovski, hope you’re doing well. @GiedriusS kindly provided the initial review, and I’ve addressed the feedback and updated the PR accordingly. All CI checks are now passing. |
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.