ChenSammi commented on code in PR #9255:
URL: https://github.com/apache/ozone/pull/9255#discussion_r2525845226


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/lifecycle/OMLifecycleConfigurationSetRequest.java:
##########
@@ -127,29 +128,31 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager, Execut
     AuditLogger auditLogger = ozoneManager.getAuditLogger();
     UserInfo userInfo = getOmRequest().getUserInfo();
 
-    String bucketKey = metadataManager.getBucketKey(volumeName, bucketName);
     IOException exception = null;
     boolean acquiredBucketLock = false;
     OMClientResponse omClientResponse = null;
     Map<String, String> auditMap = new HashMap<>();
-
     try {
-      OmLifecycleConfiguration omLifecycleConfiguration =
-          OmLifecycleConfiguration.getFromProtobuf(lifecycleConfiguration);
-      auditMap = omLifecycleConfiguration.toAuditMap();
-
       mergeOmLockDetails(metadataManager.getLock()
           .acquireWriteLock(BUCKET_LOCK, volumeName, bucketName));
       acquiredBucketLock = getOmLockDetails().isLockAcquired();
-      omLifecycleConfiguration.valid();
 
-      if (!metadataManager.getBucketTable().isExist(bucketKey)) {
+      String bucketKey = metadataManager.getBucketKey(volumeName, bucketName);
+      OmBucketInfo bucketInfo = 
metadataManager.getBucketTable().get(bucketKey);
+      if (bucketInfo == null) {
         LOG.debug("bucket: {} in volume: {} doesn't exist", bucketName,
             volumeName);
         throw new OMException("Bucket doesn't exist", BUCKET_NOT_FOUND);
       }
-      omLifecycleConfiguration.setUpdateID(transactionLogIndex);
 
+      OmLifecycleConfiguration.Builder lcBuilder =
+          
OmLifecycleConfiguration.getBuilderFromProtobuf(lifecycleConfiguration);
+      OmLifecycleConfiguration omLifecycleConfiguration =
+          lcBuilder.setBucketObjectID(bucketInfo.getObjectID()).build();
+      omLifecycleConfiguration.valid();
+      auditMap = omLifecycleConfiguration.toAuditMap();
+
+      omLifecycleConfiguration.setUpdateID(transactionLogIndex);

Review Comment:
   We can remove the @immutable in next path, where I plan to add an option to 
enable/disable move to trash support. 



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