supratimdeka 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_r376713688
########## File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMDirectoryCreateRequest.java ########## @@ -159,8 +172,24 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager, FILE_ALREADY_EXISTS); } else if (omDirectoryResult == DIRECTORY_EXISTS_IN_GIVENPATH || omDirectoryResult == NONE) { - dirKeyInfo = createDirectoryKeyInfo(ozoneManager, omBucketInfo, - volumeName, bucketName, keyName, keyArgs, transactionLogIndex); + dirKeyInfo = createDirectoryKeyInfo(ozoneManager, keyName, keyArgs, + baseObjId, transactionLogIndex); + + for (String missingKey : missingParents) { + LOG.debug("missing parent {}", missingKey); + // what about keyArgs for parent directories? TODO + OmKeyInfo parentKeyInfo = createDirectoryKeyInfoNoACL(ozoneManager, + missingKey, keyArgs, baseObjId + objectCount, + transactionLogIndex); Review comment: the base object ID for every create is the transaction log index left shifted by 8 bits (tx log index << 8). OMFileRequest.getObjIdFromTxId() implements this logic. I have replaced all 3 places in the code where a object id is generated, with this call. intermediate directories are created iteratively by doing a +1 starting from the base object ID. that will guarantee each object id is unique - given that the base object id starts with the unique transaction log index. I will put in asserts to ensure there is no overflow. ---------------------------------------------------------------- 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