fapifta commented on code in PR #6990:
URL: https://github.com/apache/ozone/pull/6990#discussion_r1693005085


##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java:
##########
@@ -496,24 +496,30 @@ public boolean createDirectory(String pathStr) throws 
IOException {
     LOG.trace("creating dir for path: {}", pathStr);
     incrementCounter(Statistic.OBJECTS_CREATED, 1);
     OFSPath ofsPath = new OFSPath(pathStr, config);
-    if (ofsPath.getVolumeName().isEmpty()) {
+
+    String volumeName = ofsPath.getVolumeName();
+    if (volumeName.isEmpty()) {
       // Volume name unspecified, invalid param, return failure
       return false;
     }
-    if (ofsPath.getBucketName().isEmpty()) {
+
+    String bucketName = ofsPath.getBucketName();
+    if (bucketName.isEmpty()) {
       // Create volume only
-      objectStore.createVolume(ofsPath.getVolumeName());
+      objectStore.createVolume(volumeName);
       return true;
     }
+
     String keyStr = ofsPath.getKeyName();
     try {
-      OzoneBucket bucket = getBucket(ofsPath, true);
-      // Empty keyStr here indicates only volume and bucket is
-      // given in pathStr, so getBucket above should handle the creation
-      // of volume and bucket. We won't feed empty keyStr to
-      // bucket.createDirectory as that would be a NPE.
-      if (keyStr != null && keyStr.length() > 0) {
-        bucket.createDirectory(keyStr);
+      if (keyStr == null || keyStr.isEmpty()) {
+        // Empty keyStr here indicates only volume and bucket is
+        // given in pathStr, so getBucket above should handle the creation
+        // of volume and bucket. We won't feed empty keyStr to
+        // bucket.createDirectory as that would be a NPE.
+        getBucket(volumeName, bucketName, true);
+      } else {
+        proxy.createDirectory(volumeName, bucketName, keyStr);

Review Comment:
   Yes, you are right, I missed that property of the getBucket call, I have 
changed the patch, to see if this was the only cause for the test failures. I 
will update the PR description once things settle about the new changes.



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