Taj,
I don't know what you are trying to do but simultaneous write and read
won't work on any filesystem (unless reader is more complicated that
what you had).
For now, I think you will get most predictable behaviour if you read
after writer has closed the file.
Raghu.
j2eeiscool wrote:
Hi Dhruba,
For my test I do have a Reader and Writer thread. The Reader blocks till the
InputStream is available:
The Reader gets the following exception till the Writer is done :
org.apache.hadoop.ipc.RemoteException: java.io.IOException: Cannot open
filename /hadoopdata0.txt
at org.apache.hadoop.dfs.NameNode.open(NameNode.java:269)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:340)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:566)
at org.apache.hadoop.ipc.Client.call(Client.java:470)
at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:165)
at org.apache.hadoop.dfs.$Proxy0.open(Unknown Source)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:82)
at
org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:59)
at org.apache.hadoop.dfs.$Proxy0.open(Unknown Source)
at
org.apache.hadoop.dfs.DFSClient$DFSInputStream.openInfo(DFSClient.java:864)
at
org.apache.hadoop.dfs.DFSClient$DFSInputStream.<init>(DFSClient.java:856)
at org.apache.hadoop.dfs.DFSClient.open(DFSClient.java:277)
at
org.apache.hadoop.dfs.DistributedFileSystem.open(DistributedFileSystem.java:122)
at org.apache.hadoop.fs.FileSystem.open(FileSystem.java:244)
at HadoopDSMStore.select(HadoopDSMStore.java:44)
at HadoopDSMStore$ReaderThread.run(HadoopDSMStore.java:174)
org.apache.hadoop.ipc.RemoteException: java.io.IOException: Cannot open
filename /hadoopdata0.txt
at org.apache.hadoop.dfs.NameNode.open(NameNode.java:269)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:340)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:566)
at HadoopDSMStore.select(HadoopDSMStore.java:44)
at HadoopDSMStore$ReaderThread.run(HadoopDSMStore.java:174)
1.Is there an api (like isFileAvailable(fileName)) the Reader needs to check
before starting ?
2.Should there be a delay between Writer end and Reader start ?
Thanx,
Taj