accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject [2/2] accumulo git commit: Refactoring watcher causes to be variables
Date Tue, 07 Apr 2015 15:25:34 GMT
Refactoring watcher causes to be variables


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

Branch: refs/heads/master
Commit: 998a31cdc34c1aad43e79c75af74251df58c9f36
Parents: 0585382
Author: John Vines <vines@apache.org>
Authored: Tue Apr 7 11:24:18 2015 -0400
Committer: John Vines <vines@apache.org>
Committed: Tue Apr 7 11:24:18 2015 -0400

----------------------------------------------------------------------
 assemble/bin/accumulo_watcher.sh | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/998a31cd/assemble/bin/accumulo_watcher.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/accumulo_watcher.sh b/assemble/bin/accumulo_watcher.sh
index 9a3dc9f..9fb13a2 100755
--- a/assemble/bin/accumulo_watcher.sh
+++ b/assemble/bin/accumulo_watcher.sh
@@ -30,6 +30,12 @@ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
 
 . "${bin}"/config.sh
 
+CLEAN_EXIT="Clean Exit"
+UNEXPECTED_EXCEPTION="Unexpected exception"
+OOM_EXCEPTION="Out of memory exception"
+ZKLOCK_LOST="ZKLock lost"
+UNKNOWN_ERROR="Unknown error"
+
 ERRFILE=${ACCUMULO_LOG_DIR}/${process}_${LOGHOST}.err
 OUTFILE=${ACCUMULO_LOG_DIR}/${process}_${LOGHOST}.out
 DEBUGLOG=${ACCUMULO_LOG_DIR}/${process}_$(hostname).debug.log
@@ -43,9 +49,9 @@ do
   exit=$?
   unset cause
   if [ "$exit" -eq 0 ]; then
-    potentialStopRunning="Clean Exit"
+    potentialStopRunning=$CLEAN_EXIT
   elif [ "$exit" -eq 1 ]; then
-    potentialStopRunning="Unexpected error"
+    potentialStopRunning=$UNEXPECTED_EXCEPTION
   elif [ "$exit" -eq 130 ]; then
     stopRunning="Control C detected, exiting"
   elif [ "$exit" -eq 143 ]; then
@@ -58,52 +64,52 @@ do
 
     if [ $exit -eq 1 ]; then
       source="exit code"
-      cause="Unexpected Exception"
+      cause=$UNEXPECTED_EXCEPTION
     elif tail -n50 $OUTFILE | grep "java.lang.OutOfMemoryError:" > /dev/null; then
       source="logs"
-      cause="Out of memory exception"
+      cause=$OOM_EXCEPTION
     elif [ "$process" = "tserver" ]; then
       if tail -n50 $DEBUGLOG | grep "ERROR: Lost tablet server lock (reason =" > /dev/null
; then
         source="logs"
-        cause="ZKLock lost"
+        cause=$ZKLOCK_LOST
       fi
     elif [ "$process" = "master" ]; then
       if tail -n50 $DEBUGLOG | grep "ERROR: Master lock in zookeeper lost (reason =" >
/dev/null ; then
         source="logs"
-        cause="ZKLock lost"
+        cause=$ZKLOCK_LOST
       fi
     elif [ "$process" = "gc" ]; then
       if tail -n50 $DEBUGLOG | grep "FATAL: GC lock in zookeeper lost (reason =" > /dev/null
; then
         source="logs"
-        cause="ZKLock lost"
+        cause=$ZKLOCK_LOST
       fi
     elif [ "$process" = "monitor" ]; then
       if tail -n50 $DEBUGLOG | grep "ERROR:  Monitor lock in zookeeper lost (reason =" >
/dev/null ; then
         source="logs"
-        cause="ZKLock lost"
+        cause=$ZKLOCK_LOST
       fi
     elif [ $exit -ne 0 ]; then
       source="exit code"
-      cause="Unknown error"
+      cause=$UNKNOWN_ERROR
     fi
     case $cause in
       #Unknown exit code
-      "Unknown error")
+      "$UNKNOWN_ERROR")
         #window doesn't matter when retries = 0
         RETRIES=0
         ;;
 
-      "Unexpected Exception")
+      "$UNEXPECTED_EXCEPTION")
         WINDOW=$UNEXPECTED_TIMESPAN
         RETRIES=$UNEXPECTED_RETRIES
         ;;
 
-      "Out of memory exception") 
+      "$OOM_EXCEPTION") 
         WINDOW=$OOM_TIMESPAN
         RETRIES=$OOM_RETRIES
         ;;
 
-      "ZKLock lost")
+      "$ZLOCK_LOST")
         WINDOW=$ZKLOCK_TIMESPAN
         RETRIES=$ZKLOCK_RETRIES
         ;;


Mime
View raw message