Repository: tajo Updated Branches: refs/heads/master 8c8048a44 -> e8dc34375
TAJO-1998: Waiting for gracefully stopping in tajo-deamon.sh is too short. Closes #885 Project: http://git-wip-us.apache.org/repos/asf/tajo/repo Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/e8dc3437 Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/e8dc3437 Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/e8dc3437 Branch: refs/heads/master Commit: e8dc34375d4fac329d5e79d17a221af007de814e Parents: 8c8048a Author: Jinho Kim <[email protected]> Authored: Thu Dec 3 15:40:07 2015 +0900 Committer: Jinho Kim <[email protected]> Committed: Thu Dec 3 15:40:07 2015 +0900 ---------------------------------------------------------------------- CHANGES | 3 +++ tajo-dist/src/main/bin/stop-tajo.sh | 25 +++++++++++-------------- tajo-dist/src/main/bin/tajo-daemon.sh | 13 +++++++++++-- 3 files changed, 25 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tajo/blob/e8dc3437/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index a1ba896..75fc9ca 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,9 @@ Release 0.12.0 - unreleased IMPROVEMENT + TAJO-1998: Waiting for gracefully stopping in tajo-deamon.sh is too short. + (jinho) + TAJO-1985: Supporting Metric report via JMX. (Yongjun Park via jinho) TAJO-1983: Improve memory usage of ExternalSortExec. (jinho) http://git-wip-us.apache.org/repos/asf/tajo/blob/e8dc3437/tajo-dist/src/main/bin/stop-tajo.sh ---------------------------------------------------------------------- diff --git a/tajo-dist/src/main/bin/stop-tajo.sh b/tajo-dist/src/main/bin/stop-tajo.sh index 32a4a4c..c12d3e3 100755 --- a/tajo-dist/src/main/bin/stop-tajo.sh +++ b/tajo-dist/src/main/bin/stop-tajo.sh @@ -24,22 +24,8 @@ bin=`cd "$bin"; pwd` . "$bin"/tajo-config.sh -# stop the tajo master daemon AUTOHA_ENABLED=$("$bin"/tajo getconf tajo.master.ha.enable) -if [ "$AUTOHA_ENABLED" = "true" ]; then - echo "Stopping TajoMasters on HA mode" - if [ -f "${TAJO_CONF_DIR}/masters" ]; then - MASTER_FILE=${TAJO_CONF_DIR}/masters - MASTER_NAMES=$(cat "$MASTER_FILE" | sed 's/#.*$//;/^$/d') - "$bin/tajo-daemons.sh" --hosts masters cd "$TAJO_HOME" \; "$bin/tajo-daemon.sh" stop master - fi -else - echo "Stopping single TajoMaster" - "$bin"/tajo-daemon.sh --config $TAJO_CONF_DIR stop master -fi - - if [ -f "${TAJO_CONF_DIR}/tajo-env.sh" ]; then . "${TAJO_CONF_DIR}/tajo-env.sh" fi @@ -49,3 +35,14 @@ if [ "$TAJO_PULLSERVER_STANDALONE" = "true" ]; then "$bin/tajo-daemons.sh" cd "$TAJO_HOME" \; "$bin/tajo-daemon.sh" stop pullserver fi +# stop the tajo master daemon +if [ "$AUTOHA_ENABLED" = "true" ]; then + echo "Stopping TajoMasters on HA mode" + if [ -f "${TAJO_CONF_DIR}/masters" ]; then + MASTER_FILE=${TAJO_CONF_DIR}/masters + MASTER_NAMES=$(cat "$MASTER_FILE" | sed 's/#.*$//;/^$/d') + "$bin/tajo-daemons.sh" --hosts masters cd "$TAJO_HOME" \; "$bin/tajo-daemon.sh" stop master + fi +else + "$bin"/tajo-daemon.sh --config $TAJO_CONF_DIR stop master +fi \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/e8dc3437/tajo-dist/src/main/bin/tajo-daemon.sh ---------------------------------------------------------------------- diff --git a/tajo-dist/src/main/bin/tajo-daemon.sh b/tajo-dist/src/main/bin/tajo-daemon.sh index 6343df7..0cb8737 100755 --- a/tajo-dist/src/main/bin/tajo-daemon.sh +++ b/tajo-dist/src/main/bin/tajo-daemon.sh @@ -95,7 +95,7 @@ fi export TAJO_LOGFILE=tajo-$TAJO_IDENT_STRING-$command-$HOSTNAME.log export TAJO_ROOT_LOGGER_APPENDER="${TAJO_ROOT_LOGGER_APPENDER:-DRFA}" export TAJO_PULLSERVER_STANDALONE="${TAJO_PULLSERVER_STANDALONE:-false}" -export TAJO_STOP_TIMEOUT=${TAJO_STOP_TIMEOUT:-2} +export TAJO_STOP_TIMEOUT=${TAJO_STOP_TIMEOUT:-5} log=$TAJO_LOG_DIR/tajo-$TAJO_IDENT_STRING-$command-$HOSTNAME.out pid=$TAJO_PID_DIR/tajo-$TAJO_IDENT_STRING-$command.pid @@ -137,7 +137,16 @@ case $startStop in if kill -0 $TARGET_PID > /dev/null 2>&1; then echo stopping $command kill $TARGET_PID - sleep $TAJO_STOP_TIMEOUT + + for (( c=1; c<=$TAJO_STOP_TIMEOUT; c++ )) + do + if kill -0 $TARGET_PID > /dev/null 2>&1; then + sleep 1 + else + break + fi + done + if kill -0 $TARGET_PID > /dev/null 2>&1; then echo "$command did not stop gracefully after $TAJO_STOP_TIMEOUT seconds: killing with kill -9" kill -9 $TARGET_PID
