Skip to content

rgw: support If-Match and If-None-Match on the CopyObject destination - #71588

Merged
anrao19 merged 3 commits into
ceph:mainfrom
mheler:wip-copy-object-dest-conditionals
Nov 13, 2026
Merged

anrao19 merged 3 commits into
ceph:mainfrom
mheler:wip-copy-object-dest-conditionals

Conversation

@mheler

@mheler mheler commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Apply the If-Match and If-None-Match request headers to the destination object on CopyObject, reusing PutObject's precondition checks. Conditional copies to a remote destination or through D4N write-back return 501.

Fixes: https://tracker.ceph.com/issues/79570

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@soumyakoduri soumyakoduri left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not specific to this PR -
the spec says "If a concurrent operation occurs during the upload S3 returns a 409 ConditionalRequestConflict response. On a 409 failure you should fetch the object's ETag and retry the upload."

Maybe there should be additional checks to validate these checks post Write/copy operation too.

Comment thread src/rgw/driver/rados/rgw_rados.cc Resolved
Comment thread src/rgw/driver/d4n/rgw_sal_d4n.cc Resolved
@mheler

mheler commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Not specific to this PR - the spec says "If a concurrent operation occurs during the upload S3 returns a 409 ConditionalRequestConflict response. On a 409 failure you should fetch the object's ETag and retry the upload."

Maybe there should be additional checks to validate these checks post Write/copy operation too.

Agreed, but that's a PutObject-wide gap rather than something this PR adds, since the copy shares the same head write. The race is already caught at commit on unversioned buckets, it just surfaces as a 500 instead of a 409.

@mheler
mheler requested a review from soumyakoduri September 9, 2026 11:44

@soumyakoduri soumyakoduri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me.

Comment thread src/rgw/driver/posix/rgw_sal_posix.cc Resolved
Comment thread src/rgw/rgw_sal_dbstore.cc Resolved
@mheler
mheler force-pushed the wip-copy-object-dest-conditionals branch from b4f00f2 to c1ea544 Compare September 28, 2026 11:37
@mheler
mheler requested a review from soumyakoduri September 28, 2026 11:38
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

1 similar comment
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@mheler
mheler force-pushed the wip-copy-object-dest-conditionals branch from c1ea544 to f6e5d38 Compare October 8, 2026 11:30
@soumyakoduri

Copy link
Copy Markdown
Contributor

Not specific to this PR - the spec says "If a concurrent operation occurs during the upload S3 returns a 409 ConditionalRequestConflict response. On a 409 failure you should fetch the object's ETag and retry the upload."
Maybe there should be additional checks to validate these checks post Write/copy operation too.

Agreed, but that's a PutObject-wide gap rather than something this PR adds, since the copy shares the same head write. The race is already caught at commit on unversioned buckets, it just surfaces as a 500 instead of a 409.

This error is added and being handled for ConditionalDelete as part of #72100. It should be addressed for ConditionalCopy too (may be as follow-up if required)

@mheler

mheler commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Not specific to this PR - the spec says "If a concurrent operation occurs during the upload S3 returns a 409 ConditionalRequestConflict response. On a 409 failure you should fetch the object's ETag and retry the upload."
Maybe there should be additional checks to validate these checks post Write/copy operation too.

Agreed, but that's a PutObject-wide gap rather than something this PR adds, since the copy shares the same head write. The race is already caught at commit on unversioned buckets, it just surfaces as a 500 instead of a 409.

This error is added and being handled for ConditionalDelete as part of #72100. It should be addressed for ConditionalCopy too (may be as follow-up if required)

@soumyakoduri wouldn't the follow up to #72100, #72109 resolve the ConditionalCopy concerns?

@mheler
mheler requested a review from adamemerson October 14, 2026 02:52
@mheler
mheler force-pushed the wip-copy-object-dest-conditionals branch from f6e5d38 to 044316f Compare October 26, 2026 15:36
@mheler

mheler commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

@cbodley @AliMasarweh could one of you please review this?

@AliMasarweh AliMasarweh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread doc/radosgw/s3/objectops.rst Outdated
+--------------------------------------+-------------------------------------------------+------------------------+------------+
| **If-Match** | Copies only if the destination ETag matches. | Entity Tag | No |
+--------------------------------------+-------------------------------------------------+------------------------+------------+
| **If-None-Match** | Copies only if the destination does not exist. | ``*`` | No |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that If-None-Match can accept an Entity Tag same as a wild card (i.e. "*")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, added. thanks for pointing that out!

@github-actions

Copy link
Copy Markdown

@AliMasarweh Thank you for reviewing this pull request! As a member of the Ceph organization, please add yourself to .githubmap in the main branch if you haven't already.

@mheler
mheler force-pushed the wip-copy-object-dest-conditionals branch 2 times, most recently from 54d7e2f to 3f0a65f Compare October 28, 2026 15:23
@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

Add If-Match and If-None-Match destination conditions to CopyObject.
Copies with these headers to a remote zonegroup, through the D4N
write cache, or on the POSIX and DBStore drivers return 501.

Fixes: https://tracker.ceph.com/issues/79570
Signed-off-by: Matthew N. Heler <[email protected]>
Add tests for the If-Match and If-None-Match destination headers on
CopyObject.

New tests:
- test_copy_object_dest_if_match: 404 on a missing destination, 412 on
  a mismatch, success on a match
- test_copy_object_dest_if_none_match: create-only copy succeeds on a
  missing destination, 412 when it exists

Signed-off-by: Matthew N. Heler <[email protected]>
Add an XXX note and a log line where CopyObject rejects destination
If-Match and If-None-Match: under the D4N write cache, when the
destination bucket is in a remote zonegroup, and on the POSIX driver.
The 501 is now visible in the log and these gaps are easy to find
later.

Signed-off-by: Matthew N. Heler <[email protected]>
@mheler
mheler force-pushed the wip-copy-object-dest-conditionals branch from 3f0a65f to 9963bbc Compare October 29, 2026 19:09
@anrao19

anrao19 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-anrao10-testing-2026-11-02-0708-main.

@anrao19

anrao19 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-anrao10-testing-2026-11-02-0708-main.

pr testing completed and approved by @ivancich, more deatils in : https://tracker.ceph.com/issues/82524.
@mheler, if no further testing is needed then this can be merged

@anrao19
anrao19 merged commit acfcfcc into ceph:main Nov 13, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants