#At file:///home/zhl/mysql/mysql-5.1-telco-6.3-bugs/
2803 Leonard Zhou 2008-12-17
BUG#31056 Limited node restart in single user mode
modified:
storage/ndb/src/mgmclient/CommandInterpreter.cpp
storage/ndb/src/mgmsrv/MgmtSrvr.cpp
storage/ndb/src/mgmsrv/MgmtSrvr.hpp
storage/ndb/test/ndbapi/testMgm.cpp
=== modified file 'storage/ndb/src/mgmclient/CommandInterpreter.cpp'
--- a/storage/ndb/src/mgmclient/CommandInterpreter.cpp 2008-12-11 08:12:13 +0000
+++ b/storage/ndb/src/mgmclient/CommandInterpreter.cpp 2008-12-17 06:36:05 +0000
@@ -1405,11 +1405,7 @@ CommandInterpreter::executeForAll(const
ndbout_c("Executing STOP on all nodes.");
retval = (this->*fun)(nodeId, allAfterSecondToken, true);
} else if(strcasecmp(cmd, "RESTART") == 0) {
- ndbout_c("Executing RESTART on all nodes.");
- ndbout_c("Starting shutdown. This may take a while. Please wait...");
retval = (this->*fun)(nodeId, allAfterSecondToken, true);
- ndbout_c("Trying to start all nodes of system.");
- ndbout_c("Use ALL STATUS to see the system start-up phases.");
} else if (strcasecmp(cmd, "STATUS") == 0) {
(this->*fun)(nodeId, allAfterSecondToken, true);
} else {
@@ -2202,6 +2198,18 @@ CommandInterpreter::executeRestart(Vecto
}
NdbAutoPtr<char> ap1((char*)cl);
+ for (int i = 0; i<cl->no_of_nodes; i++)
+ if((cl->node_states+i)->node_status == NDB_MGM_NODE_STATUS_SINGLEUSER)
+ {
+ ndbout_c("Cannot restart nodes: single user mode");
+ return -1;
+ }
+
+ if (node_ids == 0) {
+ ndbout_c("Executing RESTART on all nodes.");
+ ndbout_c("Starting shutdown. This may take a while. Please wait...");
+ }
+
for (int i= 0; i < no_of_nodes; i++)
{
int j = 0;
@@ -2232,7 +2240,7 @@ CommandInterpreter::executeRestart(Vecto
else
{
if (node_ids == 0)
- ndbout_c("NDB Cluster is being restarted.");
+ ndbout_c("All DB nodes are being restarted.");
else
{
ndbout << "Node";
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2008-11-13 13:20:59 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2008-12-17 06:36:05 +0000
@@ -1322,6 +1322,19 @@ int MgmtSrvr::check_nodes_starting()
return 0;
}
+int MgmtSrvr::check_nodes_single_user()
+{
+ NodeId nodeId = 0;
+ ClusterMgr::Node node;
+ while(getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB))
+ {
+ node = theFacade->theClusterMgr->getNodeInfo(nodeId);
+ if((node.m_state.startLevel == NodeState::SL_SINGLEUSER))
+ return 1;
+ }
+ return 0;
+}
+
int MgmtSrvr::restartNodes(const Vector<NodeId> &node_ids,
int * stopCount, bool nostart,
bool initialStart, bool abort,
@@ -1330,8 +1343,9 @@ int MgmtSrvr::restartNodes(const Vector<
/*
verify that no nodes are starting before stopping as this would cause
the starting node to shutdown
+ check single user mode
*/
- if (!abort && check_nodes_starting())
+ if ((!abort && check_nodes_starting()) || check_nodes_single_user())
return OPERATION_NOT_ALLOWED_START_STOP;
NdbNodeBitmask nodes;
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.hpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2008-03-14 13:34:05 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2008-12-17 06:36:05 +0000
@@ -495,6 +495,7 @@ private:
int check_nodes_starting();
int check_nodes_stopping();
+ int check_nodes_single_user();
//**************************************************************************
=== modified file 'storage/ndb/test/ndbapi/testMgm.cpp'
--- a/storage/ndb/test/ndbapi/testMgm.cpp 2008-11-04 16:52:06 +0000
+++ b/storage/ndb/test/ndbapi/testMgm.cpp 2008-12-17 06:36:05 +0000
@@ -115,6 +115,14 @@ int runTestSingleUserMode(NDBT_Context*
while (i<loops && result == NDBT_OK) {
g_info << i << ": ";
int timeout = 120;
+ int nodeId = restarter.getMasterNodeId();
+ // Test that it's not possible to restart one node in single user mode
+ CHECK(restarter.enterSingleUserMode(pNdb->getNodeId()) == 0);
+ CHECK(restarter.waitClusterSingleUser(timeout) == 0);
+ CHECK(restarter.restartOneDbNode(nodeId) != 0)
+ CHECK(restarter.exitSingleUserMode() == 0);
+ CHECK(restarter.waitClusterStarted(timeout) == 0);
+
// Test that the single user mode api can do everything
CHECK(restarter.enterSingleUserMode(pNdb->getNodeId()) == 0);
CHECK(restarter.waitClusterSingleUser(timeout) == 0);
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (zhou.li:2803) Bug#31056 | Leonard Zhou | 17 Dec |