Skip to content
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

Merged
merged 11 commits into from
Oct 1, 2020

Conversation

rakeshadr
Copy link
Contributor

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.

Copy link
Contributor

@linyiqun linyiqun left a 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);
Copy link
Contributor

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

Copy link
Contributor Author

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,
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@rakeshadr
Copy link
Contributor Author

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.

Will fix TestOzoneConfigurationFields test case.
Next task am planning to do CreateFile and then get/listStatus. IMHO, both file/dir delete can be done together in one patch which involves changes in KeyDeletingService.

Does this make sense to you.

Thanks for the reviews!

@linyiqun
Copy link
Contributor

linyiqun commented Sep 9, 2020

Next task am planning to do CreateFile and then get/listStatus. IMHO, both file/dir delete can be done together in one patch which involves changes in KeyDeletingService.

Does this make sense to you.

Makes sense to me.

Copy link
Contributor

@linyiqun linyiqun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 from me.

Copy link
Contributor

@bharatviswa504 bharatviswa504 left a 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.

@bharatviswa504
Copy link
Contributor

Thank You @rakeshadr for the contribution.
I have few comments

@rakeshadr
Copy link
Contributor Author

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.

Sure, how about adding this UTs along with File/Key creation patch?. As we know, here its only the dir changes.

@bharatviswa504
Copy link
Contributor

bharatviswa504 commented Sep 21, 2020

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.

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)

@rakeshadr
Copy link
Contributor Author

Thanks a lot @bharatviswa504 for the useful review comments and your time. I will upstream next commit.

@rakeshadr
Copy link
Contributor Author

As any way we are testing at UT, we can add the entries to KeyTable and implement/simulate these tests. (Similar to Old Requests)

Sure, will do that way.

@rakeshadr
Copy link
Contributor Author

I've updated another patch addressing @bharatviswa504's comments.

Copy link
Contributor

@bharatviswa504 bharatviswa504 left a 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.

@rakeshadr
Copy link
Contributor Author

Thanks again @bharatviswa504 for the comments. Uploaded patch addressing the comments. Please let me know the feedback!

Copy link
Contributor

@bharatviswa504 bharatviswa504 left a 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(
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

long baseObjId = objIdRange.getLeft();
long maxObjId = objIdRange.getRight();
long maxLevels = maxObjId - baseObjId;
long objectCount = 1; // baseObjID is used by the leaf directory
Copy link
Contributor

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

Copy link
Contributor Author

@rakeshadr rakeshadr Oct 1, 2020

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?

  1. testCreateDirectoryExceedLimitOfMaxLevels255
  2. 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.

@bharatviswa504
Copy link
Contributor

bharatviswa504 commented Oct 1, 2020

+1 LGTM.
Thank You @rakeshadr for multiple updates and @linyiqun for the review.

@bharatviswa504 bharatviswa504 merged this pull request into apache:HDDS-2939 Oct 1, 2020
@rakeshadr
Copy link
Contributor Author

Thank you @bharatviswa504 and @linyiqun for help in reviews and provided really useful comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants