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_r374867081
########## 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: I think we can combine the two functions to avoid doing DB reads twice. We could probably change OMDirectoryResult structure to include the result + missing dirs. ---------------------------------------------------------------- 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