List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:May 26 2011 12:42pm
Subject:bzr push into mysql-5.1-telco-7.1 branch (jonas:4226 to 4227)
View as plain text  
 4227 Jonas Oreland	2011-05-26 [merge]
      ndb - merge 70 to 71

    modified:
      storage/ndb/include/kernel/ndb_limits.h
      storage/ndb/src/kernel/blocks/LocalProxy.cpp
      storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp
      storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
      storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
      storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
      storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.cpp
      storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.hpp
 4226 Frazer Clement	2011-05-25 [merge]
      Merge 7.0->7.1

    modified:
      storage/ndb/include/kernel/signaldata/FireTrigOrd.hpp
      storage/ndb/include/kernel/signaldata/SumaImpl.hpp
      storage/ndb/include/kernel/signaldata/TupCommit.hpp
      storage/ndb/include/ndbapi/NdbEventOperation.hpp
      storage/ndb/src/common/debugger/signaldata/SumaImpl.cpp
      storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
      storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp
      storage/ndb/src/kernel/blocks/suma/Suma.cpp
      storage/ndb/src/ndbapi/NdbEventOperation.cpp
      storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
      storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp
      storage/ndb/test/include/HugoOperations.hpp
      storage/ndb/test/ndbapi/test_event.cpp
      storage/ndb/test/src/HugoOperations.cpp
=== modified file 'storage/ndb/include/kernel/ndb_limits.h'
--- a/storage/ndb/include/kernel/ndb_limits.h	2011-04-13 08:51:04 +0000
+++ b/storage/ndb/include/kernel/ndb_limits.h	2011-05-26 11:49:47 +0000
@@ -197,6 +197,7 @@
 
 #define MAX_NDBMT_LQH_WORKERS 4
 #define MAX_NDBMT_LQH_THREADS 4
+#define MAX_NDBMT_TC_THREADS  2
 
 #define NDB_FILE_BUFFER_SIZE (256*1024)
 

