[ https://issues.apache.org/jira/browse/HIVE-2936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13253027#comment-13253027 ]
Rohini Palaniswamy commented on HIVE-2936: ------------------------------------------ * The else call is not required. If the path already existed and was a directory, mkdirs returns true else it throws FileAlreadyExistsException. That is why need to check before if it exists. If the directory already existed, we should not be setting the parent's permission on it. * The fs.exists(f.getParent()) needs to be done before the fs.mkdirs() else it will always be true. One thing that can be done is remove fs.exists(f.getParent()) check and always do a setPermission. If the parent directory was created during the mkdirs(), then the setPermission call will be redundant and just set the same permission again but if the parent existed, then instead of two calls there will be only one call. {code} if (this.inheritPerms && fs.exists(f)) { return fs.getFileStatus(f).isDir(); } boolean success = fs.mkdirs(f); if (this.inheritPerms && success) { // Set the permission of parent directory. fs.setPermission(f, fs.getFileStatus(f.getParent()).getPermission()); } return success; {code} With this, without inheritPerms * 1 call to create the directory. fs.mkdirs() will throw an exception if the path already existed and was a file. with inheritPerms * There will be 2 calls if the path already existed. * There will be 3 calls, to check and create the path and set the permission. Does that sound ok? > Warehouse table subdirectories should inherit the group permissions of the > warehouse parent directory > ----------------------------------------------------------------------------------------------------- > > Key: HIVE-2936 > URL: https://issues.apache.org/jira/browse/HIVE-2936 > Project: Hive > Issue Type: New Feature > Components: Metastore > Reporter: Rohini Palaniswamy > Assignee: Rohini Palaniswamy > Fix For: 0.9.0 > > Attachments: HIVE-2504-1.patch, HIVE-2504.patch, HIVE-2504.patch > > > When the Hive Metastore creates a subdirectory in the Hive warehouse for > a new table it does so with the default HDFS permissions derived from > dfs.umask or dfs.umaskmode. There should be a option to inherit the > permissions of the parent directory (default warehouse or custom database > directory) so that the table directories have the same permissions as the > database directories. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira