MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:tomas Date:March 14 2008 1:02pm
Subject:bk commit into 5.1 tree (tomas:1.2539) BUG#34201
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas.  When tomas does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-03-14 14:02:27+01:00, tomas@stripped +2 -0
  Bug #34201 Unable stop a node when a node in a different group is in "not started" state

  storage/ndb/src/mgmsrv/MgmtSrvr.cpp@stripped, 2008-03-14 14:02:22+01:00, tomas@stripped +58 -21
    Bug #34201 Unable stop a node when a node in a different group is in "not started" state

  storage/ndb/src/mgmsrv/MgmtSrvr.hpp@stripped, 2008-03-14 14:02:22+01:00, tomas@stripped +4 -0
    Bug #34201 Unable stop a node when a node in a different group is in "not started" state

diff -Nrup a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2007-12-11 15:19:34 +01:00
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2008-03-14 14:02:22 +01:00
@@ -1176,18 +1176,13 @@ int MgmtSrvr::sendSTOP_REQ(const Vector<
 int MgmtSrvr::stopNodes(const Vector<NodeId> &node_ids,
                         int *stopCount, bool abort, int* stopSelf)
 {
-  if (!abort)
-  {
-    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_STARTED) && 
-	 (node.m_state.startLevel != NodeState::SL_NOTHING))
-	return OPERATION_NOT_ALLOWED_START_STOP;
-    }
-  }
+  /*
+    verify that no nodes are starting before stopping as this would cause
+    the starting node to shutdown
+  */
+  if (!abort && check_nodes_starting())
+    return OPERATION_NOT_ALLOWED_START_STOP;
+
   NodeBitmask nodes;
   int ret= sendSTOP_REQ(node_ids,
                         nodes,
@@ -1258,15 +1253,6 @@ int MgmtSrvr::enterSingleUser(int * stop
 {
   if (getNodeType(singleUserNodeId) != NDB_MGM_NODE_TYPE_API)
     return NODE_NOT_API_NODE;
-  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_STARTED) && 
-       (node.m_state.startLevel != NodeState::SL_NOTHING))
-      return OPERATION_NOT_ALLOWED_START_STOP;
-  }
   NodeBitmask nodes;
   Vector<NodeId> node_ids;
   int stopSelf;
@@ -1288,11 +1274,47 @@ int MgmtSrvr::enterSingleUser(int * stop
  * Perform node restart
  */
 
+int MgmtSrvr::check_nodes_stopping()
+{
+  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_STOPPING_1) || 
+       (node.m_state.startLevel == NodeState::SL_STOPPING_2) || 
+       (node.m_state.startLevel == NodeState::SL_STOPPING_3) || 
+       (node.m_state.startLevel == NodeState::SL_STOPPING_4))
+      return 1;
+  }
+  return 0;
+}
+
+int MgmtSrvr::check_nodes_starting()
+{
+  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_STARTING))
+      return 1;
+  }
+  return 0;
+}
+
 int MgmtSrvr::restartNodes(const Vector<NodeId> &node_ids,
                            int * stopCount, bool nostart,
                            bool initialStart, bool abort,
                            int *stopSelf)
 {
+  /*
+    verify that no nodes are starting before stopping as this would cause
+    the starting node to shutdown
+  */
+  if (!abort && check_nodes_starting())
+    return OPERATION_NOT_ALLOWED_START_STOP;
+
   NodeBitmask nodes;
   int ret= sendSTOP_REQ(node_ids,
                         nodes,
@@ -1337,6 +1359,21 @@ int MgmtSrvr::restartNodes(const Vector<
   if (nostart)
     return 0;
 
+  /*
+    verify that no nodes are stopping before starting as this would cause
+    the starting node to shutdown
+  */
+  int retry= 600*10;
+  for (;check_nodes_stopping();)
+  {
+    if (--retry)
+      break;
+    NdbSleep_MilliSleep(100);
+  }
+
+  /*
+    start the nodes
+  */
   for (unsigned i = 0; i < node_ids.size(); i++)
   {
     (void) start(node_ids[i]);
diff -Nrup a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2007-06-14 11:26:52 +02:00
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2008-03-14 14:02:22 +01:00
@@ -490,6 +490,10 @@ private:
   int getBlockNumber(const BaseString &blockName);
 
   int alloc_node_id_req(NodeId free_node_id, enum ndb_mgm_node_type type);
+
+  int check_nodes_starting();
+  int check_nodes_stopping();
+
   //**************************************************************************
   
   int _blockNumber;
Thread
bk commit into 5.1 tree (tomas:1.2539) BUG#34201tomas14 Mar