Skip to content

Conversation

@rakeshadr
Copy link
Contributor

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.

@xiaoyuyao xiaoyuyao self-requested a review July 24, 2020 03:52
private long modificationTime;
private List<OzoneAcl> acls;

public OmPrefixInfo(String name, List<OzoneAcl> acls,
Copy link
Contributor

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.

Copy link
Contributor Author

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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().
Copy link
Contributor

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.

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

Copy link
Contributor Author

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.

@elek
Copy link
Member

elek commented Aug 24, 2020

/pending review comments are not addressed

Copy link

@github-actions github-actions bot left a 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.
*
Copy link
Contributor

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.

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

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);

Copy link
Contributor Author

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!");
Copy link
Contributor

@linyiqun linyiqun Aug 31, 2020

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.

Copy link
Contributor Author

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?

Copy link
Contributor

@linyiqun linyiqun Sep 2, 2020

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

@rakeshadr rakeshadr left a 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.
*
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 fix it in new commit.

}

@Override
public String getOzonePrefixKey(long parentObjectId, String prefixName) {
Copy link
Contributor Author

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!");
Copy link
Contributor Author

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

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

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().
Copy link
Contributor Author

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.

@rakeshadr
Copy link
Contributor Author

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!

@mukul1987
Copy link
Contributor

@rakeshadr Can we close this PR ? as there is a new one available ?

@mukul1987 mukul1987 closed this Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants