-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HDFS-15607. Addendum: Create trash dir when allowing snapshottable dir #2448
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
Change-Id: I29e105fa99fd3729496002f2d0c11de37db45193
|
💔 -1 overall
This message was automatically generated. |
jojochuang
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.
LGTM. We change the exception thrown by disallowSnapshot. But this is a privileged operation so very unlikely to impact client applications.
Yes indeed. Also this is a rare and have mild consequences. I wouldn't expect admins to encounter this daily. :) Thanks for the +1. Will commit shortly. |
apache#2448) (cherry picked from commit fbd2220) Conflicts: hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java Change-Id: I642de9b9a102b3955558c2d330809bc5e053690d
This is an addendum to HDFS-15607's #2352.
Problem
Pre HDFS-15607, when admin disallows snapshot on a file, it throws
PathIsNotDirectoryException:After HDFS-15607 (current), the thrown exception changed into
AccessControlException. BecauseDFS#checkTrashRootAndRemoveIfEmptyis callingDFS#listStatuson a file (/ssdir1/file1/.Trash) inside a file (/ssdir1/file1):Though this is a rare use case, we'd better fix this just in case some snippets/scripts are expecting
PathIsNotDirectoryException.Solution
We should ignore
AccessControlExceptionthrown inDFS#checkTrashRootAndRemoveIfEmptyand let the originaldfs.disallowSnapshotlogic handle it.Testing
After this change, disallowing snapshot on a file throws
PathIsNotDirectoryExceptionas expected: