Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # dev >> Re: Review Request 12050: HIVE-3756 (LOAD DATA does not honor permission inheritance)


Copy link to this message
-
Re: Review Request 12050: HIVE-3756 (LOAD DATA does not honor permission inheritance)

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/12050/#review22698
-----------------------------------------------------------

ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
<https://reviews.apache.org/r/12050/#comment46400>

    I had quite a discussion on this with Rohini on HIVE-2936 on how to do these fs ops in a performant and robust way. Feel free to follow that.

ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
<https://reviews.apache.org/r/12050/#comment46401>

    Why not use api instead of FsShell? Does filesystem doesn't offer an api for recursively doing chmod and chgrp?

ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
<https://reviews.apache.org/r/12050/#comment46398>

    I think following way to write this is more robust:
    if(inheritPerms) {
    fs.mkdirs(destfp, destfp.getParent().getPerms);
    } else {
    fs.mkdirs(destfp);
    }

ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
<https://reviews.apache.org/r/12050/#comment46399>

    same as previous comment.
Couple of comments on api usage.

- Ashutosh Chauhan
On July 2, 2013, 4:39 p.m., Chaoyu Tang wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/12050/
> -----------------------------------------------------------
>
> (Updated July 2, 2013, 4:39 p.m.)
>
>
> Review request for hive.
>
>
> Bugs: HIVE- and HIVE-3756
>     https://issues.apache.org/jira/browse/HIVE-
>     https://issues.apache.org/jira/browse/HIVE-3756
>
>
> Repository: hive-git
>
>
> Description
> -------
>
> Problems:
> 1. When doing load data or insert overwrite to a table, the data files under database/table directory could not inherit their parent's permissions (i.e. group) as described in HIVE-3756.
> 2. Beside the group issue, the read/write permission mode is also not inherited
> 3. Same problem affects the partition files (see HIVE-3094)
>
> Cause:
> The task results (from load data or insert overwrite) are initially stored in scratchdir and then loaded under warehouse table directory. FileSystem.rename is used in this step (e.g. LoadTable/LoadPartition) to move the dirs/files but it preserves their permissions (including group and mode) which are determined by scratchdir permission or umask. If the scratchdir has different permissions from those of warehouse table directories, the problem occurs.
>
> Solution:
> After the FileSystem.rename is called, changing all renamed (moved) files/dirs to their destination parents' permissions if needed (say if hive.warehouse.subdir.inherit.perms is true). Here I introduced a new method renameFile doing both rename and permission. It replaces the FileSystem.rename used in LoadTable/LoadPartition. I do not replace rename used to move files/dirs under same scratchdir in the middle of task processing. It looks to me not necessary since they are temp files and also probably access protected by top scratchdir mode 700 (HIVE-4487).
>
>
> Diffs
> -----
>
>   ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java 17daaa1
>
> Diff: https://reviews.apache.org/r/12050/diff/
>
>
> Testing
> -------
>
> The following cases tested that all created subdirs/files inherit their parents' permission mode and group in : 1). create database; 2). create table; 3). load data; 4) insert overwrite; 5) partitions.
> {code}
> hive> dfs -ls -d /user/tester1/hive;                                                                      
> drwxrwx---   - tester1 testgroup123          0 2013-06-22 13:20 /user/tester1/hive
>
> hive> create database tester1 COMMENT 'Database for user tester1' LOCATION '/user/tester1/hive/tester1.db';
> hive> dfs -ls -R /user/tester1/hive;                                                                        
> drwxrwx---   - tester1 testgroup123          0 2013-06-22 13:21 /user/tester1/hive/tester1.db