-
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
Conversation
BasicRootedOzoneFileSystem#rename(src, dst, options)
|
@smengcl Thank you for working on it.
I don't see a way to avoid though. :-( Probably your logs will looks like:
One another thought could be that: ( I am not proposing it to do it now, just for discussion): If user wants different policies based on their FS behaviors, that's not possible. Probably if we have confg like
and by default we can use TrashPolicyDefault.class. if user wants, they can configure per fs specific policy. |
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneFileSystem.java
Show resolved
Hide resolved
|
@umamaheswararao Thanks for the review. One question about the |
|
@smengcl yes, fs.trash.classname configuration is for all HCFS. The impl can be something like below: So, by no change in behavior. If some one wants to override the behaviors for a specific fs, provide your TrashClass name in config. Ex: if you want to provide a trashPolicy for ofs separately, then configure like: |
Change-Id: I594717fd5895efb59ff0f9646fcee328122747c6
Change-Id: Ie5a4a7f622561aaae0baf1e045508041cf616d26
Change-Id: I9e37b8a1d6e18f236cc3e861cdb9ae33ca84ca43
|
Tests added. |
| // 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); |
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.
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.
User may realize after looking at this log message, but by this time already things happened.
There should be a way to shout out this behavior to users. One way is documenting and any other better way?
|
Changes looks good to me. +1 |
|
Merged to master. Thanks @umamaheswararao for reviewing. |
What changes were proposed in this pull request?
A proper server-side trash cleanup solution (HDDS-3915) might not land any time soon.
This jira aims to completely disable "move to trash" when a client is deleting files and {{fs.trash.interval > 0}} by intercepting the deprecated {{fs.rename(src, dst, options)}} call used by {{TrashPolicyDefault#moveToTrash}}.
This should be reverted when trash cleanup is implemented.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-3982
How was this patch tested?
Added new tests.
Also tested manually:
As usual, compile -> launch docker-compose cluster -> exec bash on om
Add
fs.trash.intervalto client config:o3fs
Verification: key is deleted, but trash directory is created:
OFS
Verification: key is deleted, but trash directory is created:
Known Issues
TrashPolicyDefaultalready creates the empty directories in trash before callingfs.rename(src, dst, options).fs.mkdirsas well to solve this but I'm not sure if we should go down this path.TrashPolicyDefaultstill prints "Moved ... to trash" message, as shown above, which may be confusing to users.