[ 
https://issues.apache.org/jira/browse/HDFS-5478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13817120#comment-13817120
 ] 

Vinay commented on HDFS-5478:
-----------------------------


You may need to call following hsync method with UPDATE_LENGTH flag to update 
the length in the NameNode.
{code}
((HdfsDataOutputStream) fos).hsync(EnumSet.of(SyncFlag.UPDATE_LENGTH));
{code}

Can you please try this and let us know the result.

> File size reports as zero after writing and calling FSDataOutputStream#hsync()
> ------------------------------------------------------------------------------
>
>                 Key: HDFS-5478
>                 URL: https://issues.apache.org/jira/browse/HDFS-5478
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: 2.0.0-alpha
>         Environment: RHEL/OEL 6u3
>            Reporter: Brett Randall
>
> Using a Java client to write to a FSDataOutputStream.  After some data is 
> written and hsync() is called, {{hdfs dfs -get /path/to/file}} gets a file 
> containing the data written so-far, all good.
> {{hdfs dfs -ls /path/to/file}} however reports a zero-byte file, presumably 
> until the stream is closed (it then shows the correct size).  Hue File 
> Browser (running CDH4) also shows zero bytes until the stream is closed.
> See also 
> http://grokbase.com/t/hadoop/hdfs-user/113j63nrce/zero-file-size-after-hsync 
> which discusses the same problem.
> After the buffer is flushed it would be good if the reported file size was 
> updated.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to