Skip to content

HDDS-13919. S3 Conditional Writes (PutObject) [2/2] - Reuse Atomic Rewrite at Commit Path#10023

Open
peterxcli wants to merge 2 commits intoapache:masterfrom
peterxcli:HDDS-13919-conditional-writes
Open

HDDS-13919. S3 Conditional Writes (PutObject) [2/2] - Reuse Atomic Rewrite at Commit Path#10023
peterxcli wants to merge 2 commits intoapache:masterfrom
peterxcli:HDDS-13919-conditional-writes

Conversation

@peterxcli
Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

OM Create Phase
Validation is performed within the validateAndUpdateCache method to ensure atomicity within the Ratis state machine application.

  1. Locking: The OM acquires the write lock for the bucket/key.
  2. Key Lookup: Retrieve the existing key from KeyTable.
  3. Validation:
    • Key Not Found: If the key does not exist, throw KEY_NOT_FOUND (maps to S3 412).
    • No ETag Metadata: If the existing key (e.g., uploaded via OFS) does not have an ETag property, throw ETAG_NOT_AVAILABLE (maps to S3 412). The precondition cannot be evaluated, so we must fail rather than silently proceed.
    • ETag Mismatch: Compare existingKey.ETag with expectedETag. If they do not match, throw ETAG_MISMATCH (maps to S3 412).
  4. Extract Generation: If ETag matches, extract existingKey.updateID.
  5. Create Open Key: Create open key entry with expectedDataGeneration = existingKey.updateID.

Sorry I forgot to follow the step 4 and 5 in my previous PR #9815 ...

What is the link to the Apache JIRA

issues.apache.org/jira/browse/HDDS-13919

How was this patch tested?

existing tests

@peterxcli peterxcli changed the title HDDS-13919. S3 Conditional Writes (PutObject) [1/2] - Reuse Atomic Rewrite at Commit Path HDDS-13919. S3 Conditional Writes (PutObject) [2/2] - Reuse Atomic Rewrite at Commit Path Apr 1, 2026
@peterxcli peterxcli marked this pull request as ready for review April 1, 2026 18:15
throw new OMException("ETag mismatch",
OMException.ResultCodes.ETAG_MISMATCH);
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

it seems like the same logic ad in CommitRequest

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