=== modified file 'storage/ndb/src/kernel/blocks/LocalProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/LocalProxy.cpp	2011-04-27 10:48:16 +0000
+++ b/storage/ndb/src/kernel/blocks/LocalProxy.cpp	2011-05-26 11:52:38 +0000
@@ -661,6 +661,19 @@ LocalProxy::sendNF_COMPLETEREP(Signal* s
 
     sendSignal(DBDIH_REF, GSN_NF_COMPLETEREP,
                signal, NFCompleteRep::SignalLength, JBB);
+
+    if (number() == DBTC)
+    {
+      /**
+       * DBTC send NF_COMPLETEREP "early" to QMGR
+       *   so that it can allow api to handle node-failure of
+       *   transactions eariler...
+       * See Qmgr::execNF_COMPLETEREP
+       */
+      jam();
+      sendSignal(QMGR_REF, GSN_NF_COMPLETEREP, signal,
+                 NFCompleteRep::SignalLength, JBB);
+    }
   }
 }
 

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp	2011-05-25 09:30:37 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp	2011-05-26 11:49:47 +0000
@@ -1314,6 +1314,7 @@ private:
   struct DIVERIFY_queue
   {
     DIVERIFY_queue() {
+      m_ref = 0;
       cfirstVerifyQueue = clastVerifyQueue = 0;
       apiConnectRecord = 0;
       m_empty_done = 1;
@@ -1322,6 +1323,7 @@ private:
     Uint32 cfirstVerifyQueue;
     Uint32 clastVerifyQueue;
     Uint32 m_empty_done;
+    Uint32 m_ref;
   };
 
   bool isEmpty(const DIVERIFY_queue&);
@@ -1330,7 +1332,7 @@ private:
   void emptyverificbuffer(Signal *, Uint32 q, bool aContintueB);
   void emptyverificbuffer_check(Signal*, Uint32, Uint32);
 
-  DIVERIFY_queue c_diverify_queue[1];
+  DIVERIFY_queue c_diverify_queue[MAX_NDBMT_LQH_THREADS];
   Uint32 c_diverify_queue_cnt;
 
   /*------------------------------------------------------------------------*/

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2011-05-25 10:11:58 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2011-05-26 12:42:11 +0000
@@ -9241,6 +9241,16 @@ inline
 void
 Dbdih::enqueue(DIVERIFY_queue & q, Uint32 senderData, Uint64 gci)
 {
+#ifndef NDEBUG
+  /**
+   * - assert only
+   * - we must read first *before* "publishing last
+   *   or else DIH-thread could already have consumed entry
+   *   when we call assert
+   */
+  Uint32 first = q.cfirstVerifyQueue;
+#endif
+
   Uint32 last = q.clastVerifyQueue;
   ApiConnectRecord * apiConnectRecord = q.apiConnectRecord;
 
@@ -9255,7 +9265,7 @@ Dbdih::enqueue(DIVERIFY_queue & q, Uint3
   {
     q.clastVerifyQueue = last + 1;
   }
-  assert(q.clastVerifyQueue != q.cfirstVerifyQueue);
+  assert(q.clastVerifyQueue != first);
 }
 
 inline
@@ -9294,10 +9304,13 @@ void Dbdih::execDIVERIFYREQ(Signal* sign
 {
   EmulatedJamBuffer * jambuf = * (EmulatedJamBuffer**)(signal->theData+2);
   thrjamEntry(jambuf);
+  Uint32 qno = signal->theData[1];
+  ndbassert(qno < NDB_ARRAY_SIZE(c_diverify_queue));
+  DIVERIFY_queue & q = c_diverify_queue[qno];
 loop:
   Uint32 val = m_micro_gcp.m_lock.read_lock();
   Uint32 blocked = getBlockCommit() == true ? 1 : 0;
-  if (blocked == 0 && isEmpty(c_diverify_queue[0]))
+  if (blocked == 0 && isEmpty(q))
   {
     thrjam(jambuf);
     /*-----------------------------------------------------------------------*/
@@ -9318,7 +9331,6 @@ loop:
   // Since we are blocked we need to put this operation last in the verify
   // queue to ensure that operation starts up in the correct order.
   /*-------------------------------------------------------------------------*/
-  DIVERIFY_queue & q = c_diverify_queue[0];
   enqueue(q, signal->theData[0], m_micro_gcp.m_new_gci);
   if (blocked == 0 && jambuf == jamBuffer())
   {
@@ -14775,7 +14787,7 @@ Dbdih::emptyverificbuffer(Signal* signal
     signal->theData[1] = (Uint32)(m_micro_gcp.m_current_gci >> 32);
     signal->theData[2] = (Uint32)(m_micro_gcp.m_current_gci & 0xFFFFFFFF);
     signal->theData[3] = 0;
-    sendSignal(clocaltcblockref, GSN_DIVERIFYCONF, signal, 4, JBB);
+    sendSignal(c_diverify_queue[q].m_ref, GSN_DIVERIFYCONF, signal, 4, JBB);
   }
   else if (aContinueB == true)
   {
@@ -15522,8 +15534,13 @@ void Dbdih::initialiseRecordsLab(Signal*
   case 1:{
     ApiConnectRecordPtr apiConnectptr;
     jam();
+    c_diverify_queue[0].m_ref = calcTcBlockRef(getOwnNodeId());
     for (Uint32 i = 0; i < c_diverify_queue_cnt; i++)
     {
+      if (c_diverify_queue_cnt > 1)
+      {
+        c_diverify_queue[i].m_ref = numberToRef(DBTC, i + 1, 0);
+      }
       /******** INTIALIZING API CONNECT RECORDS ********/
       for (apiConnectptr.i = 0;
            apiConnectptr.i < capiConnectFileSize; apiConnectptr.i++)

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2011-05-25 14:11:22 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2011-05-26 12:42:11 +0000
@@ -144,6 +144,13 @@
 
 class Dbtc: public SimulatedBlock {
 public:
+
+  /**
+   * Incase of mt-TC...only one instance will perform actual take-over
+   *   let this be TAKE_OVER_INSTANCE
+   */
+  STATIC_CONST( TAKE_OVER_INSTANCE = 1 );
+
   enum ConnectionState {
     CS_CONNECTED = 0,
     CS_DISCONNECTED = 1,

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2011-05-25 14:11:22 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2011-05-26 12:42:11 +0000
@@ -4887,6 +4887,7 @@ void Dbtc::diverify010Lab(Signal* signal
   UintR TfirstfreeApiConnectCopy = cfirstfreeApiConnectCopy;
   ApiConnectRecord * const regApiPtr = apiConnectptr.p;
   signal->theData[0] = apiConnectptr.i;
+  signal->theData[1] = instance() ? instance() - 1 : 0;
   if (ERROR_INSERTED(8022)) {
     jam();
     systemErrorLab(signal, __LINE__);
@@ -8478,11 +8479,23 @@ Dbtc::checkNodeFailComplete(Signal* sign
     nfRep->blockNo      = DBTC;
     nfRep->nodeId       = cownNodeid;
     nfRep->failedNodeId = hostptr.i;
-    sendSignal(cdihblockref, GSN_NF_COMPLETEREP, signal, 
-	       NFCompleteRep::SignalLength, JBB);
 
-    sendSignal(QMGR_REF, GSN_NF_COMPLETEREP, signal, 
-	       NFCompleteRep::SignalLength, JBB);
+    if (instance() == 0)
+    {
+      jam();
+      sendSignal(cdihblockref, GSN_NF_COMPLETEREP, signal,
+                 NFCompleteRep::SignalLength, JBB);
+      sendSignal(QMGR_REF, GSN_NF_COMPLETEREP, signal,
+                 NFCompleteRep::SignalLength, JBB);
+    }
+    else
+    {
+      /**
+       * Send to proxy
+       */
+      sendSignal(DBTC_REF, GSN_NF_COMPLETEREP, signal,
+                 NFCompleteRep::SignalLength, JBB);
+    }
   }
 
   CRASH_INSERTION(8058);
@@ -8632,7 +8645,7 @@ Dbtc::checkScanFragList(Signal* signal,
   DEBUG("checkScanActiveInFailedLqh: scanFragError");
 }
 
-void Dbtc::execTAKE_OVERTCCONF(Signal* signal) 
+void Dbtc::execTAKE_OVERTCCONF(Signal* signal)
 {
   jamEntry();
 
@@ -8712,7 +8725,10 @@ void Dbtc::execTAKE_OVERTCREQ(Signal* si
   tcNodeFailptr.i = 0;
   ptrAss(tcNodeFailptr, tcFailRecord);
   if (tcNodeFailptr.p->failStatus != FS_IDLE ||
-      cmasterNodeId != getOwnNodeId())
+      cmasterNodeId != getOwnNodeId() ||
+      (! (instance() == 0 /* single TC */ ||
+          instance() == TAKE_OVER_INSTANCE))) /* in mt-TC case let 1 instance
+                                                 do take-over */
   {
     jam();
     /*------------------------------------------------------------*/
@@ -8727,6 +8743,7 @@ void Dbtc::execTAKE_OVERTCREQ(Signal* si
     tcNodeFailptr.p->queueIndex = tcNodeFailptr.p->queueIndex + 1;
     return;
   }//if
+  ndbrequire(instance() == 0 || instance() == TAKE_OVER_INSTANCE);
   startTakeOverLab(signal);
 }//Dbtc::execTAKE_OVERTCREQ()
 

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.cpp	2011-04-27 10:48:16 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.cpp	2011-05-26 11:54:16 +0000
@@ -79,6 +79,9 @@ DbtcProxy::DbtcProxy(Block_context& ctx)
   addRecSignal(GSN_DROP_INDX_IMPL_CONF,&DbtcProxy::execDROP_INDX_IMPL_CONF);
   addRecSignal(GSN_DROP_INDX_IMPL_REF, &DbtcProxy::execDROP_INDX_IMPL_REF);
 
+  // GSN_TAKE_OVERTCCONF
+  addRecSignal(GSN_TAKE_OVERTCCONF,&DbtcProxy::execTAKE_OVERTCCONF);
+
   m_tc_seize_req_instance = 0;
 }
 
@@ -500,7 +503,7 @@ DbtcProxy::execTCSEIZEREQ(Signal* signal
     return;
   }
 
-  signal->theData[2] = m_tc_seize_req_instance;
+  signal->theData[2] = 1 + m_tc_seize_req_instance;
   sendSignal(workerRef(m_tc_seize_req_instance), GSN_TCSEIZEREQ, signal,
              signal->getLength(), JBB);
   m_tc_seize_req_instance = (m_tc_seize_req_instance + 1) % c_workers;
@@ -922,4 +925,25 @@ DbtcProxy::sendDROP_INDX_IMPL_CONF(Signa
   ssRelease<Ss_DROP_INDX_IMPL_REQ>(ssId);
 }
 
+void
+DbtcProxy::execTAKE_OVERTCCONF(Signal* signal)
+{
+  jamEntry();
+
+  if (!checkNodeFailSequence(signal))
+  {
+    jam();
+    return;
+  }
+
+  for (Uint32 i = 0; i < c_workers; i++)
+  {
+    jam();
+    Uint32 ref = numberToRef(number(), workerInstance(i), getOwnNodeId());
+    sendSignal(ref, GSN_TAKE_OVERTCCONF, signal,
+               signal->getLength(),
+               JBB);
+  }
+}
+
 BLOCK_FUNCTIONS(DbtcProxy)

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.hpp	2011-04-27 10:48:16 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.hpp	2011-05-26 11:52:38 +0000
@@ -304,6 +304,9 @@ protected:
   void execDROP_INDX_IMPL_CONF(Signal*);
   void execDROP_INDX_IMPL_REF(Signal*);
   void sendDROP_INDX_IMPL_CONF(Signal*, Uint32 ssId);
+
+  // GSN_TAKE_OVERTCCONF
+  void execTAKE_OVERTCCONF(Signal*);
 };
 
 #endif

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.1 branch (jonas:4226 to 4227) Jonas Oreland26 May