There was an error while loading. Please reload this page.
1 parent 701d97f commit 3b6d52dCopy full SHA for 3b6d52d
rust/operator/src/container.rs
@@ -546,7 +546,19 @@ impl ContainerConfig {
546
r###"
547
echo "Attempt to format ZooKeeper..."
548
if [[ "0" -eq "$(echo $POD_NAME | sed -e 's/.*-//')" ]] ; then
549
- {hadoop_home}/bin/hdfs zkfc -formatZK -nonInteractive || true
+ set +e
550
+ {hadoop_home}/bin/hdfs zkfc -formatZK -nonInteractive
551
+ EXITCODE=$?
552
+ set -e
553
+ if [[ $EXITCODE -eq 0 ]]; then
554
+ echo "Successfully formatted"
555
+ elif [[ $EXITCODE -eq 2 ]]; then
556
+ echo "ZNode already existed, did nothing"
557
+ else
558
+ echo "Zookeeper format failed with exit code $EXITCODE"
559
+ exit $EXITCODE
560
+ fi
561
+
562
else
563
echo "ZooKeeper already formatted!"
564
fi
0 commit comments