You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by su...@apache.org on 2016/09/27 23:02:49 UTC
[2/3] incubator-trafodion git commit: [TRAFODION-2245] Multiple
sqcheck and jps processes running when monitor is downed and up
[TRAFODION-2245] Multiple sqcheck and jps processes running when monitor is downed and up
Changes done after node down/up testing. DCS Server doesn't start mxosrvr without checking trafodion is up.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/810fc3b3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/810fc3b3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/810fc3b3
Branch: refs/heads/master
Commit: 810fc3b35a88cf6a37a75cfde1bf43f3f2365121
Parents: 7bc317d
Author: selvaganesang <se...@esgyn.com>
Authored: Tue Sep 27 03:23:08 2016 +0000
Committer: selvaganesang <se...@esgyn.com>
Committed: Tue Sep 27 03:23:08 2016 +0000
----------------------------------------------------------------------
core/sqf/sql/scripts/sqcheck | 2 +-
.../org/trafodion/dcs/server/ServerManager.java | 35 +++++++++++++++-----
2 files changed, 28 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/810fc3b3/core/sqf/sql/scripts/sqcheck
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/sqcheck b/core/sqf/sql/scripts/sqcheck
index e4566c6..b5d79ae 100755
--- a/core/sqf/sql/scripts/sqcheck
+++ b/core/sqf/sql/scripts/sqcheck
@@ -175,7 +175,7 @@ function getNodeStatus {
if ( [ $act_lnode_up_cnt '>' 0 ] ); then
exit 0;
else
- exit 1;
+ exit -1;
fi
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/810fc3b3/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 c6e864e..3a65662 100644
--- a/dcs/src/main/java/org/trafodion/dcs/server/ServerManager.java
+++ b/dcs/src/main/java/org/trafodion/dcs/server/ServerManager.java
@@ -85,10 +85,11 @@ public final class ServerManager implements Callable {
private static String sqlplanEnable;
private static int userProgPortMapToSecs;
private static int userProgPortBindToSecs;
- private static ServerHandler[] serverHandlers;
+ private ServerHandler[] serverHandlers;
private int maxRestartAttempts;
private int retryIntervalMillis;
private RetryCounterFactory retryCounterFactory;
+ private String nid = null;
class RegisteredWatcher implements Watcher {
CountDownLatch startSignal;
@@ -344,20 +345,26 @@ public final class ServerManager implements Callable {
// Invoke sqcheck -n <nid> to check Node status.
//
// sqcheck returns:
- // 0 - Node up
- // 1 - Node down
+ // -1 - Not up ($?=255) or node down
+ // 0 - Fully up and operational or node up
+ // 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);
- String command = ("sqcheck -n " + nid);
+ String command;
+ if (nid != null)
+ command = ("sqcheck -n " + nid);
+ else
+ command = ("sqcheck");
scriptContext.setCommand(command);
ScriptManager.getInstance().runScript(scriptContext);// This will
// block while
// script is
// running
int exitCode = scriptContext.getExitCode();
- return (exitCode == 0) ? true : false;
+ return (exitCode == 0 || exitCode == 1) ? true : false;
}
@Override
@@ -372,6 +379,18 @@ public final class ServerManager implements Callable {
getMaster();
featureCheck();
registerInRunning(instance);
+ RetryCounter retryCounter = retryCounterFactory.create();
+ while (!isTrafodionRunning(nid)) {
+ if (!retryCounter.shouldRetry()) {
+ if (nid != null)
+ throw new IOException("Node " + nid + " is not Up");
+ else
+ throw new IOException("Trafodion is not running");
+ } else {
+ retryCounter.sleepUntilNextRetry();
+ retryCounter.useRetry();
+ }
+ }
// When started from bin/dcs-start.sh script childServers will
// contain the
@@ -404,10 +423,10 @@ public final class ServerManager implements Callable {
LOG.debug("Server handler [" + instance + ":" + result
+ "] finished, restarting");
if (isRunning)
- LOG.error("mxosrvr " + nid + "," + pid + " still running, but restarting another");
+ LOG.info("mxosrvr " + nid + "," + pid + " still running");
else
- LOG.error("mxosrvr " + nid + "," + pid + " exited, restarting");
- RetryCounter retryCounter = retryCounterFactory.create();
+ LOG.info("mxosrvr " + nid + "," + pid + " exited, restarting");
+ retryCounter = retryCounterFactory.create();
while (!isTrafodionRunning(nid)) {
if (!retryCounter.shouldRetry()) {
throw new IOException("Node " + nid + " is not Up");