summaryrefslogtreecommitdiff
path: root/ndb/src/mgmsrv/Services.cpp
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.(none)>2004-08-23 18:47:12 +0000
committerunknown <tomas@poseidon.(none)>2004-08-23 18:47:12 +0000
commitff93ca1f805bf3a082ea738c201b74da23878ef3 (patch)
tree240850305938e1e2ce045b4e4b4cf964cea30d69 /ndb/src/mgmsrv/Services.cpp
parent385fd57cb6b88c6e19431bad68aae69e39ba3da9 (diff)
downloadmariadb-git-ff93ca1f805bf3a082ea738c201b74da23878ef3.tar.gz
added support for stopping ndb_mgmd from client
Diffstat (limited to 'ndb/src/mgmsrv/Services.cpp')
-rw-r--r--ndb/src/mgmsrv/Services.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp
index 121176f5a19..d51e54f688d 100644
--- a/ndb/src/mgmsrv/Services.cpp
+++ b/ndb/src/mgmsrv/Services.cpp
@@ -31,6 +31,8 @@
#include "Services.hpp"
+extern bool g_StopServer;
+
static const unsigned int MAX_READ_TIMEOUT = 1000 ;
static const unsigned int MAX_WRITE_TIMEOUT = 100 ;
@@ -1012,12 +1014,29 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &,
nodes.push_back(atoi(p));
}
+ int stop_self= 0;
+
+ for(size_t i=0; i < nodes.size(); i++) {
+ if (nodes[i] == m_mgmsrv.getOwnNodeId()) {
+ stop_self= 1;
+ if (i != nodes.size()-1) {
+ m_output->println("stop reply");
+ m_output->println("result: server must be stopped last");
+ m_output->println("");
+ return;
+ }
+ }
+ }
+
int stopped = 0, result = 0;
for(size_t i=0; i < nodes.size(); i++)
- if((result = m_mgmsrv.stopNode(nodes[i], abort != 0)) == 0)
+ if (nodes[i] != m_mgmsrv.getOwnNodeId()) {
+ if((result = m_mgmsrv.stopNode(nodes[i], abort != 0)) == 0)
+ stopped++;
+ } else
stopped++;
-
+
m_output->println("stop reply");
if(result != 0)
m_output->println("result: %s", m_mgmsrv.getErrorText(result));
@@ -1025,6 +1044,9 @@ MgmApiSession::stop(Parser<MgmApiSession>::Context &,
m_output->println("result: Ok");
m_output->println("stopped: %d", stopped);
m_output->println("");
+
+ if (stop_self)
+ g_StopServer= true;
}