FAQ
I can get the file path/permissions but unable to change permissions. Below
is the snippet of code & error. What is the correct way of doing this?
Thanks.

FileSystem fileSystem = FileSystem.get(new Configuration());

FileStatus fileStatus = fileSystem.getFileStatus(new Path(
"/tmp/hbase/bulk_out"));

System.out.println("Files: " + fileStatus.getPath());

System.out.println("Changing perms from: " + fileStatus.getPermission());

fileSystem.setPermission(fileStatus.getPath(),
FsPermission.createImmutable((short) 0777));

This results in:

Files: hdfs://06.hadoop.dev:54310/tmp/hbase/bulk_out

Changing perms from: rwxrwxrwx

Exception in thread "main" java.io.IOException: Call to 06.hadoop.dev/
58.17.148.39:54310 failed on local exception: java.io.EOFException

at org.apache.hadoop.ipc.Client.wrapException(Client.java:1142)

at org.apache.hadoop.ipc.Client.call(Client.java:1110)

at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:226)

at $Proxy0.setPermission(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at
org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:82)

at
org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:59)

at $Proxy0.setPermission(Unknown Source)

at
org.apache.hadoop.hdfs.DFSClient.setPermission(DFSClient.java:855)

at
org.apache.hadoop.hdfs.DistributedFileSystem.setPermission(DistributedFileSystem.java:560)

at
com.appnexus.hbase.TestBulkLoadWithReduce.main(TestBulkLoadWithReduce.java:225)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.apache.hadoop.util.RunJar.main(RunJar.java:186)

Caused by: java.io.EOFException

at java.io.DataInputStream.readInt(DataInputStream.java:375)

at
org.apache.hadoop.ipc.Client$Connection.receiveResponse(Client.java:815)

at org.apache.hadoop.ipc.Client$Connection.run(Client.java:724)

Search Discussions

  • Harsh J at Sep 13, 2011 at 4:48 am
    Sateesh,

    Your client side jars of Hadoop appear to be of a different version
    than your cluster is running. Use the same set/version of jars to
    avoid such protocol version incompatibility issues.

    (Btw, error messages around this have been improved in trunk)
    On Tue, Sep 13, 2011 at 4:55 AM, Sateesh Lakkarsu wrote:
    I can get the file path/permissions but unable to change permissions. Below
    is the snippet of code & error. What is the correct way of doing this?
    Thanks.

    FileSystem fileSystem = FileSystem.get(new Configuration());

    FileStatus fileStatus = fileSystem.getFileStatus(new Path(
    "/tmp/hbase/bulk_out"));

    System.out.println("Files: " + fileStatus.getPath());

    System.out.println("Changing perms from: " + fileStatus.getPermission());

    fileSystem.setPermission(fileStatus.getPath(),
    FsPermission.createImmutable((short) 0777));

    This results in:

    Files: hdfs://06.hadoop.dev:54310/tmp/hbase/bulk_out

    Changing perms from: rwxrwxrwx

    Exception in thread "main" java.io.IOException: Call to 06.hadoop.dev/
    58.17.148.39:54310 failed on local exception: java.io.EOFException

    at org.apache.hadoop.ipc.Client.wrapException(Client.java:1142)

    at org.apache.hadoop.ipc.Client.call(Client.java:1110)

    at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:226)

    at $Proxy0.setPermission(Unknown Source)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

    at java.lang.reflect.Method.invoke(Method.java:597)

    at
    org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:82)

    at
    org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:59)

    at $Proxy0.setPermission(Unknown Source)

    at
    org.apache.hadoop.hdfs.DFSClient.setPermission(DFSClient.java:855)

    at
    org.apache.hadoop.hdfs.DistributedFileSystem.setPermission(DistributedFileSystem.java:560)

    at
    com.appnexus.hbase.TestBulkLoadWithReduce.main(TestBulkLoadWithReduce.java:225)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

    at java.lang.reflect.Method.invoke(Method.java:597)

    at org.apache.hadoop.util.RunJar.main(RunJar.java:186)

    Caused by: java.io.EOFException

    at java.io.DataInputStream.readInt(DataInputStream.java:375)

    at
    org.apache.hadoop.ipc.Client$Connection.receiveResponse(Client.java:815)

    at org.apache.hadoop.ipc.Client$Connection.run(Client.java:724)


    --
    Harsh J
  • Sateesh Lakkarsu at Sep 13, 2011 at 3:43 pm
    It as failing when I tried it on namenode/datanode too, so it was not the
    version issue.

    Could be unrelated, but came across
    https://issues.apache.org/jira/browse/HADOOP-7629 ... and tried without
    FsPermission.createImmutable but rather new FsPermission(511) and that
    works.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommon-user @
categorieshadoop
postedSep 12, '11 at 11:26p
activeSep 13, '11 at 3:43p
posts3
users2
websitehadoop.apache.org...
irc#hadoop

2 users in discussion

Sateesh Lakkarsu: 2 posts Harsh J: 1 post

People

Translate

site design / logo © 2022 Grokbase