Skip to content

HDDS-13919. S3 Conditional Writes (PutObject)#9815

Draft
peterxcli wants to merge 7 commits intoapache:masterfrom
peterxcli:HDDS-13919-conditional-writes
Draft

HDDS-13919. S3 Conditional Writes (PutObject)#9815
peterxcli wants to merge 7 commits intoapache:masterfrom
peterxcli:HDDS-13919-conditional-writes

Conversation

@peterxcli
Copy link
Member

@peterxcli peterxcli commented Feb 24, 2026

What changes were proposed in this pull request?

## Specification
### AWS S3 Conditional Write Specification
#### If-None-Match Header
```
If-None-Match: "*"
```
- Succeeds only if object does NOT exist
- Returns `412 Precondition Failed` if object exists
- Primary use case: Create-only semantics
#### If-Match Header
```
If-Match: "<etag>"
```
- Succeeds only if object EXISTS and ETag matches
- Returns `412 Precondition Failed` if object doesn't exist or ETag mismatches
- Primary use case: Atomic updates (compare-and-swap)

Should be merged after #9332

What is the link to the Apache JIRA

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

How was this patch tested?

…ion handling

- Implemented tests for `createKey` and `rewriteKey` methods to validate behavior when using the `EXPECTED_GEN_CREATE_IF_NOT_EXISTS` constant.
- Added scenarios for key creation when the key is absent and when it already exists.
- Enhanced the `rewriteFailsWhenKeyExists` test to cover cases for both committed and uncommitted keys.
- Updated error handling to ensure correct responses for key existence checks.
@peterxcli peterxcli changed the title Hdds 13919 conditional writes HDDS-13919. S3 Conditional Writes (PutObject) Feb 24, 2026
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.

1 participant