-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-19217. Introduce getTrashPolicy to FileSystem API #8063
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
base: trunk
Are you sure you want to change the base?
Conversation
ee71aac to
4183ac9
Compare
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
@ayushtkn @KeeProMise Could you please review this PR? Thank you very much! |
|
@steveloughran Please help to take a look when you are available. Thanks in advance. |
|
curious where we will use it, adding this as a FileSystem API looks overkill to me, if it required for some particular use case, maybe part of getServerDefaults()? |
|
@ayushtkn Thanks for taking a look.
The problem that we encountered is that we have a client that can access both hdfs:// and ofs:// but TrashPolicyDefault and OzoneTrashPolicy is not compatible (TrashPolicyDefault was changed that cause issues when applied to Ozone). Despite setting "fs.trash.classname" in both HDFS and Ozone, only one will be picked (usually TrashPolicyDefault) which causes user not being able to move files to trash in Ozone. Other related works like HADOOP-18013 and HADOOP-18893 approached it by using per-scheme configuration (e.g. fs.s3a.trash.classname)
I am not aware with |
Description of PR
JIRA: https://issues.apache.org/jira/browse/HADOOP-19217
Hadoop FileSystem supports multiple FileSystem implementations awareness (e.g. client is aware of both hdfs:// and ofs:// protocols).
However, it seems that currently Hadoop TrashPolicy remains the same regardless of the URI scheme. The TrashPolicy is governed by "fs.trash.classname" configuration and stays the same regardless of the FileSystem implementation. For example, HDFS defaults to TrashPolicyDefault and Ozone defaults to TrashPolicyOzone, but only one will be picked since the the configuration will be overwritten by the other.
Therefore, I propose to tie the TrashPolicy implementation to each FileSystem implementation by introducing a new FileSystem#getTrashPolicy interface. TrashPolicy#getInstance can call FileSystem#getTrashPolicy to get the appropriate TrashPolicy.
How was this patch tested?
Unit and contract tests (HDFS and LocalFS).
Disclosure: FileSystem.md part was initially generated by AI, but majority of it was updated. The other implementations are hand-coded.