IMPALA-4588: Enable starting the minicluster when offline

IMPALA-4553 made ntp-wait succeed before kudu would start, assuming
ntp-wait was installed, in order to prevent a litany of errors on ec2
about unsynchronized clocks. This patch disables that waiting if no
internet connection is detected in order to make it possible to start
the minicluster when offline.

Change-Id: Ifbb5babebb0ca6d2553be1b001e20e2270e052b6
Reviewed-on: http://gerrit.cloudera.org:8080/5412
Reviewed-by: Jim Apple <jbapple-impala@apache.org>
Tested-by: Impala Public Jenkins
This commit is contained in:
Jim Apple
2016-12-07 17:41:41 -08:00
committed by Impala Public Jenkins
parent 1762dd1b81
commit 84ee40428d

View File

@@ -293,12 +293,19 @@ function start_cluster {
if [ ${#SUPPORTED_SERVICES[@]} -gt 0 ]; then
for SERVICE in ${SUPPORTED_SERVICES[@]-}; do
# We only run ntp-wait when it is available. That availability is checked by the
# call to ntp-wait --help.
if [[ "${SERVICE}" == "kudu" ]] && ntp-wait --help >/dev/null 2>/dev/null \
&& ! ntp-wait -v; then
echo "ntp-wait failed; cannot start kudu"
return 1
# If all of the following are true, we wait for ntp to sync before proceeding:
#
# 1. Kudu is being started
# 2. An internet connection is available (checked by pinging $NTP_CANARY)
# 3. ntp-wait is installed (checked by calling ntp-wait with the "--help" flag)
if [[ "${SERVICE}" == "kudu" ]]; then
NTP_CANARY=pool.ntp.org
if ! ping -c 1 -w 5 "${NTP_CANARY}" >/dev/null 2>/dev/null; then
echo "WARNING: cannot reach ${NTP_CANARY}; ntp sync recommended for Kudu"
elif ntp-wait --help >/dev/null 2>/dev/null && ! ntp-wait -v; then
echo "ntp-wait failed; cannot start kudu"
return 1
fi
fi
start $SERVICE
done