xinglin opened a new pull request, #4869:
URL: https://github.com/apache/hadoop/pull/4869
<!--
Thanks for sending a pull request!
1. If this is your first time, please read our contributor guidelines:
https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute
2. Make sure your PR title starts with JIRA issue id, e.g.,
'HADOOP-17799. Your PR title ...'.
-->
### Description of PR
Trash.moveToAppropriateTrash is used by hadoop cli -rm and hive, to move
files to trash. However, its current implementation does not support localized
trash policy we added to ViewFileSystem in
[HADOOP-18144](https://issues.apache.org/jira/browse/HADOOP-18144).
The reason is in moveToAppropriateTrash, it first resolves a path and then
uses the resolvedFs, to initialize the trash. As a result, it uses
getTrashRoot() implementation from targetFs, not ViewFileSystem. The new
localized trash policy we implemented in ViewFileSystem is not used.
With this patch, we check whether the FileSystem object is a ViewFileSystem
object and whether the localized trash policy flag is set. If both conditions
are true, we initialize the Trash object with the ViewFileSystem FS object and
call moveToTrash() with the logical path directly.
### How was this patch tested?
Passed a new test added to TestViewFsTrash
`mvn test -Dtest="TestViewFsTrash"`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]