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-4266: CreateFile : store parent dir entries into DirTable and file entry into separate FileTable #1473

Merged
merged 12 commits into from
Oct 13, 2020

Conversation

rakeshadr
Copy link
Contributor

What changes were proposed in this pull request?

https://issues.apache.org/jira/browse/HDDS-4266

What is the link to the Apache JIRA

This task is to handle the createFileRequest. OM will store all the missing parent dirs to DirTable and leaf file node into a separate FileTable. This new FileTable and OpenFileTable is basically to segregate keys and files.

How was this patch tested?

Added UTs - TestOMFileCreateRequestV1, TestOMKeyCommitRequestV1, TestOzoneFileOps.

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.

@rakeshadr , thanks for working on this. Initial review comments for this.
Haven't finished the review, will look deep on this.

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.

Below are the review comments for the unit tests.

@rakeshadr
Copy link
Contributor Author

Thanks a lot @linyiqun for the review comments and I have updated PR addressing the same. Please take another look at it when you get a chance.

.setOpenVersion(openVersion).build())
.setCmdType(Type.CreateFile);
omClientResponse = new OMFileCreateResponseV1(omResponse.build(),
omFileInfo, missingParentInfos, clientID, omVolumeArgs, omBucketInfo);
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like in new version we don't need to store full keyName in OmKeyInfo, but we still store it, as OMKeyInfoCodec has still set Keyname and convert to proto.


 public KeyInfo getProtobuf(boolean ignorePipeline) {
    long latestVersion = keyLocationVersions.size() == 0 ? -1 :
        keyLocationVersions.get(keyLocationVersions.size() - 1).getVersion();

    List<KeyLocationList> keyLocations = new ArrayList<>();
    for (OmKeyLocationInfoGroup locationInfoGroup : keyLocationVersions) {
      keyLocations.add(locationInfoGroup.getProtobuf(ignorePipeline));
    }

    KeyInfo.Builder kb = KeyInfo.newBuilder()
        .setVolumeName(volumeName)
        .setBucketName(bucketName)
        .setKeyName(keyName)

Copy link
Contributor

Choose a reason for hiding this comment

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

Why can't we use keyName as leaf node name for new requests, so that we don't need to store full pathName for OmKeyInfo for new request processing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OMKeyInfo is exposed to Ozone client, so I have kept 'keyName' as it is. Anyway fileName can be extracted from the keyName so that I thought of reducing the load on DB.

Hope this make sense to you.

Copy link
Contributor

Choose a reason for hiding this comment

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

But now OmKeyInfo has entire keyPath which is not really needed to be persisted to DB in this new V1 Request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I completely agree with you that, V1 need only the fileName in DB.

On a second thought, do we need to maintain two different OMKeyInfo#keyName semantics in DB. For 100% S3 , 'keyName' stores full path. For 100% FS, 'keyName' stores only the fileName in the value part.

message keyInfo {
       ....
       required string keyName = 3;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done the changes in new commit

Copy link
Contributor

Choose a reason for hiding this comment

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

Added to the cache correctly(With KeyName as leaf node name), but in response class, we passed omKeyInfo this should be also the same thing which we have added to the cache right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Inside OMFileCreateResponseV1#addToDBBatch() method has the actual call to the DB, it is doing the changes in utility OMFileRequest function. I have done this way to ensure that, only when updating the TableCache and persisting to the Table it makes the DB representation as keyName=leafNodeName. All the other places(any functional checks inside OM, logging inside OM, client response etc..) will have the keyName=fullPath and fileName=leafNodeName.

OMFileRequest.addToOpenFileTable(omMetadataMgr, batchOp, getOmKeyInfo(),
         getOpenKeySessionID());

Also, for better code maintenance, I will be adding these conversion in OMFileRequest utility functions. Hope this is fine for you?

Copy link
Contributor

@bharatviswa504 bharatviswa504 Oct 12, 2020

Choose a reason for hiding this comment

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

With the current approach in PR looks like we do unnecessarily one more time copy object. What we add to the cache, if we pass the same instance to Response class then same can be persisted (Even for this, we can follow current model, same instance is in cache and Response classes, and get always return copy object). With this way cache and Response classes uses the same instance, and anyway in logging in createRequest we use Keyname, I see no issue over there.

Copy link
Contributor Author

@rakeshadr rakeshadr Oct 13, 2020

Choose a reason for hiding this comment

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

Sure, updated patch by addressing this point. Thanks!

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.

Thanks for addressing the comments, @rakeshadr . Few other comments from me.
Also please have a fix on the checkstyle warning.

@rakeshadr
Copy link
Contributor Author

Thanks a lot @bharatviswa504 and @linyiqun for the review efforts and useful comments. I've made another commit by addressing your comments.

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.

@rakeshadr , thanks for addressing all the comments!

@rakeshadr
Copy link
Contributor Author

@linyiqun I've resolved the comments which are fixed. Please feel free to re-open, if anything extra to be handled.

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.

Please see my latest comment, @rakeshadr .
Other places seem good to me now.

@rakeshadr
Copy link
Contributor Author

Thank you @linyiqun and @bharatviswa504 for the continuous help in reviews. Please let me know if any more comments.

@rakeshadr
Copy link
Contributor Author

Thank you @linyiqun and @bharatviswa504 for the continuous help in reviews. Please let me know if any more comments.

@linyiqun, @bharatviswa504 Can you please approve the PR if there are no more comments. Thanks again!

@rakeshadr
Copy link
Contributor Author

Thank You for the updated patch.
I have one comment, (resolved fixed comments), rest LGTM.

Thanks @bharatviswa504 for the detailed reviews. I've updated the patch addressing the comment.

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.

+1 LGTM
Thank You @rakeshadr for the contribution and for continuously updating the patch patiently and @linyiqun for the review.

@bharatviswa504 bharatviswa504 merged this pull request into apache:HDDS-2939 Oct 13, 2020
rakeshadr added a commit that referenced this pull request Oct 14, 2020
rakeshadr added a commit that referenced this pull request Nov 3, 2020
rakeshadr added a commit that referenced this pull request Nov 20, 2020
rakeshadr added a commit that referenced this pull request Dec 7, 2020
rakeshadr added a commit that referenced this pull request Jan 6, 2021
rakeshadr added a commit that referenced this pull request Jan 11, 2021
rakeshadr added a commit that referenced this pull request Jan 13, 2021
rakeshadr added a commit that referenced this pull request Jan 25, 2021
rakeshadr added a commit that referenced this pull request Jan 28, 2021
rakeshadr added a commit that referenced this pull request Feb 1, 2021
rakeshadr added a commit that referenced this pull request Feb 1, 2021
rakeshadr added a commit that referenced this pull request Feb 3, 2021
rakeshadr added a commit that referenced this pull request Feb 5, 2021
rakeshadr added a commit that referenced this pull request Feb 15, 2021
rakeshadr added a commit that referenced this pull request Feb 18, 2021
rakeshadr added a commit that referenced this pull request Feb 25, 2021
rakeshadr added a commit that referenced this pull request Mar 3, 2021
rakeshadr added a commit that referenced this pull request Mar 9, 2021
rakeshadr added a commit that referenced this pull request Mar 27, 2021
rakeshadr added a commit that referenced this pull request Apr 7, 2021
rakeshadr added a commit that referenced this pull request Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants