rakeshadr commented on a change in pull request #2533:
URL: https://github.com/apache/ozone/pull/2533#discussion_r714688483



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/acl/OMKeyAclRequest.java
##########
@@ -146,6 +153,36 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager,
    */
   abstract String getPath();
 
+  public BucketLayout getBucketLayout(OzoneManager ozoneManager) {
+    BucketLayout bucketLayout = BucketLayout.LEGACY;
+    OmBucketInfo buckInfo = null;
+    try {
+      ObjectParser objectParser = new ObjectParser(getPath(),
+          OzoneManagerProtocolProtos.OzoneObj.ObjectType.KEY);
+
+      String volume = objectParser.getVolume();
+      String bucket = objectParser.getBucket();
+
+      String buckKey =
+          ozoneManager.getMetadataManager().getBucketKey(volume, bucket);
+
+      try {
+        buckInfo =
+            ozoneManager.getMetadataManager().getBucketTable().get(buckKey);
+        if (buckInfo == null) {
+          LOG.error("Bucket not found: {}/{} ", volume, bucket);
+          return BucketLayout.LEGACY;
+        }
+        bucketLayout = buckInfo.getBucketLayout();
+      } catch (IOException e) {
+        LOG.debug("Failed to get the value for the key: " + buckKey);
+      }
+    } catch (OMException ome) {
+      // Handle exception

Review comment:
       Please add error log message here. Its not required to throw exception 
explicitly and the current handling of returning default `BucketLayout.LEGACY` 
type is OK.




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