-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-4357: Rename : make rename an atomic ops by updating key path entry in dir/file table #1557
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
…try in dir/file table
linyiqun
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 for updating the latest PR, @rakeshadr .
I left my comments below, all of them are for the test.
...p-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystemV1.java
Outdated
Show resolved
Hide resolved
...p-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystemV1.java
Outdated
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyRenameRequestV1.java
Outdated
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyRenameRequestV1.java
Show resolved
Hide resolved
| keyArgs.getModificationTime(), omResponse, ozoneManager); | ||
| result = Result.SUCCESS; | ||
| } else { | ||
| // case-3) destination is a file and should not exist |
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.
Question: What is meant here by should not exist?
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.
For example,
source: /x/y/file1 and destin: /root_dir/file1.renamed, which exits.
Rename checks whether the destin is a file type and if exists then throws KEY_ALREADY_EXISTS exception.
I have checked existing code and followed same behavior.
Does this make sense to you?
|
@linyiqun @bharatviswa504 thanks for the review help. I've updated PR by addressing your comments, please take another look at it. |
|
Seems a very good test coverage now, thanks for adding more testing. |
| return fileName.toString(); | ||
| } | ||
| // failed to converts a path key | ||
| return 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.
Not got when parent is null, why we need to return 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.
This is done to avoid any NPE and I thought below logic will throw exception. Does that make sense to you?
OzoneFileStatus toKeyParentDirStatus = getOMKeyInfoIfExists(metaMgr,
volumeName, bucketName, toKeyParentDir, 0);
// check if the immediate parent exists
if (toKeyParentDirStatus == null || toKeyParentDirStatus.isFile()) {
throw new OMException(String.format(
"Failed to rename %s to %s, %s is a file", fromKeyName, toKeyName,
toKeyParentDir), OMException.ResultCodes.KEY_RENAME_ERROR);
}
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.
You mean to say here because we use Paths.get will cause issue here?
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.
Yes, it won't occur in general, just return keyname it for the safer side.
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileRequest.java
Show resolved
Hide resolved
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileRequest.java
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyRenameRequestV1.java
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyRenameRequestV1.java
Show resolved
Hide resolved
...p-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystemV1.java
Outdated
Show resolved
Hide resolved
|
Thank You @rakeshadr for the update and extensive test coverage. |
Thanks a lot @bharatviswa504 for the comments. Updated patch and also replied to your comments. |
bharatviswa504
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.
+1 LGTM, one question can go ahead with commit.
Thanks a lot @bharatviswa504 for the reviews. I replied to that comment. I don't have strong opinion on that but added for safe side. Will revisit that part later, if you disagree. |
|
Thanks @bharatviswa504 and @linyiqun for the detailed reviews. Regarding the test failure. I looked at the logs and client failed to contact OM server due to |
What changes were proposed in this pull request?
This task is to handle rename key path request and make it an atomic operation by updating the DirTable or FileTable.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-4357
How was this patch tested?
Added TestOzoneFileSystemV1 UT. I will add more unit test cases eventually.