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

   ## What changes were proposed in this pull request?
   
   When a bucket lifecycle rule with an `AbortIncompleteMultipartUpload` action 
applies to a multipart upload, AWS S3 returns `x-amz-abort-date` and 
`x-amz-abort-rule-id` in the CreateMultipartUpload and ListParts responses. 
Ozone supports the action (HDDS-13474), but S3 Gateway returns neither header, 
so a client cannot tell when an in-progress upload will be aborted, or by which 
rule.
   
   This PR returns both headers. OM computes the value inside the RPC the 
operation already makes, and S3 Gateway only formats the headers.
   
   - `OmLifecycleConfiguration#getAbortInfo` picks, among the enabled rules 
with the action that match the upload (prefix, and tags when the rule has a tag 
filter), the one with the earliest abort time. Of rules with the same time it 
picks the one listed first.
   - CreateMultipartUpload: `S3InitiateMultipartUploadRequest` and its FSO 
subclass look up the lifecycle configuration of the bucket in 
`validateAndUpdateCache` and return the result in a new optional field of 
`MultipartInfoInitiateResponse`.
   - ListParts: `KeyManagerImpl#listParts` does the same under the bucket read 
lock and returns the result in a new optional field of 
`MultipartUploadListPartsResponse`. The tags of the upload are read from its 
open key only when a rule with a tag filter has to be checked.
   - A failed lookup only leaves the headers out. The request still succeeds.
   
   Behavior to note:
   
   - The abort date is the time the lifecycle service of Ozone uses: creation 
time plus `DaysAfterInitiation` × 24 hours. AWS rounds it up to the next 
midnight UTC. The service does not, and the header follows the service.
   - ListParts uses the lifecycle configuration that is current when it is 
called, as AWS does.
   - The headers depend only on the lifecycle configuration of the bucket, so 
they are also returned when the lifecycle service is not enabled.
   - The rule ID is written to the header as it is. AWS percent-encodes some 
characters, for example non-ASCII ones. That is not done here.
   - Both proto fields are optional. An old OM does not send them and an old 
client ignores them, and in both cases the headers are absent.
   
   For CreateMultipartUpload the value is computed when the transaction is 
applied, so the reply is determined by the Ratis log and a retry gets the same 
reply. `OMClientRequest#postExecute` (HDDS-16823) was considered, but it reads 
the state at reply time and computes the value again on each retry.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17921
   
   ## How was this patch tested?
   
   - `TestOmLifeCycleConfiguration`: which rule `getAbortInfo` picks (disabled 
rule, rule without the action, prefix, earliest time, same time, tag filter, 
upload without an open key).
   - `TestS3InitiateMultipartUploadRequest` and 
`TestS3InitiateMultipartUploadRequestWithFSO`: the response has the abort info 
when a rule applies, and does not have it when no rule applies or the lookup 
fails.
   - `TestKeyManagerUnit`: ListParts returns the abort info for both multipart 
schema versions, and still succeeds without it when the stored configuration 
cannot be used.
   - `TestInitiateMultipartUpload` and `TestListParts`: the two headers in the 
S3 Gateway responses.
   - `AbstractS3SDKV2Tests#testAbortIncompleteMultipartUploadE2E`: 
`abortDate()` and `abortRuleId()` of both APIs through the AWS SDK, without and 
with a lifecycle configuration.
   - CI: https://github.com/chungen0126/ozone/actions/runs/46849298121
   
   Generated-by: Claude Code (Claude Fable 5.2)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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