Hi.
I'm trying to continuously write data to HDFS via OutputStream(), and want
to be able to read it at the same time from another client.
Problem is, that after the file is created on HDFS with size of 0, it stays
that way, and only fills up when I close the OutputStream().
Here is a simple code sample illustrating this issue:
try {
FSDataOutputStream out=fileSystem.create(new
Path("/test/test.bin")); // Here the file created with 0 size
for(int i=0;i<1000;i++)
{
out.write(1); // Still stays 0
out.flush(); // Even when I flush it out???
}
Thread.currentThread().sleep(10000);
out.close(); //Only here the file is updated
} catch (Exception e) {
e.printStackTrace();
}
So, two questions here:
1) How it's possible to write the files directly to HDFS, and have them
update there immedaitely?
2) Just for information, in this case, where the file content stays all the
time - on server local disk, in memory, etc...?
Thanks in advance.