Lantao Jin created HDFS-11102:
---------------------------------

             Summary: Delete .Trash using command without -shipTrash should be 
confirmed by re-typing like Y/N
                 Key: HDFS-11102
                 URL: https://issues.apache.org/jira/browse/HDFS-11102
             Project: Hadoop HDFS
          Issue Type: Improvement
          Components: hdfs
            Reporter: Lantao Jin


As a Hadoop DEVOPS, I saw lots of cases that user delete their data by mistake. 
 Most of them can be recovered from trash but the rest ones were not luck.

A system can’t guess user's purpose,but a good system should help user to avoid 
their mistakes.
There is a very common case like:
If a user want to delete some dir from HDFS, they may use:
{code}
hadoop -fs -rm -r /user/someone/pathToBeDelete
{code}
The directory /user/someone/pathToBeDelete will move into 
{code}
/user/someone/.Trash/current/user/someone/pathToBeDelete
{code}
If user want delete it permanently, option "-skipTrash" can be attached. That's 
the design and Hadoop knows the user's purpose well.
Usually, user didn't use "skipTrash" for safety consideration. That's good till 
now.

But the purpose is to delete some data for saving more space. Then the user 
begin to delete it from Trash with the below command:
{code}
hadoop -fs -rm -r /user/someone/ .Trash
{code}
Why not just delete "/user/someone/.Trash/current/user/someone/pathToBeDelete" 
is that because the user knows only pathToBeDelete in trash directory now.
The trash include pathToBeDelete will be deleted permanently.

*But Wait! Do you see the blank space before the dot?*
If you also type this command by "copy-paste" include some space or invisible 
char, the whole /user/someone directory and the whole /user/someone/.Trash will 
be deleted unfortunately. *Jesus, that's means the directory /user/someone is 
deleted permanently and unexpectedly!*

So I think *any ".Trash" word appears in the "rm" command without "skip" should 
be launched a double checking by system to help people to avoid their mistake.*

If you also agree this design, I will offer a patch.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-h...@hadoop.apache.org

Reply via email to