List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:March 13 2009 1:56pm
Subject:bzr push into mysql-5.1-telco-7.0 branch (jonas:2938 to 2940)
View as plain text  
 2940 Jonas Oreland	2009-03-13 [merge]
      merge 63 to 64
modified:
  storage/ndb/test/ndbapi/test_event.cpp
  storage/ndb/test/src/NdbRestarts.cpp

 2939 Jonas Oreland	2009-03-13
      ndb - bug#43413 - also inform ndbcntr about nodegroup being dropped, so that ndb_mgmd shows correct information
modified:
  storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
  storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp

 2938 Jonas Oreland	2009-03-13 [merge]
      merge 63 to 64
modified:
  mysql-test/suite/ndb/r/ndb_dd_basic.result
  mysql-test/suite/ndb/t/ndb_dd_basic.test
  storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp
  storage/ndb/src/kernel/blocks/lgman.cpp
  storage/ndb/src/ndbapi/ndberror.c

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2009-02-19 12:56:59 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2009-03-13 09:38:19 +0000
@@ -21433,9 +21433,10 @@ Dbdict::dropNodegroup_complete(Signal* s
 
   impl_req->requestType = DropNodegroupImplReq::RT_COMPLETE;
   dropNodegroupRecPtr.p->m_blockIndex = 0;
-  dropNodegroupRecPtr.p->m_blockCnt = 2;
+  dropNodegroupRecPtr.p->m_blockCnt = 3;
   dropNodegroupRecPtr.p->m_blockNo[0] = SUMA_REF;
   dropNodegroupRecPtr.p->m_blockNo[1] = DBDIH_REF;
+  dropNodegroupRecPtr.p->m_blockNo[2] = NDBCNTR_REF;
 
   dropNodegroup_toLocal(signal, op_ptr);
 }

