-
Notifications
You must be signed in to change notification settings - Fork 593
HDDS-3982. Disable moveToTrash in o3fs and ofs temporarily #1215
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
Changes from all commits
6f4ead5
a929357
6829a70
7c625df
fc161c8
62dc794
82d5af2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ | |
| import org.apache.hadoop.fs.FileStatus; | ||
| import org.apache.hadoop.fs.FileSystem; | ||
| import org.apache.hadoop.fs.LocatedFileStatus; | ||
| import org.apache.hadoop.fs.Options; | ||
| import org.apache.hadoop.fs.Path; | ||
| import org.apache.hadoop.fs.PathIsNotEmptyDirectoryException; | ||
| import org.apache.hadoop.fs.permission.FsPermission; | ||
|
|
@@ -372,6 +373,34 @@ public boolean rename(Path src, Path dst) throws IOException { | |
| return result; | ||
| } | ||
|
|
||
| /** | ||
| * Intercept rename to trash calls from TrashPolicyDefault, | ||
| * convert them to delete calls instead. | ||
| */ | ||
| @Deprecated | ||
| protected void rename(final Path src, final Path dst, | ||
| final Options.Rename... options) throws IOException { | ||
| boolean hasMoveToTrash = false; | ||
| if (options != null) { | ||
| for (Options.Rename option : options) { | ||
| if (option == Options.Rename.TO_TRASH) { | ||
| hasMoveToTrash = true; | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| if (!hasMoveToTrash) { | ||
| // if doesn't have TO_TRASH option, just pass the call to super | ||
| super.rename(src, dst, options); | ||
| } else { | ||
| // intercept when TO_TRASH is found | ||
| LOG.info("Move to trash is disabled for ofs, deleting instead: {}. " | ||
| + "Files or directories will NOT be retained in trash. " | ||
| + "Ignore the following TrashPolicyDefault message, if any.", src); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One last thing: Currently we are straight a way deleting files. Since users coming from Hadoop shell, there could be assumptions that files may move to trash if no -skipTrash flag. But we will be deleting instead of trashing them. |
||
| delete(src, true); | ||
| } | ||
| } | ||
|
|
||
| private class DeleteIterator extends OzoneListingIterator { | ||
| final private boolean recursive; | ||
| private final OzoneBucket bucket; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.