You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hadoop.apache.org by Wenqi Ma <ma...@gmail.com> on 2021/08/24 02:15:14 UTC

Both failed when two clients try writing the same HDFS file

Hello everyone,

As far as I know,  when the client requests the NameNode to open the file
for writing, NameNode provides lease to the client for writing to the file.
So, if another client wants to write in the same file it will be rejected
by the Namenode.

However, according to my test, both clients failed with similar error.
The test is simple:
  1. Run hdfs dfs -put test.tar /tmp/1.tar on node1
  2. Then run hdfs dfs -put test2.tar /tmp/1.tar on node2

The error is like:
        put: No lease on /tmp/1.tar._COPYING_ (inode 22648362): File does
not exist. Holder DFSClient_NONMAPREDUCE_-1583692197_1 does not have any
open files.

It is strange, why could the second client still create the file, allocate
the first block, upload block to datanode?

Thanks.

-- 
Best Regards!
Wenqi