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

 2697 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-06-18 08:54:23 +0000
+++ b/storage/ndb/include/ndb_version.h.in	2008-09-12 07:21:54 +0000
@@ -226,5 +226,6 @@ ndbd_LIST_TABLES_CONF_long_signal(Uint32
 }
 
 #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-04-23 14:36:54 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp	2008-09-12 07:21:54 +0000
@@ -1327,7 +1327,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    */
@@ -1337,10 +1341,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 {
@@ -1740,6 +1745,8 @@ private:
   bool c_sr_wait_to;
   NdbNodeBitmask m_sr_nodes;
   NdbNodeBitmask m_to_nodes;
+
+  void startme_copygci_conf(Signal*);
 };
 
 #if (DIH_CDATA_SIZE < _SYSFILE_SIZE32)

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2008-08-11 11:24:12 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2008-09-12 07:21:54 +0000
@@ -505,18 +505,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);
   
@@ -2241,11 +2242,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)
 {
@@ -4555,6 +4582,7 @@ void Dbdih::checkCopyTab(Signal* signal,
   case GSN_START_PERMCONF:
   case GSN_DICTSTARTREQ:
   case GSN_START_MECONF:
+  case GSN_COPY_GCIREQ:
     jam();
     break;
   default:
@@ -8840,13 +8868,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;
 
@@ -8861,6 +8903,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()
@@ -8875,11 +8949,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){
@@ -8937,16 +9008,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()
@@ -12182,7 +12270,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:2697) Magnus Svensson12 Sep