mitsa-ng opened a new pull request, #12143:
URL: https://github.com/apache/ozone/pull/12143

   JIRA: https://issues.apache.org/jira/browse/HDDS-17902
   
   ## What / Why
   
   AWS S3 directory buckets support the `x-amz-if-match-last-modified-time` 
header on DeleteObject: the object is deleted only if its last modified time 
matches the given value, otherwise the request fails with 412 Precondition 
Failed. The S3 Gateway ignored the condition and deleted the object even when 
the time did not match, so a client using it to avoid deleting an object 
someone else had changed could lose data.
   
   ## What this does
   
   Mirrors the existing If-Match ETag conditional delete path end to end:
   
   - `S3ConditionalRequest` parses the header as an ISO 8601 instant (empty or 
malformed values are rejected with 400 Invalid Request)
   - `ClientProtocol` gains a `deleteKey` overload carrying the expected epoch 
milliseconds, implemented in `RpcClient` and `S3ClientProtocol`
   - `KeyArgs` (new `expectedLastModifiedTime = 27` field), `OmKeyArgs` and the 
PB translator carry the value to OM
   - `OMKeyDeleteRequest` and `OMKeyDeleteRequestWithFSO` validate it against 
the stored key's modification time and fail with the new 
`LAST_MODIFIED_TIME_MISMATCH` result code, mapped to 412 in the gateway
   - a new `OzoneManagerVersion` gate (`S3_IF_MATCH_LAST_MODIFIED_TIME`) makes 
the client fail fast against an OM that would otherwise silently ignore the new 
proto field
   - on KEY_NOT_FOUND with the condition present the gateway returns 412, 
consistent with the If-Match behavior
   
   Notes:
   - DeleteObjects (batch) per-object `LastModifiedTime` is left as a follow up
   - `proto.lock` is not updated: the checked-in lock already lags trunk (it 
predates `excludedETag`, `partIv` and Status 102-105) and nothing in-repo 
regenerates it
   
   ## Verification
   
   - New OM unit tests in `TestOMKeyDeleteRequest` (run for both DEFAULT and 
FSO layouts via `TestOMKeyDeleteRequestWithFSO`): matching time deletes the 
key, mismatching time keeps it and returns `LAST_MODIFIED_TIME_MISMATCH`
   - New gateway tests in `TestObjectDelete`: match deletes (204), mismatch 
returns 412 and keeps the key, missing key returns 412, malformed header 
returns 400
   - Red/green check: with the OM validation disabled the mismatch test fails 
(`expected: LAST_MODIFIED_TIME_MISMATCH but was: OK`); with the change it passes
   - `mvn -pl 
interface-client,hdds-common,ozone-common,ozone-client,ozone-manager,s3gateway 
-am checkstyle:check test -Dtest='TestOMKeyDeleteRequest*,TestObjectDelete'`: 
all green, checkstyle 0 errors


-- 
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