ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shantanu Mundkur" <ant...@gmail.com>
Subject Review Request 34612: AMBARI-11351: HdfsResource does not account for sticky bit?
Date Fri, 22 May 2015 21:18:12 GMT

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

Review request for Ambari and Alejandro Fernandez.


Bugs: AMBARI-11351
    https://issues.apache.org/jira/browse/AMBARI-11351


Repository: ambari


Description
-------

Specifying a mode of 01777 will result in an exception like:

Exception in thread "main" java.lang.IllegalArgumentException: 1777
 at org.apache.hadoop.fs.permission.PermissionParser.<init>(PermissionParser.java:60)
 at org.apache.hadoop.fs.permission.UmaskParser.<init>(UmaskParser.java:42)
 at org.apache.hadoop.fs.permission.FsPermission.<init>(FsPermission.java:106)
 at org.apache.ambari.fast_hdfs_resource.Resource.setMode(Resource.java:217)
 at org.apache.ambari.fast_hdfs_resource.Runner.main(Runner.java:78)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:606)
 at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
 at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

In fast_hdfs_resource, setMode is used to set the permissions on the Resource object using
the specified mode. Passing in the mode as a string for FsPermission is what results in the
problem because the constructor that is used with string as argument uses the UmaskParser.
Umask values are slightly different from standard modes as they cannot specify t (sticky bit)
or X.

Passing in the argument as a short is probably what is needed here to enable using the FsPermission
code that accounts for the sticky bit. This is what has been done in the attached patch.


Diffs
-----

  contrib/fast-hdfs-resource/src/main/java/org/apache/ambari/fast_hdfs_resource/Resource.java
21750e1 

Diff: https://reviews.apache.org/r/34612/diff/


Testing
-------

Used the following in a Python script.

    params.HdfsResource(params.spark_eventlog_dir_default,
                         type="directory",
                         action="create_on_execute",
                         owner=params.spark_user,
                         group=params.user_group,
                         mode=params.spark_eventlog_dir_mode)
                   
where params.spark_eventlog_dir_mode = 01777

params.spark_eventlog_dir_default was created as d-wxrw--wt


File Attachments
----------------

AMBARI-11351.patch
  https://reviews.apache.org/media/uploaded/files/2015/05/22/080c1aa7-d14b-4e4e-9cf3-9186dc77764d__AMBARI-11351.patch


Thanks,

Shantanu Mundkur


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message