[ 
https://issues.apache.org/jira/browse/HADOOP-6869?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12891356#action_12891356
 ] 

Konstantin Boudnik commented on HADOOP-6869:
--------------------------------------------

- Looks good with one nit. I'd suggest to have methods with fewer arguments 
simply call ones with more args. E.g. in this case 
{noformat}
public void createFile(String path, String fileName, boolean local) throws 
IOException {
  createFile(path, fileName, null, local);
}
{noformat}
instead of duplicating their exact implementation. You have done similar in 
{{DaemonProtocolAspect}} already.

- Also, in {{DaemonProtocolAspect}} you already have a ref to the filesystem so 
you can just call its {{createFile}} methods instead of implementing your own 
logic 
{noformat}
+  public void DaemonProtocol.createFile(String path, String fileName, 
+     FsPermission permission, boolean local) throws IOException {
+    Path p = new Path(path); 
+    FileSystem fs = getFS(p, local);
{noformat}
just call {{fs.createNewFile()}} to have new file created for you. 

- also you are writing some content into this file which seems to be an 
inadvertent side-effect. Doesn't look like a good idea.

> [Herriot] Implement a functionality for creating either file or folder in 
> task attempt  folder while job is running.
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-6869
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6869
>             Project: Hadoop Common
>          Issue Type: Task
>          Components: test
>            Reporter: Vinay Kumar Thota
>            Assignee: Vinay Kumar Thota
>         Attachments: 6869-ydist-security.patch, HADOOP-6869.patch
>
>
> Functionality for creating either files or folders in task attempt folder 
> while job is running. The functionality covers the following methods.
> 1. public void DaemonProtocol.createFile(String path, String fileName, 
> boolean local) throws IOException; 
> It uses to create a file with full permissions.
> 2.   public void DaemonProtocol.createFile(String path, String fileName, 
> FsPermission permission, boolean local) throws IOException; 
> It uses to create a file with given permissions.
> 3.   public void DaemonProtocol.createFolder(String path, String folderName, 
> boolean local) throws IOException;
> It uses to create a file with full permissions.
> 4.   public void DaemonProtocol.createFolder(String path, String folderName, 
> FsPermission permission, boolean local) throws IOException;
> It uses to create a folder with given permissions.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to