From 7a8e9bb156249ca042da7ed8ccb473cc7594afde Mon Sep 17 00:00:00 2001 From: Abhishek Agarwal <1477457+abhishekagarwal87@users.noreply.github.com> Date: Tue, 15 Dec 2020 12:38:50 +0530 Subject: [PATCH] Fix hadoop docker copy script (#10671) --- .../script/copy_hadoop_resources.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/integration-tests/script/copy_hadoop_resources.sh b/integration-tests/script/copy_hadoop_resources.sh index 5f4c17e5c6a..ae378cfab3f 100755 --- a/integration-tests/script/copy_hadoop_resources.sh +++ b/integration-tests/script/copy_hadoop_resources.sh @@ -14,17 +14,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -set -e # wait for hadoop namenode to be up echo "Waiting for hadoop namenode to be up" +MAX_ITERATIONS=15 +i=1 docker exec -t druid-it-hadoop sh -c "./usr/local/hadoop/bin/hdfs dfs -mkdir -p /druid" -while [ $? -ne 0 ] +while [ $? -ne 0 ] && [ $i -lt $MAX_ITERATIONS ] do sleep 2 + i=$((i+1)) docker exec -t druid-it-hadoop sh -c "./usr/local/hadoop/bin/hdfs dfs -mkdir -p /druid" done -echo "Finished waiting for Hadoop namenode" + +if [ $i -lt $MAX_ITERATIONS ]; then + echo "Hadoop namenode is up after $i iterations" +else + echo "Exhausted all runs while waiting for namenode to be up. Exiting" + exit 1 +fi + +set -e # Setup hadoop druid dirs echo "Setting up druid hadoop dirs"