-
Notifications
You must be signed in to change notification settings - Fork 483
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
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.
@rakeshadr , thanks for working on this. Initial review comments for this.
Haven't finished the review, will look deep on this.
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyInfo.java
Show resolved
Hide resolved
hadoop-ozone/interface-storage/src/main/java/org/apache/hadoop/ozone/om/OMMetadataManager.java
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java
Show resolved
Hide resolved
...e-manager/src/main/java/org/apache/hadoop/ozone/om/response/file/OMFileCreateResponseV1.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java
Outdated
Show resolved
Hide resolved
...one-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileCreateRequestV1.java
Outdated
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequestV1.java
Outdated
Show resolved
Hide resolved
...one-manager/src/main/java/org/apache/hadoop/ozone/om/response/key/OMKeyCommitResponseV1.java
Show resolved
Hide resolved
...e-manager/src/main/java/org/apache/hadoop/ozone/om/response/file/OMFileCreateResponseV1.java
Outdated
Show resolved
Hide resolved
...e-manager/src/main/java/org/apache/hadoop/ozone/om/response/file/OMFileCreateResponseV1.java
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.
Below are the review comments for the unit tests.
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileOps.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileOps.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileOps.java
Outdated
Show resolved
Hide resolved
...manager/src/test/java/org/apache/hadoop/ozone/om/request/file/TestOMFileCreateRequestV1.java
Outdated
Show resolved
Hide resolved
...e-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMKeyCommitRequestV1.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyInfo.java
Show resolved
Hide resolved
...one-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileCreateRequestV1.java
Show resolved
Hide resolved
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. |
...one-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileCreateRequestV1.java
Outdated
Show resolved
Hide resolved
...one-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileCreateRequestV1.java
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java
Outdated
Show resolved
Hide resolved
.setOpenVersion(openVersion).build()) | ||
.setCmdType(Type.CreateFile); | ||
omClientResponse = new OMFileCreateResponseV1(omResponse.build(), | ||
omFileInfo, missingParentInfos, clientID, omVolumeArgs, omBucketInfo); |
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.
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)
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.
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.
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.
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.
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.
But now OmKeyInfo has entire keyPath which is not really needed to be persisted to DB in this new V1 Request.
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 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;
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.
Done the changes in new commit
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.
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?
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.
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?
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 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.
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, updated patch by addressing this point. Thanks!
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequestV1.java
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequestV1.java
Outdated
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequestV1.java
Outdated
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequestV1.java
Outdated
Show resolved
Hide resolved
...one-manager/src/main/java/org/apache/hadoop/ozone/om/response/key/OMKeyCommitResponseV1.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.
Thanks for addressing the comments, @rakeshadr . Few other comments from me.
Also please have a fix on the checkstyle warning.
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java
Outdated
Show resolved
Hide resolved
...e-manager/src/test/java/org/apache/hadoop/ozone/om/request/file/TestOMFileCreateRequest.java
Outdated
Show resolved
Hide resolved
Thanks a lot @bharatviswa504 and @linyiqun for the review efforts and useful comments. I've made another commit by addressing your comments. |
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 , thanks for addressing all the comments!
...e/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequest.java
Show resolved
Hide resolved
@linyiqun I've resolved the comments which are fixed. Please feel free to re-open, if anything extra to be handled. |
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.
Please see my latest comment, @rakeshadr .
Other places seem good to me now.
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequestV1.java
Show resolved
Hide resolved
…ir,File Create & Commit ops
…1' default value to false
Thank you @linyiqun and @bharatviswa504 for the continuous help in reviews. Please let me know if any more comments. |
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileRequest.java
Outdated
Show resolved
Hide resolved
@linyiqun, @bharatviswa504 Can you please approve the PR if there are no more comments. Thanks again! |
Thanks @bharatviswa504 for the detailed reviews. I've updated the patch addressing the comment. |
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileRequest.java
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.
+1 LGTM
Thank You @rakeshadr for the contribution and for continuously updating the patch patiently and @linyiqun for the review.
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
…le entry into separate FileTable (#1473)
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.