List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:May 2 2011 1:36pm
Subject:bzr commit into mysql-5.1-telco-7.0 branch (jonas:4350) Bug#61025
View as plain text  
#At file:///home/jonas/src/telco-7.0/ based on revid:magnus.blaudd@stripped

 4350 Jonas Oreland	2011-05-02
      ndb - bug#61025 - fix race condition between CONNECT_REP and CM_REGREQ in QMGR (ndbmtd)

    modified:
      storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
      storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
=== modified file 'storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp'
--- a/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2011-04-12 11:59:36 +0000
+++ b/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2011-05-02 13:36:19 +0000
@@ -1043,7 +1043,14 @@ void Cmvmi::execCONNECT_REP(Signal *sign
    * Inform QMGR that client has connected
    */
   signal->theData[0] = hostId;
-  sendSignal(QMGR_REF, GSN_CONNECT_REP, signal, 1, JBA);
+  if (ERROR_INSERTED(9005))
+  {
+    sendSignalWithDelay(QMGR_REF, GSN_CONNECT_REP, signal, 50, 1);
+  }
+  else
+  {
+    sendSignal(QMGR_REF, GSN_CONNECT_REP, signal, 1, JBA);
+  }
 
   /* Automatically subscribe events for MGM nodes.
    */

=== modified file 'storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp'
--- a/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2011-04-15 13:52:53 +0000
+++ b/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2011-05-02 13:36:19 +0000
@@ -42,6 +42,9 @@
 #include <signaldata/DihRestart.hpp>
 #include <ndb_version.h>
 
+#include <EventLogger.hpp>
+extern EventLogger * g_eventLogger;
+
 //#define DEBUG_QMGR_START
 #ifdef DEBUG_QMGR_START
 #include <DebuggerNames.hpp>
@@ -745,6 +748,27 @@ void Qmgr::execCM_REGREQ(Signal* signal)
   Uint32 start_type = ~0;
   NdbNodeBitmask skip_nodes;
 
+  if (!c_connectedNodes.get(cmRegReq->nodeId))
+  {
+    jam();
+
+    /**
+     * With ndbmtd, there is a race condition such that
+     *   CM_REGREQ can arrive prior to CONNECT_REP
+     *   since CONNECT_REP is sent from CMVMI
+     *
+     * In such cases, ignore the CM_REGREQ which is safe
+     *   as it will anyway be resent by starting node
+     */
+    g_eventLogger->info("discarding CM_REGREQ from %u "
+                        "as we're not yet connected (isNdbMt: %u)",
+                        cmRegReq->nodeId,
+                        (unsigned)isNdbMt());
+
+    ndbrequire(isNdbMt());
+    return;
+  }
+
   if (signal->getLength() == CmRegReq::SignalLength)
   {
     jam();
@@ -2351,8 +2375,6 @@ void Qmgr::execCM_ACKADD(Signal* signal)
  * WE HAVE BEEN INCLUDED INTO THE CLUSTER. IT IS NOW TIME TO CALCULATE WHICH 
  * ARE OUR LEFT AND RIGHT NEIGHBOURS FOR THE HEARTBEAT PROTOCOL. 
  *--------------------------------------------------------------------------*/
-#include <EventLogger.hpp>
-extern EventLogger * g_eventLogger;
 void Qmgr::findNeighbours(Signal* signal, Uint32 from) 
 {
   UintR toldLeftNeighbour;


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20110502133619-cl537xt6ar782p1k.bundle
Thread
bzr commit into mysql-5.1-telco-7.0 branch (jonas:4350) Bug#61025Jonas Oreland2 May