Skip to content

HDDS-13921. Conditional Copy (CopyObject)#10207

Open
YutaLin wants to merge 7 commits intoapache:masterfrom
YutaLin:HDDS-13921_Conditonal_Copy
Open

HDDS-13921. Conditional Copy (CopyObject)#10207
YutaLin wants to merge 7 commits intoapache:masterfrom
YutaLin:HDDS-13921_Conditonal_Copy

Conversation

@YutaLin
Copy link
Copy Markdown
Contributor

@YutaLin YutaLin commented May 7, 2026

What changes were proposed in this pull request?

support CopyObject conditions include

  • x-amz-copy-source-if-match: - Copy only if source ETag matches
  • x-amz-copy-source-if-none-match: - Copy only if source ETag doesn't match
  • x-amz-copy-source-if-modified-since: - Copy only if source modified after
  • x-amz-copy-source-if-unmodified-since: - Copy only if source not modified since
  • If-None-Match, If-Match

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-13921

How was this patch tested?

add conditional copy object test and run action ci (https://github.com/YutaLin/ozone/actions/runs/25467526822)

@YutaLin YutaLin marked this pull request as ready for review May 7, 2026 02:41
@YutaLin
Copy link
Copy Markdown
Contributor Author

YutaLin commented May 7, 2026

Hi @ivandika3, @peterxcli
Could you help me review it? appreciate!

@peterxcli peterxcli requested review from ivandika3 and peterxcli May 7, 2026 05:38
Copy link
Copy Markdown
Member

@peterxcli peterxcli left a comment

Choose a reason for hiding this comment

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

LGTM. Could you also add s3 sdk v1/v2 test?

@YutaLin
Copy link
Copy Markdown
Contributor Author

YutaLin commented May 8, 2026

Hi @peterxcli, thanks for the review!
I've added S3SDKV1/V2 tests.

@YutaLin YutaLin requested a review from peterxcli May 8, 2026 00:25
Copy link
Copy Markdown
Member

@peterxcli peterxcli left a comment

Choose a reason for hiding this comment

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

@YutaLin I think this patch only handle the read side condition check, but we also need dest side:

Destination Object Conditions (AWS Release 2.37.0):

If-None-Match: "*" - Copy only if destination does NOT exist Prevents unintended overwrites of destination object
Error Codes: 412 Precondition Failed - When any condition is not met

* @param sourceKey the source key metadata
* @throws OS3Exception with 412 Precondition Failed if conditions are not met
*/
static void evaluateCopySourcePreconditions(HttpHeaders headers,
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.

could you try to reuse the evaluateReadPreconditions?

@YutaLin
Copy link
Copy Markdown
Contributor Author

YutaLin commented May 8, 2026

@YutaLin I think this patch only handle the read side condition check, but we also need dest side:

Destination Object Conditions (AWS Release 2.37.0):
If-None-Match: "*" - Copy only if destination does NOT exist Prevents unintended overwrites of destination object
Error Codes: 412 Precondition Failed - When any condition is not met

Hi @peterxcli, the conditional read side check is
ObjectEndPoint #copyObject -> writeConditions is passed to the #copy-> #openKeyForPut is called with writeConditions -> #openKeyForPut applies If-None-Match, If-Match

Let me know if I miss anything, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants