echonesis opened a new pull request, #12158:
URL: https://github.com/apache/ozone/pull/12158

   ## What changes were proposed in this pull request?
   S3 Gateway ignored the `x-amz-if-match-size` header on DeleteObject and the 
per-object `<Size>` in DeleteObjects,
   and deleted the object even when its size did not match. A client relying on 
the condition could lose data written
   by someone else.
   
   This PR adds support for the size condition in [AWS conditional 
deletes](https://docs.aws.amazon.com/AmazonS3/latest/userguide/conditional-deletes.html).
   
   ### DeleteObject
   - S3 Gateway passes the expected size to OM in the new 
`KeyArgs.expectedDataSize` field. `OMKeyDeleteRequest` (and
   the FSO variant) checks it atomically together with the existing If-Match 
ETag check.
   - A size mismatch returns the new `DATA_SIZE_MISMATCH` result, which S3 
Gateway maps to `412 PreconditionFailed`.
   - As in AWS, a missing key with only the size condition returns `204`. With 
`If-Match`, the existing `412` behavior
   is kept.
   - An invalid or negative size returns `400 InvalidArgument`.
   - The unsupported `x-amz-if-match-last-modified-time` header returns `501 
NotImplemented` instead of being silently
   ignored.
   
   ### DeleteObjects
   - `<Object>` now accepts `<ETag>` and `<Size>`. Previously JAXB silently 
dropped them, so conditional objects were
   deleted unconditionally.
   - The batch `DeleteKeys` request cannot carry conditions. Each object with a 
condition is deleted through the single
   key delete, and both conditions are checked together. Objects are deleted in 
request order: the unconditional
   objects between two conditional ones are deleted in one batch, and each 
object keeps its own result even when a key
   is listed more than once.
   - A condition mismatch keeps the object and reports `PreconditionFailed` for 
that object only.
   - Every object is validated before any key is deleted. Any of the following 
rejects the whole request:
     - a missing or empty `<Key>`
     - an invalid `<Size>`
     - an empty `<ETag>`
     - a condition element repeated in one `<Object>`
     - the unsupported `<LastModifiedTime>`
   - If an OM request fails after earlier objects are done, their results are 
kept. The remaining objects are reported
   with the same S3 error as when the whole request fails, and the failure is 
counted in the `deleteKeyFailure` metric.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17901
   
   ## How was this patch tested?
   
   Local Tests
   ```
   mvn -pl :ozone-s3gateway test \
     -DskipShade -DskipRecon
   
   mvn -pl :ozone-manager test \
     -DskipShade -DskipRecon
   
   mvn -pl :ozone-client test \
     -Dtest=TestRpcClient,TestS3ClientProtocol \
     -DskipShade -DskipRecon
   
   mvn -pl :ozone-integration-test-s3 test \
     -Dtest=TestS3SDK \
     -DskipShade -DskipRecon
   ```
   
   GitHub Actions CI: 
https://github.com/echonesis/ozone/actions/runs/45381743007
   
   Generated-by: Claude Code (Claude Opus 5.5)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to