List:Commits« Previous MessageNext Message »
From:Magnus Svensson Date:September 12 2008 1:34pm
Subject:bzr commit into mysql-5.1 branch (msvensson:2754)
View as plain text  
#At file:///home/msvensson/mysql/6.4/

 2754 Magnus Svensson	2008-09-12 [merge]
      Merge
modified:
  storage/ndb/include/kernel/signaldata/CopyGCIReq.hpp
  storage/ndb/include/ndb_version.h.in
  storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp
  storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp

=== modified file 'storage/ndb/include/kernel/signaldata/CopyGCIReq.hpp'
--- a/storage/ndb/include/kernel/signaldata/CopyGCIReq.hpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/include/kernel/signaldata/CopyGCIReq.hpp	2008-09-12 07:21:54 +0000
@@ -42,7 +42,8 @@ public:
     LOCAL_CHECKPOINT        = 1,
     RESTART                 = 2,
     GLOBAL_CHECKPOINT       = 3,
-    INITIAL_START_COMPLETED = 4
+    INITIAL_START_COMPLETED = 4,
+    RESTART_NR              = 5
   };
   
 private:

=== modified file 'storage/ndb/include/ndb_version.h.in'
--- a/storage/ndb/include/ndb_version.h.in	2008-09-04 15:45:21 +0000
+++ b/storage/ndb/include/ndb_version.h.in	2008-09-12 07:42:38 +0000
@@ -270,5 +270,6 @@ ndb_scan_distributionkey(Uint32 version)
 }
 
 #define NDBD_FILTER_INSTANCE_63 NDB_MAKE_VERSION(6,3,16)
