tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject tajo git commit: TAJO-1998: Waiting for gracefully stopping in tajo-deamon.sh is too short.
Date Thu, 03 Dec 2015 06:42:47 GMT
Repository: tajo
Updated Branches:
  refs/heads/branch-0.11.1 47e57a40c -> c2b3620a9


TAJO-1998: Waiting for gracefully stopping in tajo-deamon.sh is too short.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/c2b3620a
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/c2b3620a
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/c2b3620a

Branch: refs/heads/branch-0.11.1
Commit: c2b3620a9543443ba2363cef8a81f99374b060f3
Parents: 47e57a4
Author: Jinho Kim <jhkim@apache.org>
Authored: Thu Dec 3 15:42:07 2015 +0900
Committer: Jinho Kim <jhkim@apache.org>
Committed: Thu Dec 3 15:42: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/c2b3620a/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index f2ce6f1..2b90f79 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,9 @@ Release 0.11.1 - 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/c2b3620a/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/c2b3620a/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


Mime
View raw message