diff options
author | unknown <tomas@poseidon.(none)> | 2004-08-24 10:44:42 +0000 |
---|---|---|
committer | unknown <tomas@poseidon.(none)> | 2004-08-24 10:44:42 +0000 |
commit | 30f6acf44b1468478329abf0e087a288691999e7 (patch) | |
tree | a1c53a644a0c3db3194f4b8e31946e900271a446 /ndb | |
parent | 8d9dca16e2a190017d99398144d7d4343471a72b (diff) | |
download | mariadb-git-30f6acf44b1468478329abf0e087a288691999e7.tar.gz |
enabling stopping of ndb_mgmd
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/src/mgmsrv/Services.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp index 121176f5a19..2874fd9691a 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,10 +1014,27 @@ 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"); @@ -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; } |