+#define NDBD_COPY_GCI_RESTART_NR NDB_MAKE_VERSION(6,3,18)
 
 #endif

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp	2008-08-22 10:36:33 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp	2008-09-12 07:42:38 +0000
@@ -1361,7 +1361,11 @@ private:
   /* NODE IS TAKING OVER AS MASTER */
 
   struct CopyGCIMaster {
-    CopyGCIMaster(){ m_copyReason = m_waiting = CopyGCIReq::IDLE;}
+    CopyGCIMaster(){
+      m_copyReason = CopyGCIReq::IDLE;
+      for (Uint32 i = 0; i<WAIT_CNT; i++)
+        m_waiting[i] = CopyGCIReq::IDLE;
+    }
     /*------------------------------------------------------------------------*/
     /*       THIS STATE VARIABLE IS USED TO INDICATE IF COPYING OF RESTART    */
     /*       INFO WAS STARTED BY A LOCAL CHECKPOINT OR AS PART OF A SYSTEM    */
@@ -1371,10 +1375,11 @@ private:
     
     /*------------------------------------------------------------------------*/
     /*       COPYING RESTART INFO CAN BE STARTED BY LOCAL CHECKPOINTS AND BY  */
-    /*       GLOBAL CHECKPOINTS. WE CAN HOWEVER ONLY HANDLE ONE SUCH COPY AT  */
+    /*       GLOBAL CHECKPOINTS. WE CAN HOWEVER ONLY HANDLE TWO SUCH COPY AT  */
     /*       THE TIME. THUS WE HAVE TO KEEP WAIT INFORMATION IN THIS VARIABLE.*/
     /*------------------------------------------------------------------------*/
-    CopyGCIReq::CopyReason m_waiting;
+    STATIC_CONST( WAIT_CNT = 2 );
+    CopyGCIReq::CopyReason m_waiting[WAIT_CNT];
   } c_copyGCIMaster;
   
   struct CopyGCISlave {
@@ -1775,6 +1780,8 @@ private:
   NdbNodeBitmask m_sr_nodes;
   NdbNodeBitmask m_to_nodes;
 
+  void startme_copygci_conf(Signal*);
+
   // MT LQH
 
   Uint32 dihGetInstanceKey(FragmentstorePtr tFragPtr) {

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2008-09-01 08:13:47 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2008-09-12 07:42:38 +0000
@@ -506,18 +506,9 @@ void Dbdih::execCONTINUEB(Signal* signal
     CopyGCIReq::CopyReason reason = (CopyGCIReq::CopyReason)signal->theData[1];
     ndbrequire(c_copyGCIMaster.m_copyReason == reason);
 
-#ifdef ERROR_INSERT
-    if (reason == CopyGCIReq::GLOBAL_CHECKPOINT && ERROR_INSERTED(7189))
-    {
-      sendToRandomNodes("COPY_GCI", signal, &c_COPY_GCIREQ_Counter,
-                        &Dbdih::sendCOPY_GCIREQ);
-      signal->theData[0] = 9999;
-      sendSignalWithDelay(CMVMI_REF, GSN_NDB_TAMPER, signal, 1000, 1);
-      return;
-    }
-#endif
-    
-    sendLoopMacro(COPY_GCIREQ, sendCOPY_GCIREQ, RNIL);
+    // set to idle, to be able to reuse method
+    c_copyGCIMaster.m_copyReason = CopyGCIReq::IDLE;
+    copyGciLab(signal, reason);
     return;
   }
     break;
@@ -804,6 +795,16 @@ done:  
     ok = true;
     jam();
     break;
+  case CopyGCIReq::RESTART_NR:
+    jam();
+    setNodeInfo(signal);
+    /**
+     * We dont really need to make anything durable here...skip it
+     */
+    c_copyGCISlave.m_copyReason = CopyGCIReq::IDLE;
+    signal->theData[0] = c_copyGCISlave.m_senderData;
+    sendSignal(c_copyGCISlave.m_senderRef, GSN_COPY_GCICONF, signal, 1, JBB);
+    return;
   }
   ndbrequire(ok);
   
@@ -2253,11 +2254,37 @@ void Dbdih::execSTART_MEREQ(Signal* sign
   ndbrequire(c_nodeStartMaster.startNode == Tnodeid);
   ndbrequire(getNodeStatus(Tnodeid) == NodeRecord::STARTING);
   
+  if (getNodeInfo(Tnodeid).m_version >= NDBD_COPY_GCI_RESTART_NR)
+  {
+    jam();
+    /**
+     * COPY sysfile to starting node here directly
+     *   to that it gets nodegroups early on
+     */
+
+    /**
+     * Note: only one node can be starting now, so we can use
+     *       c_nodeStartMaster.startNode for determening where to send
+     */
+    c_nodeStartMaster.m_outstandingGsn = GSN_COPY_GCIREQ;
+    copyGciLab(signal, CopyGCIReq::RESTART_NR);
+  }
+  else
+  {
+    jam();
+    startme_copygci_conf(signal);
+  }
+}//Dbdih::nodeRestartStartRecConfLab()
+
+void
+Dbdih::startme_copygci_conf(Signal* signal)
+{
+  jam();
   Callback c = { safe_cast(&Dbdih::lcpBlockedLab), 
                  c_nodeStartMaster.startNode };
   Mutex mutex(signal, c_mutexMgr, c_nodeStartMaster.m_fragmentInfoMutex);
   mutex.lock(c, true, true);
-}//Dbdih::nodeRestartStartRecConfLab()
+}
 
 void Dbdih::lcpBlockedLab(Signal* signal, Uint32 nodeId, Uint32 retVal)
 {
@@ -4578,6 +4605,7 @@ void Dbdih::checkCopyTab(Signal* signal,
   case GSN_START_PERMCONF:
   case GSN_DICTSTARTREQ:
   case GSN_START_MECONF:
+  case GSN_COPY_GCIREQ:
     jam();
     break;
   default:
@@ -9403,13 +9431,27 @@ void Dbdih::execDIHNDBTAMPER(Signal* sig
 /*****************************************************************************/
 void Dbdih::copyGciLab(Signal* signal, CopyGCIReq::CopyReason reason) 
 {
-  if(c_copyGCIMaster.m_copyReason != CopyGCIReq::IDLE){
+  if(c_copyGCIMaster.m_copyReason != CopyGCIReq::IDLE)
+  {
     /**
-     * There can currently only be one waiting
+     * There can currently only be two waiting
      */
-    ndbrequire(c_copyGCIMaster.m_waiting == CopyGCIReq::IDLE);
-    c_copyGCIMaster.m_waiting = reason;
-    return;
+    for (Uint32 i = 0; i<CopyGCIMaster::WAIT_CNT; i++)
+    {
+      if (c_copyGCIMaster.m_waiting[i] == CopyGCIReq::IDLE)
+      {
+        jam();
+        c_copyGCIMaster.m_waiting[i] = reason;
+        return;
+      }
+
+      /**
+       * Code should *not* request more than WAIT_CNT copy-gci's
+       *   so this is an internal error
+       */
+      ndbrequire(false);
+      return;
+    }
   }
   c_copyGCIMaster.m_copyReason = reason;
 
@@ -9424,6 +9466,38 @@ void Dbdih::copyGciLab(Signal* signal, C
   }
 #endif
 
+  if (reason == CopyGCIReq::RESTART_NR)
+  {
+    jam();
+    if (c_nodeStartMaster.startNode != RNIL)
+    {
+      jam();
+      c_COPY_GCIREQ_Counter.clearWaitingFor();
+      c_COPY_GCIREQ_Counter.setWaitingFor(c_nodeStartMaster.startNode);
+      sendCOPY_GCIREQ(signal, c_nodeStartMaster.startNode, RNIL);
+      return;
+    }
+    else
+    {
+      jam();
+      reason = c_copyGCIMaster.m_copyReason = c_copyGCIMaster.m_waiting[0];
+      for (Uint32 i = 1; i<CopyGCIMaster::WAIT_CNT; i++)
+      {
+        jam();
+        c_copyGCIMaster.m_waiting[i-1] = c_copyGCIMaster.m_waiting[i];
+      }
+      c_copyGCIMaster.m_waiting[CopyGCIMaster::WAIT_CNT-1] =
+        CopyGCIReq::CopyGCIReq::IDLE;
+
+      if (reason == CopyGCIReq::IDLE)
+      {
+        jam();
+        return;
+      }
+      // fall-through
+    }
+  }
+
   sendLoopMacro(COPY_GCIREQ, sendCOPY_GCIREQ, RNIL);
 
 }//Dbdih::copyGciLab()
@@ -9438,11 +9512,8 @@ void Dbdih::execCOPY_GCICONF(Signal* sig
   senderNodePtr.i = signal->theData[0];
   receiveLoopMacro(COPY_GCIREQ, senderNodePtr.i);
 
-  CopyGCIReq::CopyReason waiting = c_copyGCIMaster.m_waiting;
   CopyGCIReq::CopyReason current = c_copyGCIMaster.m_copyReason;
-
   c_copyGCIMaster.m_copyReason = CopyGCIReq::IDLE;
-  c_copyGCIMaster.m_waiting = CopyGCIReq::IDLE;
 
   bool ok = false;
   switch(current){
@@ -9500,16 +9571,33 @@ void Dbdih::execCOPY_GCICONF(Signal* sig
   case CopyGCIReq::IDLE:
     ok = false;
     jam();
+    break;
+  case CopyGCIReq::RESTART_NR:
+    ok = true;
+    jam();
+    startme_copygci_conf(signal);
+    break;
   }
   ndbrequire(ok);
 
+
+  c_copyGCIMaster.m_copyReason = c_copyGCIMaster.m_waiting[0];
+  for (Uint32 i = 1; i<CopyGCIMaster::WAIT_CNT; i++)
+  {
+    jam();
+    c_copyGCIMaster.m_waiting[i-1] = c_copyGCIMaster.m_waiting[i];
+  }
+  c_copyGCIMaster.m_waiting[CopyGCIMaster::WAIT_CNT-1] = CopyGCIReq::IDLE;
+
   /**
    * Pop queue
    */
-  if(waiting != CopyGCIReq::IDLE){
-    c_copyGCIMaster.m_copyReason = waiting;
+  if(c_copyGCIMaster.m_copyReason != CopyGCIReq::IDLE)
+  {
+    jam();
+
     signal->theData[0] = DihContinueB::ZCOPY_GCI;
-    signal->theData[1] = waiting;
+    signal->theData[1] = c_copyGCIMaster.m_copyReason;
     sendSignal(reference(), GSN_CONTINUEB, signal, 2, JBB);
   }
 }//Dbdih::execCOPY_GCICONF()
@@ -12748,7 +12836,7 @@ void Dbdih::crashSystemAtGcpStop(Signal*
 dolocal:  
   ndbout_c("m_copyReason: %d m_waiting: %d",
            c_copyGCIMaster.m_copyReason,
-           c_copyGCIMaster.m_waiting);
+           c_copyGCIMaster.m_waiting[0]);
   
   ndbout_c("c_copyGCISlave: sender{Data, Ref} %d %x reason: %d nextWord: %d",
 	   c_copyGCISlave.m_senderData,

Thread
bzr commit into mysql-5.1 branch (msvensson:2754) Magnus Svensson12 Sep