ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alejandro Fernandez" <>
Subject Review Request 31878: CopyFromLocal failed to copy Tez tarball to HDFS failed because multiple processes tried to copy to the same destination simultaneously
Date Tue, 10 Mar 2015 01:41:42 GMT

This is an automatically generated e-mail. To reply, visit:

Review request for Ambari, Andrew Onischuk, Jonathan Hurley, Nate Cole, and Sid Wagle.

Bugs: AMBARI-9990

Repository: ambari


Pig Service Check and Hive Server 2 START ran on 2 different machines during the stack installation
and failed to copy the tez tarball to HDFS.

I was able to reproduce this locally by calling CopyFromLocal from two clients simultaneously.
See the HDFS audit log, datanode logs on c6408 & c6410, and namenode log on c6410.

The copyFromLocal command's behavior is:
* Try to create a temporary file <filename>._COPYING_ and write the real data there
* If hit any exception, delete the file with the name <filename>._COPYING_

Thus we have the following race condition in this test:
Process P1 created file "tez.tar.gz._COPYING_" and wrote data to it
Process P2 fired the same copyFromLocal command and hit exception because it could not get
the lease
P2 then deleted the file "tez.tar.gz._COPYING_"
P1 could not close the file "tez.tar.gz._COPYING_" since it had been deleted by P2. The exception
would say "could not find lease for file..."
In general we do not have the correct synchronization guarantee for the "copyFromLocal" command.

One solution is for the destination file name to be unique. Because the mv command is synchronized
by the namenode, at least one of them will succeed in naming the file.





Unit tests on passed,

I also deployed a cluster and verified that it was able to copy the tarballs to HDFS when
installing YARN, Hive, Pig.

[root@c6408 ~]# su - hdfs -c 'hadoop fs -ls -R /hdp/apps/'
dr-xr-xr-x   - hdfs hdfs          0 2015-03-10 00:55 /hdp/apps/
-r--r--r--   3 hdfs hadoop   82982575 2015-03-10 00:55 /hdp/apps/
dr-xr-xr-x   - hdfs hdfs            0 2015-03-10 00:57 /hdp/apps/
-r--r--r--   3 hdfs hadoop     105000 2015-03-10 00:57 /hdp/apps/
-r--r--r--   3 hdfs hadoop  192699956 2015-03-09 18:15 /hdp/apps/
dr-xr-xr-x   - hdfs hdfs            0 2015-03-10 00:56 /hdp/apps/
-r--r--r--   3 hdfs hadoop   97542246 2015-03-10 00:56 /hdp/apps/
dr-xr-xr-x   - hdfs hdfs            0 2015-03-09 18:15 /hdp/apps/
-r--r--r--   3 hdfs hadoop   40656789 2015-03-09 18:15 /hdp/apps/


Alejandro Fernandez

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message