[ 
https://issues.apache.org/jira/browse/TEZ-4413?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

lujie updated TEZ-4413:
-----------------------
    Description: 
the code  in createDirIfNotExists:

 

 
{code:java}
  private void createDirIfNotExists(Path path) throws IOException {
    FileSystem fileSystem = path.getFileSystem(conf);
    try {
      if (!fileSystem.exists(path)) {
        fileSystem.mkdirs(path);
        fileSystem.setPermission(path, DIR_PERMISSION);
      }
    } catch (IOException e) {
      // Ignore this exception, if there is a problem it'll fail when trying to 
read or write.
      LOG.warn("Error while trying to set permission: ", e);
    }
  }{code}
 

but if the node crash between mkdirs and setPermission, the permisson will not 
be set forever even reboot.

 

So how about change the code like 

 

 
{code:java}
  private void createDirIfNotExists(Path path) throws IOException {
    FileSystem fileSystem = path.getFileSystem(conf);
    try {
      if (!fileSystem.exists(path)) {
        fileSystem.mkdirs(path);
       
      }
         fileSystem.setPermission(path, DIR_PERMISSION);
     } catch (IOException e) {
      // Ignore this exception, if there is a problem it'll fail when trying to 
read or write.
      LOG.warn("Error while trying to set permission: ", e);
    }
  } {code}
 

 

 

  was:
the code  in createDirIfNotExists:

 

 
{code:java}
  private void createDirIfNotExists(Path path) throws IOException {
    FileSystem fileSystem = path.getFileSystem(conf);
    try {
      if (!fileSystem.exists(path)) {
        fileSystem.mkdirs(path);
        fileSystem.setPermission(path, DIR_PERMISSION);
      }
    } catch (IOException e) {
      // Ignore this exception, if there is a problem it'll fail when trying to 
read or write.
      LOG.warn("Error while trying to set permission: ", e);
    }
  }{code}
 

but if the node crash between mkdirs and setPermission, the permisson will not 
be set forever.

 

So how about change the code like 

 

 
{code:java}
  private void createDirIfNotExists(Path path) throws IOException {
    FileSystem fileSystem = path.getFileSystem(conf);
    try {
      if (!fileSystem.exists(path)) {
        fileSystem.mkdirs(path);
       
      }
         fileSystem.setPermission(path, DIR_PERMISSION);
     } catch (IOException e) {
      // Ignore this exception, if there is a problem it'll fail when trying to 
read or write.
      LOG.warn("Error while trying to set permission: ", e);
    }
  } {code}
 

 

 


> permission may not be set after crash
> -------------------------------------
>
>                 Key: TEZ-4413
>                 URL: https://issues.apache.org/jira/browse/TEZ-4413
>             Project: Apache Tez
>          Issue Type: Bug
>            Reporter: lujie
>            Priority: Major
>
> the code  in createDirIfNotExists:
>  
>  
> {code:java}
>   private void createDirIfNotExists(Path path) throws IOException {
>     FileSystem fileSystem = path.getFileSystem(conf);
>     try {
>       if (!fileSystem.exists(path)) {
>         fileSystem.mkdirs(path);
>         fileSystem.setPermission(path, DIR_PERMISSION);
>       }
>     } catch (IOException e) {
>       // Ignore this exception, if there is a problem it'll fail when trying 
> to read or write.
>       LOG.warn("Error while trying to set permission: ", e);
>     }
>   }{code}
>  
> but if the node crash between mkdirs and setPermission, the permisson will 
> not be set forever even reboot.
>  
> So how about change the code like 
>  
>  
> {code:java}
>   private void createDirIfNotExists(Path path) throws IOException {
>     FileSystem fileSystem = path.getFileSystem(conf);
>     try {
>       if (!fileSystem.exists(path)) {
>         fileSystem.mkdirs(path);
>        
>       }
>          fileSystem.setPermission(path, DIR_PERMISSION);
>      } catch (IOException e) {
>       // Ignore this exception, if there is a problem it'll fail when trying 
> to read or write.
>       LOG.warn("Error while trying to set permission: ", e);
>     }
>   } {code}
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to