priyeshkaratha commented on code in PR #12170:
URL: https://github.com/apache/ozone/pull/12170#discussion_r4796393513


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataReader.java:
##########
@@ -236,6 +240,29 @@ public KeyInfoWithVolumeContext getKeyInfo(final OmKeyArgs 
args,
     }
   }
 
+  /**
+   * Returns when the key expires under the bucket lifecycle configuration, 
for the S3 x-amz-expiration header.
+   * Nothing is returned while the lifecycle service is disabled, since no key 
would be expired, nor for a key read
+   * from a snapshot. A failed lookup only omits the expiration.
+   */
+  @Nullable
+  private LifecycleExpirationInfo getLifecycleExpiration(ResolvedBucket 
bucket, String keyPath, OmKeyInfo keyInfo) {
+    OMMetadataManager metadataManager = keyManager.getMetadataManager();
+    if (!ozoneManager.getKeyLifecycleServiceConfig().isEnabled()
+        || metadataManager != ozoneManager.getMetadataManager()) {
+      return null;
+    }
+    try {
+      OmLifecycleConfiguration lifecycleConfiguration = 
metadataManager.getLifecycleConfigurationTable()
+          .get(metadataManager.getBucketKey(bucket.realVolume(), 
bucket.realBucket()));
+      return lifecycleConfiguration == null ? null : 
lifecycleConfiguration.getExpiration(keyInfo, keyPath);

Review Comment:
   I haven't benchmarked it yet. I agree a full-cache table is the right fix. I 
will do it via followup Jira HDDS-18023



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