You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/02/05 05:09:45 UTC

[GitHub] [hadoop-ozone] avijayanhwx commented on a change in pull request #498: HDDS-2940. mkdir : create key table entries for intermediate directories in the path

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

 ##########
 File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMDirectoryCreateRequest.java
 ##########
 @@ -126,31 +129,41 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
     boolean acquiredLock = false;
     IOException exception = null;
     OMClientResponse omClientResponse = null;
+    List<OmKeyInfo> missingParentInfos = new ArrayList<>();
+
     try {
       // check Acl
       checkKeyAcls(ozoneManager, volumeName, bucketName, keyName,
           IAccessAuthorizer.ACLType.CREATE, OzoneObj.ResourceType.KEY);
 
       // Check if this is the root of the filesystem.
       if (keyName.length() == 0) {
-        return new OMDirectoryCreateResponse(null,
+        return new OMDirectoryCreateResponse(null, null,
             omResponse.setCreateDirectoryResponse(
-                CreateDirectoryResponse.newBuilder()).build());
+                CreateDirectoryResponse.newBuilder()).build(), false);
       }
       // acquire lock
       acquiredLock = omMetadataManager.getLock().acquireWriteLock(BUCKET_LOCK,
           volumeName, bucketName);
 
       validateBucketAndVolume(omMetadataManager, volumeName, bucketName);
 
+      Path keyPath = Paths.get(keyName);
+
       // Need to check if any files exist in the given path, if they exist we
       // cannot create a directory with the given key.
       OMFileRequest.OMDirectoryResult omDirectoryResult =
           OMFileRequest.verifyFilesInPath(omMetadataManager,
-          volumeName, bucketName, keyName, Paths.get(keyName));
+          volumeName, bucketName, keyName, keyPath);
+
+      List<String> missingParents = OMFileRequest.getMissingParents(
+          omMetadataManager, volumeName, bucketName, keyPath.getParent());
 
       OmBucketInfo omBucketInfo = omMetadataManager.getBucketTable().get(
           omMetadataManager.getBucketKey(volumeName, bucketName));
+      long baseObjId = OMFileRequest.getObjIdFromTxId(transactionLogIndex);
+      long objectCount = 1;
+
       OmKeyInfo dirKeyInfo = null;
       if (omDirectoryResult == FILE_EXISTS ||
 
 Review comment:
   Yes, @hanishakoneru's suggestion makes sense if we want to avoid doing the same reads twice. 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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