-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HDDS-2949: mkdir : store directory entries in a separate table #1404
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With new layout version added, the latest PR logic looks more clear and independent.
I just left my minor comments. I am thinking one next part of work is delete dir implementation, right? Only seeing create dir implementation here.
In additional, please have a look of the github build failure, it doesn't show green.
public Timeout timeout = new Timeout(300000); | ||
|
||
private static final Logger LOG = | ||
LoggerFactory.getLogger(TestOzoneFileSystem.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong log instance name, TestOzoneFileSystem -> TestOzoneDirectory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do it. Thanks!
OMException.ResultCodes.CANNOT_CREATE_DIRECTORY_AT_ROOT); | ||
} | ||
// acquire lock | ||
acquiredLock = omMetadataManager.getLock().acquireWriteLock(BUCKET_LOCK, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a comment: will we introduced DIR_LOCK for dir table update in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly. This is long term goal and will kick start once the primary changes are IN.
Will fix TestOzoneConfigurationFields test case. Does this make sense to you. Thanks for the reviews! |
Makes sense to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 from me.
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmDirectoryInfo.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmDirectoryInfo.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmDirectoryInfo.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see we used layOutVersion and tested the change. But this might cause failures to other test like when key and directory with same name, as we have not used new logic in KeyCreate request. (Some of these tests are added in master branch with HDDS-4155.
Let's add individual classes with UT's and once basic classes like Key Creation/and others are done then we can integrate it to OM.
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmDirectoryInfo.java
Outdated
Show resolved
Hide resolved
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/codec/OmDirectoryInfoCodec.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmDirectoryInfo.java
Show resolved
Hide resolved
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneDirectory.java
Show resolved
Hide resolved
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileRequest.java
Outdated
Show resolved
Hide resolved
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileRequest.java
Show resolved
Hide resolved
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileRequest.java
Show resolved
Hide resolved
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileRequest.java
Outdated
Show resolved
Hide resolved
...anager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMDirectoryCreateRequestV1.java
Outdated
Show resolved
Hide resolved
...anager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMDirectoryCreateRequestV1.java
Outdated
Show resolved
Hide resolved
Thank You @rakeshadr for the contribution. |
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileRequest.java
Outdated
Show resolved
Hide resolved
Sure, how about adding this UTs along with File/Key creation patch?. As we know, here its only the dir changes. |
As any way we are testing at UT, we can add the entries to KeyTable and implement/simulate these tests. (Similar to Old Requests) |
Thanks a lot @bharatviswa504 for the useful review comments and your time. I will upstream next commit. |
Sure, will do that way. |
I've updated another patch addressing @bharatviswa504's comments. |
… to run existing UTs happily
d63a000
to
892214b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank You for the update @rakeshadr
I have a few more comments.
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileRequest.java
Outdated
Show resolved
Hide resolved
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileRequest.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmDirectoryInfo.java
Show resolved
Hide resolved
...anager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMDirectoryCreateRequestV1.java
Outdated
Show resolved
Hide resolved
...anager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMDirectoryCreateRequestV1.java
Outdated
Show resolved
Hide resolved
...er/src/test/java/org/apache/hadoop/ozone/om/request/file/TestOMDirectoryCreateRequestV1.java
Show resolved
Hide resolved
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmDirectoryInfo.java
Outdated
Show resolved
Hide resolved
...er/src/test/java/org/apache/hadoop/ozone/om/request/file/TestOMDirectoryCreateRequestV1.java
Outdated
Show resolved
Hide resolved
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileRequest.java
Outdated
Show resolved
Hide resolved
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileRequest.java
Show resolved
Hide resolved
Thanks again @bharatviswa504 for the comments. Uploaded patch addressing the comments. Please let me know the feedback! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank You @rakeshadr for the update.
Overall LGTM. I have a few comments/questions.
I have resolved old comments, as it will help no to miss the comments to address them.
missingParentInfos.add(dirInfo); | ||
|
||
// add entry to directory table | ||
String dirKey = omMetadataManager.getOzonePathKey( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are adding them 2 times once here, and next immediately in addDirectoryTableCacheEntries.
No correctness issue, but can be removed from one place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will remove it in my new class.
FYI, looks like existing code OMDirectoryCreateRequest.java#L276 has this issue. Like you said, there is no harm anyway and am not touching the current code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, looks like we can remove from existing code.
Let's open a new jira to fix this.
...er/src/test/java/org/apache/hadoop/ozone/om/request/file/TestOMDirectoryCreateRequestV1.java
Show resolved
Hide resolved
long baseObjId = objIdRange.getLeft(); | ||
long maxObjId = objIdRange.getRight(); | ||
long maxLevels = maxObjId - baseObjId; | ||
long objectCount = 1; // baseObjID is used by the leaf directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For leaf, we have used baseObjID + objCount. But here it is mentioned we use baseObjID is used for leaf, assuming that it has started for missing directories from baseObjID +1.
pathInfo.setLeafNodeObjectId(baseObjId + objectCount);
If we want to keep them sorted, we can start with ObjCount as 0. (Not sure, in future if this will help in the listing)
With this, there is a chance to exceed maxObjectID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I've used existing logic from code OMDirectoryCreateRequest#254.
I will add two more UTs to verify it. Also, I will remove the wrong comment. Hope this is fine?
- testCreateDirectoryExceedLimitOfMaxLevels255
- testCreateDirectoryUptoLimitOfMaxLevels255
Say, baseObjId = 25600
maxObjId = 25855
maxLevels = 25855 - 25600 = 255
Since the exit condition is "if (nextObjId > maxObjId)", it will exit and throw exception once
the value of nextObjId becomes 25856, which will be used for the leaf node.
+1 LGTM. |
Thank you @bharatviswa504 and @linyiqun for help in reviews and provided really useful comments. |
What changes were proposed in this pull request?
All the directories from the path components should be created on 'DirectoryTable'. Here, it uses new classes and retained existing logic. This is required during rolling upgrade. So, created V1 classes for the implementation. Later, during rolling upgrade will rebase this feature branch accordingly.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-2949
How was this patch tested?
Verified using TestOMDirectoryCreateResponseV1.java and TestOzoneDirectory.java unit test cases.
Note: As this is an incremental change, it is expected to have failures related to file, key ops test cases. Will fix this later through subsequent sub-tasks.