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)