henry3260 commented on code in PR #11157:
URL: https://github.com/apache/ozone/pull/11157#discussion_r3886043784
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -685,6 +746,7 @@ public Response head(
addLastModifiedDate(response, key);
addTagCountIfAny(response, key);
addCustomMetadataHeaders(response, key);
+ addExpirationHeader(response, bucketName, keyPath, key);
Review Comment:
> `addExpirationHeader` is called unconditionally even when `partNumber !=
0`. When a part-number is specified, `key` holds the part's metadata and
`key.getModificationTime()` is the part upload time, not the completed object's
last-modified time. The Days-based expiry calculation in `expiryDateOf` would
therefore use the wrong timestamp and report an incorrect expiry date.
>
> Either skip the expiration header when `partNumber != 0` (S3 does not
document part-level expiration semantics), or fetch the object-level key
separately to obtain the correct modification time before calling
`addExpirationHeader`.
Thanks for looking at this. I checked and I don't think the modification
time is affected. When a part number is requested, `KeyManagerImpl` starts from
the whole object's `OmKeyInfo` and only overrides `dataSize` and the block
location list; `modificationTime` is left as the object's:
https://github.com/apache/ozone/blob/a17ad8798a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java#L657-L687
The pre-`S3_PART_AWARE_GET` client fallback does the same:
https://github.com/apache/ozone/blob/a17ad8798a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java#L1941-L1959
As a cross-check, the existing `addLastModifiedDate()` call uses the same
`OzoneKey`, so if the timestamp were the part's, `Last-Modified` would already
be wrong for part-number requests today.
--
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]