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

Eric Yang commented on HDFS-2470:
---------------------------------

[~swagle] Thank you for the patch.

1. File API is ridden with misbehavior for serious filesystem work.  For 
creating directory and setting file permission recursively for the newly 
created directories, use 
[Files|https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html] api 
instead.

  {code}
  import static java.nio.file.attribute.PosixFilePermission.OWNER_READ;
  import static java.nio.file.attribute.PosixFilePermission.OWNER_WRITE;
  
  ...
  
  Set<PosixFilePermission> permissions = EnumSet.of(OWNER_READ, OWNER_WRITE);
  Files.createDirectory(Paths.get(curDir), 
PosixFilePermissions.asFileAttribute(permissions));
  {code}

  I am not sure about setting root permission of the working directory.  It 
could be that /tmp/namenode, and accidentally make /tmp read/write only by hdfs 
user and fail.

2. javax.annotation.Nullable is a problematic annotation.  Findbugs uses this 
annotation but it will prevent code from working in JDK 9 to work with signed 
content.  See HADOOP-16463 for detail.  It would be nice to use 
findbugsExcludeFile.xml to define the variable is nullable.

> NN should automatically set permissions on dfs.namenode.*.dir
> -------------------------------------------------------------
>
>                 Key: HDFS-2470
>                 URL: https://issues.apache.org/jira/browse/HDFS-2470
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode
>    Affects Versions: 2.0.0-alpha
>            Reporter: Aaron T. Myers
>            Assignee: Siddharth Wagle
>            Priority: Major
>         Attachments: HDFS-2470.01.patch, HDFS-2470.02.patch, 
> HDFS-2470.03.patch, HDFS-2470.04.patch, HDFS-2470.05.patch
>
>
> Much as the DN currently sets the correct permissions for the 
> dfs.datanode.data.dir, the NN should do the same for the 
> dfs.namenode.(name|edit).dir.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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

Reply via email to