trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbirds...@apache.org
Subject [1/2] incubator-trafodion git commit: TRAFODION-1757 Improvements to DCS infrastructure: 1. handle partially up and operational Trafodion environment.
Date Tue, 09 Feb 2016 20:17:18 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 93f104591 -> 8c955e6df


TRAFODION-1757 Improvements to DCS infrastructure:
1. handle partially up and operational Trafodion environment.

2. If zookeeper interface gives an error during dcsstop,
then explicitly kill the DCS master and servers.


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

Branch: refs/heads/master
Commit: c654a51499db500d2f5eea33bdfb8a106870964a
Parents: 3aef621
Author: Arvind Narain <arvindn@apache.org>
Authored: Mon Feb 8 23:21:27 2016 +0000
Committer: Arvind Narain <arvindn@apache.org>
Committed: Mon Feb 8 23:21:27 2016 +0000

----------------------------------------------------------------------
 core/sqf/sql/scripts/dcscheck                        | 10 +++++-----
 core/sqf/sql/scripts/dcsstart                        |  4 ++--
 dcs/bin/stop-dcs.sh                                  |  5 +++--
 .../java/org/trafodion/dcs/server/ServerManager.java | 15 ++++++++++++++-
 4 files changed, 24 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c654a514/core/sqf/sql/scripts/dcscheck
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/dcscheck b/core/sqf/sql/scripts/dcscheck
index 270a5d6..b0bc689 100755
--- a/core/sqf/sql/scripts/dcscheck
+++ b/core/sqf/sql/scripts/dcscheck
@@ -51,10 +51,10 @@ if [[ $? != 0 ]]; then
 fi
 
 echo
-#Check if Trafodion is up and running
+#Check if Trafodion is up and operational
 sqcheck -f > $tmp_chk 2>&1
 sq_stat=$?
-if [[ $sq_stat == 0 ]]; then
+if ( [ $sq_stat == 0 ] || [ $sq_stat == 1 ] ); then
 
  if [ -d $DCS_INSTALL_DIR ];then
 
@@ -126,8 +126,8 @@ if [[ $sq_stat == 0 ]]; then
      down_dcsmaster_cnt=''
    fi
 
-### Get the current process status (all processes)
-  sqps > $tmp_ps 2>&1
+### Get the current cluster process status (all processes)
+  cstat > $tmp_ps 2>&1
 
 ### Get the actual number of mxosrvrs
   let act_mxo_cnt=`< $tmp_ps egrep -a -i ' mxosrvr' | wc -l`
@@ -181,7 +181,7 @@ if [[ $sq_stat == 0 ]]; then
    exit 1
  fi
 else
- echo "Trafodion is not started..."
+ echo "Trafodion is not started or is not operational..."
  echo
 fi
 exit 0

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c654a514/core/sqf/sql/scripts/dcsstart
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/dcsstart b/core/sqf/sql/scripts/dcsstart
index 5bb6140..86d7d3a 100755
--- a/core/sqf/sql/scripts/dcsstart
+++ b/core/sqf/sql/scripts/dcsstart
@@ -22,10 +22,10 @@
 # @@@ END COPYRIGHT @@@
 #
 
-#Check if Trafodion is up and running
+#Check if Trafodion is up and operational
 sqcheck -f
 sq_stat=$?
-if [[ $sq_stat == 0 ]]; then
+if ( [ $sq_stat == 0 ] || [ $sq_stat == 1 ] ); then
    DCS_START_CMD=${DCS_INSTALL_DIR}/bin/start-dcs.sh
 
    if [ -z ${DCS_INSTALL_DIR} ]; then

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c654a514/dcs/bin/stop-dcs.sh
----------------------------------------------------------------------
diff --git a/dcs/bin/stop-dcs.sh b/dcs/bin/stop-dcs.sh
index 8da9ad4..3259117 100755
--- a/dcs/bin/stop-dcs.sh
+++ b/dcs/bin/stop-dcs.sh
@@ -40,9 +40,10 @@ fi
 
 master=`$bin/dcs --config "${DCS_CONF_DIR}" org.trafodion.dcs.zookeeper.ZkUtil /$USER/dcs/master|tail
-n 1`
 errCode=$?
-if [ $errCode -ne 0 ]
+zkerror=`echo $master| grep -i error`
+if ( [ $errCode -ne 0 ] || [ ! -z $zkerror ] );
 then
-  echo "Zookeeper exception occured, killing all DcsMaster and DcsServers..."
+  echo "Zookeeper exception occurred, killing all DcsMaster and DcsServers..."
   "$bin"/dcs-daemon.sh --config "${DCS_CONF_DIR}" stop master 
   "$bin"/dcs-daemons.sh --config "${DCS_CONF_DIR}" --hosts "${DCS_SERVERS}" stop server 
   exit $errCode

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c654a514/dcs/src/main/java/org/trafodion/dcs/server/ServerManager.java
----------------------------------------------------------------------
diff --git a/dcs/src/main/java/org/trafodion/dcs/server/ServerManager.java b/dcs/src/main/java/org/trafodion/dcs/server/ServerManager.java
index a275356..b5e65a1 100644
--- a/dcs/src/main/java/org/trafodion/dcs/server/ServerManager.java
+++ b/dcs/src/main/java/org/trafodion/dcs/server/ServerManager.java
@@ -251,6 +251,18 @@ public final class ServerManager implements Callable {
         }
 
         private boolean isTrafodionRunning() {
+
+        // Check if Trafodion is up and running
+        // If Trafodion is fully or partially up and operational 
+        // return true else return false.
+        // Invoke sqcheck to check Trafodion status. 
+        // 
+        //   sqcheck returns:
+        //   -1 - Not up ($?=255)
+        //    0 - Fully up and operational
+        //    1 - Partially up and operational
+        //    2 - Partially up and NOT operational
+
             ScriptContext scriptContext = new ScriptContext();
             scriptContext.setHostName(hostName);
             scriptContext.setScriptName(Constants.SYS_SHELL_SCRIPT_NAME);
@@ -260,7 +272,8 @@ public final class ServerManager implements Callable {
                                                                  // block while
                                                                  // script is
                                                                  // running
-            return scriptContext.getExitCode() != 0 ? false : true;
+            int exitCode = scriptContext.getExitCode();
+            return (exitCode == 0 || exitCode == 1) ? true : false;
         }
     }
 


Mime
View raw message