-
Notifications
You must be signed in to change notification settings - Fork 594
HDDS-2949: mkdir : store directory entries in a separate table #1230
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
Conversation
| private long modificationTime; | ||
| private List<OzoneAcl> acls; | ||
|
|
||
| public OmPrefixInfo(String name, List<OzoneAcl> acls, |
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.
This constructor can be removed, not being used anymore.
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.
Agreed, will fix it new commit
| } | ||
|
|
||
| @Override | ||
| public String getOzonePrefixKey(long parentObjectId, String prefixName) { |
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.
Both logic seems to be same. Do we need 2 methods? If needed, one method can call other to avoid duplicate 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.
Agreed, will fix it in new commit
| // 3. Add 'sub-dir' to missing parents list | ||
| String dbNodeName = omMetadataManager.getOzonePrefixKey(lastKnownParentId, | ||
| fileName); | ||
| OmPrefixInfo omPrefixInfo = omMetadataManager.getPrefixTable(). |
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.
This gets value from DB, as the prefix table does not use table cache, it stores entries in prefixTree.
I think here we need to expose an API in prefixManagerImpl to get(String Path) and use that here.
And also a question, do we need hold prefix lock here?
And also got a question here.
- When prefixAcl is removed, we remove paths. That can cause the problem here right, the paths which are created by mkdir now can be removed by removePrefixAcl.
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.
Very good point. Based on the upgrade path discussion, the plan is to introduce new directory table. In that case, all the dir ops will be under BUKCET_LOCK. Will update the patch soon with that changes.
|
/pending review comments are not addressed |
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.
Marking this issue as un-mergeable as requested.
Please use /ready comment when it's resolved.
review comments are not addressed
|
|
||
| /** | ||
| * Given a volume, bucket and a key, return the corresponding DB key. | ||
| * |
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.
The Comment needs to be updated, here we don't pass volume, bucket and key. The same problem in getOzoneLeafNodeKey method.
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 fix it in new commit.
| // cannot create a directory with the given key. | ||
| // Verify the path against prefix table | ||
| OMFileRequest.OMPathInfo omPathInfo = | ||
| OMFileRequest.verifyFilesInPath(omMetadataManager, volumeName, |
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.
As we store the dir in prefix table now, we need to acquire PREFIX_LOCK instead of BUCKET_LOCK.
acquiredLock = omMetadataManager.getLock().acquireWriteLock(BUCKET_LOCK, volumeName, bucketName);
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.
Very good point. Will improve this logic.
| Table.KeyValue<String, OmKeyInfo>> keyTableItr = | ||
| omMgr.getKeyTable().iterator(); | ||
| while (keyTableItr.hasNext()) { | ||
| fail("Shouldn't add any entries in KeyTable!"); |
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.
Can you add an additionally test cases for creating one file and verified current entries in KeyTable? Now the new file key would be like objId/fileName rather than /volume/bucket/keyName.
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.
#verifyPrefixKey() function is doing the same by fetching entries using "omMgr.getPrefixTable().get(dbKey);" call.
Are you suggesting something different from this verification check?
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.
@rakeshadr , actually I mean we need to add logic to verify new entry on key table as well in ut. Current unit test only check the dir entry in prefix table.
My suggestion is to write a new key file here.
Then we can check the new format entry in key table.
Key table format before:
KeyName:
/vol1/buck1/a/b/c/d/file1
Now will be like this:
1028/file1
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.
Thanks for the details. I have created new PR #1404 and incorporated your comments. Please review it.
rakeshadr
left a comment
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.
Thanks a lot @bharatviswa504, @linyiqun for the reviews
|
|
||
| /** | ||
| * Given a volume, bucket and a key, return the corresponding DB key. | ||
| * |
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 fix it in new commit.
| } | ||
|
|
||
| @Override | ||
| public String getOzonePrefixKey(long parentObjectId, String prefixName) { |
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.
Agreed, will fix it in new commit
| Table.KeyValue<String, OmKeyInfo>> keyTableItr = | ||
| omMgr.getKeyTable().iterator(); | ||
| while (keyTableItr.hasNext()) { | ||
| fail("Shouldn't add any entries in KeyTable!"); |
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.
#verifyPrefixKey() function is doing the same by fetching entries using "omMgr.getPrefixTable().get(dbKey);" call.
Are you suggesting something different from this verification check?
| private long modificationTime; | ||
| private List<OzoneAcl> acls; | ||
|
|
||
| public OmPrefixInfo(String name, List<OzoneAcl> acls, |
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.
Agreed, will fix it new commit
| // cannot create a directory with the given key. | ||
| // Verify the path against prefix table | ||
| OMFileRequest.OMPathInfo omPathInfo = | ||
| OMFileRequest.verifyFilesInPath(omMetadataManager, volumeName, |
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.
Very good point. Will improve this logic.
| // 3. Add 'sub-dir' to missing parents list | ||
| String dbNodeName = omMetadataManager.getOzonePrefixKey(lastKnownParentId, | ||
| fileName); | ||
| OmPrefixInfo omPrefixInfo = omMetadataManager.getPrefixTable(). |
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.
Very good point. Based on the upgrade path discussion, the plan is to introduce new directory table. In that case, all the dir ops will be under BUKCET_LOCK. Will update the patch soon with that changes.
|
Thanks @bharatviswa504 @linyiqun for the reviews. I am sorry for multiple PRs. I have created new PR #1404 now. Basically, the idea is to create new set of classes V1 for easy migration of this feature branch with rolling upgrade. Also, I have created new table Directory_Table instead of Prefix Table. This is to simplifies the caching logic later. Please review this PR and thanks for your patience! |
|
@rakeshadr Can we close this PR ? as there is a new one available ? |
What changes were proposed in this pull request?
All the directories from the path prefix should be created on 'prefixTable'
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-2949
How was this patch tested?
Verified using TestOMDirectoryCreateResponse.java and TestOzonePrefixTable.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.