List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:February 22 2011 8:40am
Subject:bzr commit into mysql-5.1-telco-7.0 branch (jonas:4215)
View as plain text  
#At file:///home/jonas/src/telco-7.0/ based on revid:jonas@stripped

 4215 Jonas Oreland	2011-02-22
      ndb - testMgm vs. autotest - these changes makes it (atleast) pass on my machine...shooting for > 0 passedbzr diff | more

    modified:
      storage/ndb/src/mgmsrv/ConfigManager.cpp
      storage/ndb/src/mgmsrv/ConfigManager.hpp
      storage/ndb/test/ndbapi/testMgm.cpp
=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.cpp	2011-02-21 18:53:35 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.cpp	2011-02-22 08:40:01 +0000
@@ -903,6 +903,7 @@ void ConfigManager::set_config_change_st
   {
     // Rebuild m_all_mgm so that each node in config is included
     // new mgm nodes might have been added
+    assert(m_config_change.m_error == ConfigChangeRef::OK);
     m_config->get_nodemask(m_all_mgm, NDB_MGM_NODE_TYPE_MGM);
   }
 
@@ -1113,7 +1114,7 @@ ConfigManager::sendConfigChangeConf(Sign
 
 
 void
-ConfigManager::startConfigChange(SignalSender& ss)
+ConfigManager::startConfigChange(SignalSender& ss, Uint32 ref)
 {
   if (m_config_state == CS_INITIAL)
   {
@@ -1126,7 +1127,7 @@ ConfigManager::startConfigChange(SignalS
                         m_config_change.m_new_config->getGeneration());
   }
   m_config_change.m_contacted_nodes.clear();
-  m_config_change.m_client_ref = ss.getOwnRef();
+  m_config_change.m_client_ref = ref;
   if (sendConfigChangeImplReq(ss, m_config_change.m_new_config) <= 0)
   {
     g_eventLogger->error("Failed to start configuration change!");
@@ -1152,16 +1153,30 @@ ConfigManager::startAbortConfigChange(Si
                                      MGM_CONFIG_MAN,
                                      GSN_CONFIG_CHANGE_IMPL_REQ,
                                      ConfigChangeImplReq::SignalLength);
-  if (m_waiting_for.isclear())
-    set_config_change_state(ConfigChangeState::IDLE);
-  else
-    set_config_change_state(ConfigChangeState::ABORTING);
 
   if (m_config_change.m_new_config)
   {
     delete m_config_change.m_new_config;
     m_config_change.m_new_config = 0;
   }
+
+  if (m_waiting_for.isclear())
+  {
+    /**
+     * Send CONFIG_CHANGE_IMPL_CONF (aborting) to self
+     */
+    m_waiting_for.set(ss.getOwnNodeId());
+    ConfigChangeImplConf* const conf =
+      CAST_PTR(ConfigChangeImplConf, ssig.getDataPtrSend());
+    conf->requestType = ConfigChangeImplReq::Abort;
+
+    ss.sendSignal(ss.getOwnNodeId(), ssig,
+                  MGM_CONFIG_MAN,
+                  GSN_CONFIG_CHANGE_IMPL_CONF,
+                  ConfigChangeImplConf::SignalLength);
+  }
+
+  set_config_change_state(ConfigChangeState::ABORTING);
 }
 
 int
@@ -1277,9 +1292,8 @@ ConfigManager::execCONFIG_CHANGE_REQ(Sig
     return;
   }
 
-  m_config_change.m_client_ref = from;
   m_config_change.m_new_config = new_config;
-  startConfigChange(ss);
+  startConfigChange(ss, from);
 
   return;
 }
@@ -1812,7 +1826,7 @@ ConfigManager::run()
           Config* new_conf = m_config_change.m_initial_config;
           m_config_change.m_initial_config = 0;
           m_config_change.m_new_config = new_conf;
-          startConfigChange(ss);
+          startConfigChange(ss, ss.getOwnRef());
         }
         break;
 
