hanishakoneru commented on a change in pull request #498: HDDS-2940. mkdir : 
create key table entries for intermediate directories in the path
URL: https://github.com/apache/hadoop-ozone/pull/498#discussion_r379599394
 
 

 ##########
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileRequest.java
 ##########
 @@ -64,24 +72,79 @@ public static OMDirectoryResult verifyFilesInPath(
         // Found a file in the given path.
         // Check if this is actual file or a file in the given path
         if (dbKeyName.equals(fileNameFromDetails)) {
-          return OMDirectoryResult.FILE_EXISTS;
+          result = OMDirectoryResult.FILE_EXISTS;
         } else {
-          return OMDirectoryResult.FILE_EXISTS_IN_GIVENPATH;
+          result = OMDirectoryResult.FILE_EXISTS_IN_GIVENPATH;
         }
       } else if (omMetadataManager.getKeyTable().isExist(dbDirKeyName)) {
         // Found a directory in the given path.
         // Check if this is actual directory or a directory in the given path
         if (dbDirKeyName.equals(dirNameFromDetails)) {
-          return OMDirectoryResult.DIRECTORY_EXISTS;
+          result = OMDirectoryResult.DIRECTORY_EXISTS;
         } else {
-          return OMDirectoryResult.DIRECTORY_EXISTS_IN_GIVENPATH;
+          result = OMDirectoryResult.DIRECTORY_EXISTS_IN_GIVENPATH;
+        }
+      } else {
+        if (!dbDirKeyName.equals(dirNameFromDetails)) {
+          missing.add(keyPath.toString());
         }
       }
+
+      if (result != OMDirectoryResult.NONE) {
+        return new OMPathInfo(missing, result);
+      }
       keyPath = keyPath.getParent();
     }
 
     // Found no files/ directories in the given path.
-    return OMDirectoryResult.NONE;
+    return new OMPathInfo(missing, OMDirectoryResult.NONE);
+  }
+
+  /**
+   * Get the valid base object id given the transaction id.
+   * @param id of the transaction
+   * @return base object id allocated against the transaction
+   */
+  public static long getObjIDFromTxId(long id) {
+    return getObjIdRangeFromTxId(id).getLeft();
+  }
 
 Review comment:
   We use this function multiple times (more than getObjIdRangeFromTxId()). 
Wouldn't it be better to directly execute shift operation here instead of 
calling getObjIdRangeFromTxId()?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org

Reply via email to