smengcl commented on a change in pull request #2412:
URL: https://github.com/apache/ozone/pull/2412#discussion_r672513719



##########
File path: 
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java
##########
@@ -223,31 +223,23 @@ private OzoneBucket getBucket(String volumeStr, String 
bucketStr,
     try {
       bucket = proxy.getBucketDetails(volumeStr, bucketStr);
     } catch (OMException ex) {
-      // Note: always create bucket if volumeStr matches "tmp" so -put works
       if (createIfNotExist) {
-        // Note: getBucketDetails always throws BUCKET_NOT_FOUND, even if
-        // the volume doesn't exist.
-        if (ex.getResult().equals(BUCKET_NOT_FOUND)) {
-          OzoneVolume volume;
+        // getBucketDetails can throw VOLUME_NOT_FOUND when the parent volume
+        // doesn't exist and ACL is enabled; it can only throw BUCKET_NOT_FOUND
+        // when ACL is disabled. Both exceptions need to be handled.
+        switch (ex.getResult()) {
+        case VOLUME_NOT_FOUND:
+        case BUCKET_NOT_FOUND:

Review comment:
       Thanks for the comment @kerneltime .
   
   `VOLUME_NOT_FOUND` is actually frequently encountered during our testing 
where we create volume+bucket+directories on one shot with `-p` when ACL is 
enabled.
   
   If you think about it, in both cases the action(s) we need to take is the 
same. i.e. volume needs to be created.
   It's just that the exception thrown from the call `proxy.getBucketDetails` 
is different -- which is bizzare, and we maybe want to fix `getBucketDetails`'s 
behavior at some point (for example, to always throw `VOLUME_NOT_FOUND` 
regardless of whether ACL is enabled or not).




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