[ 
https://issues.apache.org/jira/browse/HDFS-8983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15396378#comment-15396378
 ] 

Arpit Agarwal edited comment on HDFS-8983 at 7/27/16 9:09 PM:
--------------------------------------------------------------

Just tested it. {{delete("/", true)}} will throw AccessControlException if
- "/" is included in {{fs.protected.directories}}; and
- it is non-empty.

Else it returns false as before. The list of protected directories is empty by 
default.

{code}
In contrast, HDFS never permits the deletion of the root of a filesystem; the
filesystem can be taken offline and reformatted if an empty
filesystem is desired.

    if isDir(FS, p) and isRoot(p) and recursive :
        FS' = FS
        result = False
{code}

I see what you mean about the contract. We could fix HDFS so it always returns 
false regardless of the protected dirs settings. It will take some refactoring 
and I'd also want to understand why the root directory check wasn't done 
earlier.


was (Author: arpitagarwal):
Just tested it. {{delete("/", true)}} will throw AccessControlException if
- "/" is included in {{fs.protected.directories}}; and
- it is non-empty.

Else it returns false as before. The list of protected directories is empty by 
default.

{code}
In contrast, HDFS never permits the deletion of the root of a filesystem; the
filesystem can be taken offline and reformatted if an empty
filesystem is desired.

    if isDir(FS, p) and isRoot(p) and recursive :
        FS' = FS
        result = False
{code}

I see what you mean about the contract. We could fix it so it always returns 
true regardless of the protected dirs settings. It will take some refactoring 
and I'd also want to understand why the root directory check wasn't done 
earlier.

> NameNode support for protected directories
> ------------------------------------------
>
>                 Key: HDFS-8983
>                 URL: https://issues.apache.org/jira/browse/HDFS-8983
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: namenode
>    Affects Versions: 2.7.1
>            Reporter: Arpit Agarwal
>            Assignee: Arpit Agarwal
>             Fix For: 2.8.0
>
>         Attachments: HDFS-8393.01.patch, HDFS-8393.02.patch, 
> HDFS-8983.03.patch, HDFS-8983.04.patch
>
>
> To protect important system directories from inadvertent deletion (e.g. 
> /Users) the NameNode can allow marking directories as _protected_. Such 
> directories cannot be deleted unless they are empty. 



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to