Hi Cloudera,

In my test, I found a following issue about HDFS sync().

Note:in my test, i just set the block size=16MB, since I use a VMware
workstation in my PC.

(1). I create a new file in HDFS and write some bytes (the size of these
bytes > one block).
(2). Then I call the sync() method of FSDataOutputStream, and check the data
in DataNode, there are two block for this file. It's right.

[r...@localhost hadoop-test]# ls ~/data/hadoop-root/dfs/data/current/ -l
total 16544
-rw-r--r-- 1 root root 16777216 Oct 20 19:56 blk_8183064348066912658
-rw-r--r-- 1 root root   131079 Oct 20 19:56
blk_8183064348066912658_1001.meta
-rw-r--r-- 1 root root        0 Oct 20 19:54
dncp_block_verification.log.curr
-rw-r--r-- 1 root root      154 Oct 20 19:54 VERSION
[r...@localhost hadoop-test]# ls
~/data/hadoop-root/dfs/data/blocksBeingWritten/ -l
total 14116
-rw-r--r-- 1 root root 14311674 Oct 20 19:56 blk_-6758853111108478244
-rw-r--r-- 1 root root   111819 Oct 20 19:56
blk_-6758853111108478244_1001.meta

(3) But when I get the FileStatus of this file, the length is only 16777216,
and only one block returned by fs.getFileBlockLocations(...)

path = hdfs://localhost:9000/testfile
length = 16777216
blockSize = 16777216
replication = 1
mTime = 1287575815844
aTime = 1287575815844
permission = rw-r--r--
owner = root
group = supergroup
---------Blocks--------
0,16777216,localhost.localdomain

I think it may be a bug here.

(4) Then, I try to seek to a position >16777216 and < (16777216+14311674),
and try to read something.
     the seek() and read() operations are both ok.

Schubert

Reply via email to