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

Stephen O'Donnell commented on HDFS-15886:
------------------------------------------

I checked the PR, and I think we could get away with removing the new config 
flag DFS_PROTECTED_DIRECTORIES_CONFIG_FILE_ENABLE_KEY and instead, change the 
definition of the existing setting fs.protected.directories. Right now, it is a 
comma separated list of directories.

We could make it understand that file:///path_to_local_file is a file of 
definitions while paths not starting with file:// are considered HDFS paths to 
be protected (current behaviour). That way we could have:

<property>
  <name>fs.protected.directories</name>
  
<value>/hdfs/path,file:///local/file/of/paths,/other/hdfs/path,file:///other/local/file</value>
<property>

Ie a mixture of paths and files and no other config flags to worry about.

What do you think?

fs.protected.directories is already reconfigurable 
Namenode.reconfProtectedDirectories(...) which calls 
FSDirectory.setProtectedDirectories(...). However I believe the reconfiguration 
framework will only refresh a property which has changed.

So if you just have fs.protected.directories=file:///somefile, and you change 
the contents of the file and refresh, it will not actually trigger a refresh of 
the file contents as the config key has not changed. See 
ReconfigurableBase.run(...) for how the reconfiguration framework currently 
works.

If we go ahead with allowing a file of protected directories, I think we will 
need to solve how to refresh its contents so it is reconfigurable too.

> Add a way to get protected dirs from a special configuration file
> -----------------------------------------------------------------
>
>                 Key: HDFS-15886
>                 URL: https://issues.apache.org/jira/browse/HDFS-15886
>             Project: Hadoop HDFS
>          Issue Type: New Feature
>          Components: namenode
>    Affects Versions: 3.4.0
>            Reporter: Max  Xie
>            Assignee: Max  Xie
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> We used protected dirs to ensure that important data directories cannot be 
> deleted by mistake. But protected dirs can only be configured in 
> hdfs-site.xml.
> For ease of management,  we add a way to get the list of protected dirs from 
> a special configuration file.
> How to use.
> 1. set the config in hdfs-site.xml
> ```
> <property>
>  <name>dfs.protected.directories.config.file.enable</name>
>  <value>true</value>
>  </property>
> <property>
>  <name>fs.protected.directories</name>
>  <value>[file:///path/to/protected.dirs.config]</value>
>  </property>
> ```
> 2.  add some protected dirs to the config file 
> ([file:///path/to/protected.dirs.config])
> ```
> /1
> /2/3
> ```
> 3. done



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to