=== modified file 'storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2009-02-24 13:00:25 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2009-03-13 09:38:19 +0000
@@ -3615,11 +3615,12 @@ Ndbcntr::execDROP_NODEGROUP_IMPL_REQ(Sig
   DropNodegroupImplReq reqCopy = *(DropNodegroupImplReq*)signal->getDataPtr();
   DropNodegroupImplReq *req = &reqCopy;
 
-  if (req->requestType == DropNodegroupImplReq::RT_COMMIT)
+  if (req->requestType == DropNodegroupImplReq::RT_COMPLETE)
   {
     jam();
     Uint32 save = c_nodeGroup;
     getNodeGroup(signal);
+    
     if (save != c_nodeGroup)
     {
       jam();

=== modified file 'storage/ndb/test/ndbapi/test_event.cpp'
--- a/storage/ndb/test/ndbapi/test_event.cpp	2008-11-11 09:09:59 +0000
+++ b/storage/ndb/test/ndbapi/test_event.cpp	2009-03-13 13:18:41 +0000
@@ -23,6 +23,7 @@
 #include <NdbRestarts.hpp>
 #include <signaldata/DumpStateOrd.hpp>
 #include <NdbEnv.h>
+#include <Bitmask.hpp>
 
 static int createEvent(Ndb *pNdb,
                        const NdbDictionary::Table &tab,
@@ -1688,26 +1689,70 @@ static int runMulti_NR(NDBT_Context* ctx
   DBUG_RETURN(NDBT_OK);
 }
 
-static int restartAllNodes(int & cnt)
+typedef Bitmask<(MAX_NDB_NODES + 31) / 32> NdbNodeBitmask;
+
+static
+int 
+restartNodes(NdbNodeBitmask mask)
+{
+  int cnt = 0;
+  int nodes[MAX_NDB_NODES];
+  NdbRestarter res;
+  for (Uint32 i = 0; i<MAX_NDB_NODES; i++)
+  {
+    if (mask.get(i))
+    {
+      nodes[cnt++] = i;
+      res.restartOneDbNode(i,
+                           /** initial */ false,
+                           /** nostart */ true,
+                           /** abort   */ true);
+    }
+  }
+
+  int result;
+  if (res.waitNodesNoStart(nodes, cnt) != 0)
+    return NDBT_FAILED;
+
+  res.startNodes(nodes, cnt);
+
+  return res.waitClusterStarted();
+}
+
+static int restartAllNodes()
 {
-  cnt = 0;
   NdbRestarter restarter;
-  int id = 0;
-  do {
-    int nodeId = restarter.getDbNodeId(id++);
-    ndbout << "Restart node " << nodeId << endl; 
-    if(restarter.restartOneDbNode(nodeId, false, false, true) != 0){
-      g_err << "Failed to restartNextDbNode" << endl;
-      break;
-    }    
-    if(restarter.waitClusterStarted(60) != 0){
-      g_err << "Cluster failed to start" << endl;
-      break;
+  NdbNodeBitmask ng;
+  NdbNodeBitmask nodes0;
+  NdbNodeBitmask nodes1;
+
+  /**
+   * Restart all nodes using two restarts
+   *   instead of one by one...as this takes to long
+   */
+  for (Uint32 i = 0; i<restarter.getNumDbNodes(); i++)
+  {
+    int nodeId = restarter.getDbNodeId(i);
+    if (ng.get(restarter.getNodeGroup(nodeId)) == false)
+    {
+      nodes0.set(nodeId);
+      ng.set(restarter.getNodeGroup(nodeId));
+    }
+    else
+    {
+      nodes1.set(nodeId);
     }
-    id = id % restarter.getNumDbNodes();
-    cnt++;
-  } while (id);
-  return id != 0;
+  }
+
+  int res;
+  if ((res = restartNodes(nodes0)) != NDBT_OK)
+  {
+    return res;
+  }
+  
+
+  res = restartNodes(nodes1);
+  return res;
 }
 
 static int runCreateDropNR(NDBT_Context* ctx, NDBT_Step* step)
@@ -1716,7 +1761,7 @@ static int runCreateDropNR(NDBT_Context*
   Ndb * ndb= GETNDB(step);
   int result = NDBT_OK;
   NdbRestarter restarter;
-  int loops = 2*ctx->getNumLoops();
+  int loops = ctx->getNumLoops();
 
   if (restarter.getNumDbNodes() < 2)
   {
@@ -1746,8 +1791,7 @@ static int runCreateDropNR(NDBT_Context*
       break;
     }
     ndbout << "Restarting with dropped events with subscribers" << endl;
-    int cnt0 = 0, cnt1 = 0;
-    if (restartAllNodes(cnt0))
+    if (restartAllNodes())
       break;
     if (ndb->getDictionary()->dropTable(pTab->getName()) != 0){
       g_err << "Failed to drop " << pTab->getName() <<" in db" << endl;
@@ -1755,7 +1799,7 @@ static int runCreateDropNR(NDBT_Context*
     }
     ndbout << "Restarting with dropped events and dropped "
            << "table with subscribers" << endl;
-    if (restartAllNodes(cnt1))
+    if (restartAllNodes())
       break;
     if (ndb->dropEventOperation(pOp))
     {
@@ -1769,7 +1813,6 @@ static int runCreateDropNR(NDBT_Context*
       break;
     }
     result = NDBT_OK;
-    loops -= (cnt0 + cnt1);
   } while (--loops > 0);
   
   DBUG_RETURN(result);

=== modified file 'storage/ndb/test/src/NdbRestarts.cpp'
--- a/storage/ndb/test/src/NdbRestarts.cpp	2008-08-21 06:34:09 +0000
+++ b/storage/ndb/test/src/NdbRestarts.cpp	2009-03-13 13:18:41 +0000
@@ -431,50 +431,80 @@ int twoNodeFailure(NdbRestarter& _restar
 
   myRandom48Init((long)NdbTick_CurrentMillisecond());
   int randomId = myRandom48(_restarter.getNumDbNodes());
-  int nodeId = _restarter.getDbNodeId(randomId);  
-  g_info << _restart->m_name << ": node = "<< nodeId << endl;
-
-  CHECK(_restarter.insertErrorInNode(nodeId, 9999) == 0,
-	"Could not restart node "<< nodeId);
-
-    // Create random value, max 10 secs
-  int max = 10;
-  int seconds = (myRandom48(max)) + 1;   
-  g_info << "Waiting for " << seconds << "(" << max 
-	 << ") secs " << endl;
-  NdbSleep_SecSleep(seconds);
+  int n[2];
+  n[0] = _restarter.getDbNodeId(randomId);  
+  n[1] = _restarter.getRandomNodeOtherNodeGroup(n[0], rand());
+  g_info << _restart->m_name << ": node = "<< n[0] << endl;
+
+  int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
+  CHECK(_restarter.dumpStateOneNode(n[0], val2, 2) == 0,
+        "Failed to dump");
+  CHECK(_restarter.dumpStateOneNode(n[1], val2, 2) == 0,
+        "Failed to dump");
+  
+  CHECK(_restarter.insertErrorInNode(n[0], 9999) == 0,
+	"Could not restart node "<< n[0]);
 
-  nodeId = _restarter.getRandomNodeOtherNodeGroup(nodeId, rand());
-  g_info << _restart->m_name << ": node = "<< nodeId << endl;
+    // Create random value, max 3 secs
+  int max = 3000;
+  int ms = (myRandom48(max)) + 1;   
+  g_info << "Waiting for " << ms << "(" << max 
+	 << ") ms " << endl;
+  NdbSleep_MilliSleep(ms);
+
+  g_info << _restart->m_name << ": node = "<< n[1] << endl;
+  CHECK(_restarter.insertErrorInNode(n[1], 9999) == 0,
+	"Could not restart node "<< n[1]);
 
-  CHECK(_restarter.insertErrorInNode(nodeId, 9999) == 0,
-	"Could not restart node "<< nodeId);
+  CHECK(_restarter.waitNodesNoStart(n, 2) == 0,
+        "Failed to wait nostart");
 
+  _restarter.startNodes(n, 2);
+  
   return NDBT_OK;
 }
 
 int twoMasterNodeFailure(NdbRestarter& _restarter, 
 			 const NdbRestarts::NdbRestart* _restart){
 
-  int nodeId = _restarter.getDbNodeId(0);  
-  g_info << _restart->m_name << ": node = "<< nodeId << endl;
-
-  CHECK(_restarter.insertErrorInNode(nodeId, 39999) == 0,
-	"Could not restart node "<< nodeId);
-
-  // Create random value, max 10 secs
-  int max = 10;
-  int seconds = (myRandom48(max)) + 1;   
-  g_info << "Waiting for " << seconds << "(" << max 
-	 << ") secs " << endl;
-  NdbSleep_SecSleep(seconds);
-
-  nodeId = _restarter.getDbNodeId(0);  
-  g_info << _restart->m_name << ": node = "<< nodeId << endl;
-
-  CHECK(_restarter.insertErrorInNode(nodeId, 39999) == 0,
-	"Could not restart node "<< nodeId);
+  int n[2];
+  n[0] = _restarter.getMasterNodeId();  
+  n[1] = n[0];
+  do {
+    n[1] = _restarter.getNextMasterNodeId(n[1]);
+  } while(_restarter.getNodeGroup(n[0]) == _restarter.getNodeGroup(n[1]));
+  
+  g_info << _restart->m_name << ": ";
+  g_info << "node0 = "<< n[0] << "(" << _restarter.getNodeGroup(n[0]) << ") ";
+  g_info << "node1 = "<< n[1] << "(" << _restarter.getNodeGroup(n[1]) << ") ";
+  g_info << endl;
+
+  int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
+  CHECK(_restarter.dumpStateOneNode(n[0], val2, 2) == 0,
+        "Failed to dump");
+  CHECK(_restarter.dumpStateOneNode(n[1], val2, 2) == 0,
+        "Failed to dump");
+  
+  CHECK(_restarter.insertErrorInNode(n[0], 9999) == 0,
+	"Could not restart node "<< n[0]);
+  
+  // Create random value, max 3 secs
+  int max = 3000;
+  int ms = (myRandom48(max)) + 1;   
+  g_info << "Waiting for " << ms << "(" << max 
+	 << ") ms " << endl;
+  NdbSleep_MilliSleep(ms);
+  
+  g_info << _restart->m_name << ": node = "<< n[1] << endl;
+  
+  CHECK(_restarter.insertErrorInNode(n[1], 9999) == 0,
+	"Could not restart node "<< n[1]);
+  
+  CHECK(_restarter.waitNodesNoStart(n, 2) == 0,
+        "Failed to wait nostart");
 
+  _restarter.startNodes(n, 2);
+  
   return NDBT_OK;
 }
 

Thread
bzr push into mysql-5.1-telco-7.0 branch (jonas:2938 to 2940)Jonas Oreland13 Mar