hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Graf <christoph.g...@fatwire.com>
Subject HDFS, FSDataOutputStream, flush(), sync(), close()
Date Wed, 24 Sep 2008 12:59:06 GMT

    Hi everybody,

I have a simple test case which creates a file, writes two lines into
the FSDataOutputStream and then flushes, syncs and closes the stream. I
am using hadoop 0.18.0 with cygwin.

What I observe (in contrast of using java.io.DataOutputStream) is that
the lines get written to the disk only after close() was executed. This
behaviour is true for the local filesystem as well as hdfs.

Can you point me to my mistake?



        final String PATH = "file:///C:/tmp/test.txt";
        Configuration conf = new Configuration();
        conf.set("fs.default.name", PATH);
        FileSystem fs = FileSystem.get(conf);
        FSDataOutputStream out = fs.create(new Path(PATH), true);
        out.writeBytes("Test line 1 \n");
        out.writeBytes("Test line 2 \n");

View raw message