rakeshadr commented on code in PR #3233:
URL: https://github.com/apache/ozone/pull/3233#discussion_r844773517


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMOpenKeysDeleteRequest.java:
##########
@@ -155,33 +157,57 @@ private OmBucketInfo 
updateTableCachePerBucket(OzoneManager ozoneManager,
     OmBucketInfo omBucketInfo;
 
     try {
-      acquiredLock = omMetadataManager.getLock().acquireWriteLock(BUCKET_LOCK,
-              volumeName, bucketName);
+      acquiredLock = omMetadataManager.getLock()
+          .acquireWriteLock(BUCKET_LOCK, volumeName, bucketName);
       omBucketInfo = getBucketInfo(omMetadataManager, volumeName, bucketName);
+      final BucketLayout bucketLayout;
+      if (omBucketInfo != null) {
+        bucketLayout = omBucketInfo.getBucketLayout();
+      } else {
+        LOG.warn("Bucket {}/{} is not found", volumeName, bucketName);

Review Comment:
   >But we still have to update quota if the bucket exists and is the original 
one.
   
   Good point. Following are the diff cases:
   
   *Bucket Deleted:* Then determine the FSO key using its ` parentID > 0` 
condition.
   
   *Bucket re-created with same name:* 
   +case-1)+ Re-created bucket with same layout - Here the key's parentID will 
not be matching with the newly created bucket. 
   +case-2)+ Re-created bucket with diff layout - Assume I had an old FSO 
bucket "buck-1" and its key is "buck-1/file-1", which will be represented with 
the dbkey "512/file-1". Now the bucket has been re-created in OBS, its bucket 
ID will be 2000. 
   
   How about will have a common logic to handle the above cases.
   step-1) Determine bucketLayout always using whether the parentID > 0, 
irrespective of bucket exists or not. 
   ```
           if (keysPerBucket.getKeysCount() > 0 &&
               keysPerBucket.getKeys(0).hasParentID()) {
             bucketLayout = BucketLayout.FILE_SYSTEM_OPTIMIZED;
           } else {
             bucketLayout = BucketLayout.DEFAULT;
           }
   ```



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