henry3260 commented on code in PR #11157:
URL: https://github.com/apache/ozone/pull/11157#discussion_r3886031314
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -514,6 +517,64 @@ static void addLastModifiedDate(
RFC1123Util.FORMAT.format(lastModificationTime));
}
+ /**
+ * Adds the {@code x-amz-expiration} header when an enabled lifecycle
+ * expiration rule covers the key, as S3 does: the value names the date the
+ * object is scheduled for deletion and the rule that schedules it. When more
+ * than one rule covers the key, the earliest expiry is reported.
+ * <p>
+ * The header is advisory, so a bucket without a lifecycle configuration, a
+ * caller who may not read it, or any other lookup failure only leaves the
+ * header out; the HEAD itself still succeeds.
+ */
+ private void addExpirationHeader(ResponseBuilder responseBuilder,
+ String bucketName, String keyPath, OzoneKey key) {
+ try {
+ OzoneLifecycleConfiguration lifecycleConfiguration = getClientProtocol()
Review Comment:
> `getLifecycleConfiguration` makes a synchronous OM RPC on every `HEAD`
request, including for buckets that have no lifecycle configuration at all. In
that case the call throws an `IOException` on every request, which the catch
block swallows silently. Under any sustained HEAD load on unconfigured buckets
this doubles the OM RPCs and adds latency to every response.
>
> Consider checking whether the bucket carries lifecycle metadata before
fetching the full configuration (the `OzoneBucket` object is already available
when ownership verification is requested, and bucket-level metadata could carry
a flag), or at minimum cache a short-lived negative result per bucket so that
repeated HEAD requests for unconfigured buckets do not each trigger a failed
RPC.
Agreed, this is a real cost. I flagged it in the PR description as something
worth an opinion. I'd prefer to handle it in a follow-up PR and keep this one
focused on correctness, if that's acceptable to you.
--
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]