@@ -1834,7 +1848,7 @@ ConfigManager::run()
             m_started.equal(m_all_mgm) &&   // All mgmd started
             m_checked.equal(m_started))     // All nodes checked
         {
-          startConfigChange(ss);
+          startConfigChange(ss, ss.getOwnRef());
         }
 
         break;

=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.hpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.hpp	2011-01-31 17:37:07 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.hpp	2011-02-22 08:40:01 +0000
@@ -153,7 +153,7 @@ class ConfigManager : public MgmtThread 
   void abortConfigChange();
 
   /* Functions for starting config change from ConfigManager */
-  void startConfigChange(SignalSender& ss);
+  void startConfigChange(SignalSender& ss, Uint32 ref);
   void startAbortConfigChange(SignalSender&);
 
   /* CONFIG_CHANGE - controlling config change from other node */

=== modified file 'storage/ndb/test/ndbapi/testMgm.cpp'
--- a/storage/ndb/test/ndbapi/testMgm.cpp	2011-02-02 00:40:07 +0000
+++ b/storage/ndb/test/ndbapi/testMgm.cpp	2011-02-22 08:40:01 +0000
@@ -22,6 +22,7 @@
 #include <mgmapi_debug.h>
 #include <InputStream.hpp>
 #include <signaldata/EventReport.hpp>
+#include <NdbRestarter.hpp>
 
 /*
   Tests that only need the mgmd(s) started
@@ -1127,7 +1128,7 @@ int runTestGetNodeIdUntilStopped(NDBT_Co
 
 int runSleepAndStop(NDBT_Context* ctx, NDBT_Step* step)
 {
-  int counter= 10*ctx->getNumLoops();
+  int counter= 3*ctx->getNumLoops();
 
   while(!ctx->isTestStopped() && counter--)
     NdbSleep_SecSleep(1);;
@@ -1162,7 +1163,7 @@ check_transporter_connect(NdbMgmd& mgmd,
 
   // Send the 'hello'
   g_info << "Client hello: '" << hello << "'" << endl;
-  if (out.println(hello))
+  if (out.println("%s", hello))
   {
     g_err << "Send hello '" << hello << "' failed" << endl;
     return false;
@@ -2504,18 +2505,22 @@ int runTestStatusAfterStop(NDBT_Context*
     return NDBT_FAILED;
   }
 
+  int nodeId = 0;
   for(int i=0; i < cs->no_of_nodes; i++ )
   {
     ndb_mgm_node_state *ns = cs->node_states + i;
     printf("Node ID: %d  status:%d\n", ns->node_id, ns->node_status);
+    if (nodeId == 0 && ns->node_type == NDB_MGM_NODE_TYPE_NDB)
+      nodeId = ns->node_id;
   }
   free(cs);
   cs = NULL;
 
   printf("Stopping data node\n");
   // We only stop 1 data node, in this case NodeId=2
-  int nodes[1] =  { 2 };
-  int stopped = ndb_mgm_stop2(mgmd.handle(), NDB_ARRAY_SIZE(nodes), nodes, 0);
+  int nodes[1] =  { nodeId };
+  int stopped = ndb_mgm_restart2(mgmd.handle(), NDB_ARRAY_SIZE(nodes), nodes, 
+                                 0, 0, 1);
   if (stopped < 0)
   {
     printf("ndb_mgm_stop failed, '%s' (%d)\n",
@@ -2541,6 +2546,10 @@ int runTestStatusAfterStop(NDBT_Context*
   }
   free(cs);
 
+  NdbRestarter res;
+  res.startAll();
+  res.waitClusterStarted();
+
   return NDBT_OK;
 }
 


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20110222084001-197kdj7jse4lgcr7.bundle
Thread
bzr commit into mysql-5.1-telco-7.0 branch (jonas:4215) Jonas Oreland22 Feb