List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:September 30 2010 2:35pm
Subject:bzr commit into mysql-5.1-telco-7.1 branch (jonas:3852)
View as plain text  
#At file:///home/jonas/src/telco-7.1/ based on revid:jonas@stripped

 3852 Jonas Oreland	2010-09-30 [merge]
      ndb - merge 70 to 71

    modified:
      storage/ndb/include/kernel/signaldata/WaitGCP.hpp
      storage/ndb/include/ndbapi/Ndb.hpp
      storage/ndb/include/ndbapi/NdbDictionary.hpp
      storage/ndb/include/ndbapi/NdbTransaction.hpp
      storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
      storage/ndb/src/ndbapi/Ndb.cpp
      storage/ndb/src/ndbapi/NdbDictionary.cpp
      storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
      storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
      storage/ndb/src/ndbapi/NdbTransaction.cpp
      storage/ndb/src/ndbapi/Ndbif.cpp
      storage/ndb/test/ndbapi/testDict.cpp
      storage/ndb/test/ndbapi/testRestartGci.cpp
=== modified file 'storage/ndb/include/kernel/signaldata/WaitGCP.hpp'
--- a/storage/ndb/include/kernel/signaldata/WaitGCP.hpp	2009-05-27 15:21:45 +0000
+++ b/storage/ndb/include/kernel/signaldata/WaitGCP.hpp	2010-09-30 14:27:18 +0000
@@ -51,7 +51,8 @@ public:
     CurrentGCI        = 8,  ///< Immediately return current GCI
     BlockStartGcp     = 9,
     UnblockStartGcp   = 10,
-    WaitEpoch         = 11  // If GCP is blocked, wait for epoch to not start
+    WaitEpoch         = 11, // If GCP is blocked, wait for epoch to not start
+    RestartGCI        = 12  // Return restart GCI
   };
 
   Uint32 senderRef;
@@ -98,6 +99,7 @@ class WaitGCPRef {
   friend class Dbdict;
   friend class Backup;
   friend class Trix;
+  friend class NdbDictInterface;
 
 public:
   STATIC_CONST( SignalLength = 2 );

=== modified file 'storage/ndb/include/ndbapi/Ndb.hpp'
--- a/storage/ndb/include/ndbapi/Ndb.hpp	2010-09-29 13:25:19 +0000
+++ b/storage/ndb/include/ndbapi/Ndb.hpp	2010-09-30 14:27:18 +0000
@@ -1664,23 +1664,6 @@ public:
   };
 
   /**
-   * For testing purposes it is possible to tamper with the NDB Cluster
-   * (i.e. send a special signal to DBDIH, the NDB distribution handler).
-   * <b>This feature should only used for debugging purposes.</b>
-   * In a release versions of NDB Cluster,
-   * this call always return -1 and does nothing.
-   * 
-   * @param aAction Action to be taken according to TamperType above
-   *
-   * @param aNode  Which node the action will be taken
-   *              -1:   Master DIH.
-   *            0-16:   Nodnumber.
-   * @return -1 indicates error, other values have meaning dependent 
-   *          on type of tampering.
-   */
-  int NdbTamper(TamperType aAction, int aNode);  
-
-  /**
    * Return a unique tuple id for a table.  The id sequence is
    * ascending but may contain gaps.  Methods which have no
    * TupleIdRange argument use NDB API dict cache.  They may
@@ -1846,9 +1829,6 @@ private:
                                       Uint32 nodeSequence,
                                       Uint32 *ret_conn_seq= 0);
   
-  // Sets Restart GCI in Ndb object
-  void			RestartGCI(int aRestartGCI);
-
   // Get block number of this NDBAPI object
   int			getBlockNumber();
   

=== modified file 'storage/ndb/include/ndbapi/NdbDictionary.hpp'
--- a/storage/ndb/include/ndbapi/NdbDictionary.hpp	2010-09-22 12:10:34 +0000
+++ b/storage/ndb/include/ndbapi/NdbDictionary.hpp	2010-09-30 14:27:18 +0000
@@ -2322,6 +2322,11 @@ public:
      */
     int forceGCPWait();
     int forceGCPWait(int type);
+
+    /**
+     * Get restart gci
+     */
+    int getRestartGCI(Uint32 * gci);
 #endif
 
     /** @} *******************************************************************/

=== modified file 'storage/ndb/include/ndbapi/NdbTransaction.hpp'
--- a/storage/ndb/include/ndbapi/NdbTransaction.hpp	2010-09-29 13:25:19 +0000
+++ b/storage/ndb/include/ndbapi/NdbTransaction.hpp	2010-09-30 14:27:18 +0000
@@ -942,7 +942,6 @@ private:						
   Uint32        get_send_size();                  // Get size to send
   void          set_send_size(Uint32);            // Set size to send;
   
-  int  receiveDIHNDBTAMPER(const NdbApiSignal* anApiSignal);
   int  receiveTCSEIZECONF(const NdbApiSignal* anApiSignal);
   int  receiveTCSEIZEREF(const NdbApiSignal* anApiSignal);
   int  receiveTCRELEASECONF(const NdbApiSignal* anApiSignal);

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2010-09-13 14:31:30 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2010-09-30 14:27:18 +0000
@@ -17993,6 +17993,18 @@ void Dbdih::execWAIT_GCP_REQ(Signal* sig
     return;
   }//if
 
+  if(requestType == WaitGCPReq::RestartGCI)
+  {
+    jam();
+    conf->senderData = senderData;
+    conf->gci_hi = Uint32(crestartGci);
+    conf->gci_lo = 0;
+    conf->blockStatus = cgcpOrderBlocked;
+    sendSignal(senderRef, GSN_WAIT_GCP_CONF, signal,
+	       WaitGCPConf::SignalLength, JBB);
+    return;
+  }//if
+
   if (requestType == WaitGCPReq::BlockStartGcp)
   {
     jam();

=== modified file 'storage/ndb/src/ndbapi/Ndb.cpp'
--- a/storage/ndb/src/ndbapi/Ndb.cpp	2010-09-30 09:32:28 +0000
+++ b/storage/ndb/src/ndbapi/Ndb.cpp	2010-09-30 14:27:18 +0000
@@ -990,171 +990,6 @@ Ndb::closeTransaction(NdbTransaction* aC
   DBUG_VOID_RETURN;
 }//Ndb::closeTransaction()
 
-/*****************************************************************************
-int* NdbTamper(int aAction, int aNode);
-
-Parameters: aAction     Specifies what action to be taken
-            1: Lock global checkpointing    Can only be sent to master DIH, Parameter aNode ignored.
-            2: UnLock global checkpointing    Can only be sent to master DIH, Parameter aNode ignored.
-	    3: Crash node
-
-           aNode        Specifies which node the action will be taken
-     	  -1: Master DIH 
-       	0-16: Nodnumber
-
-Return Value: -1 Error  .
-                
-Remark:         Sends a signal to DIH.
-*****************************************************************************/ 
-int 
-Ndb::NdbTamper(TamperType aAction, int aNode)
-{
-  NdbTransaction*	tNdbConn;
-  NdbApiSignal		tSignal(theMyRef);
-  int			tNode;
-  int                   tAction;
-  int			ret_code;
-
-#ifdef CUSTOMER_RELEASE
-  return -1;
-#else
-  DBUG_ENTER("Ndb::NdbTamper");
-  CHECK_STATUS_MACRO;
-  checkFailedNode();
-
-  theRestartGCI = 0;
-  switch (aAction) {
-// Translate enum to integer. This is done because the SCI layer
-// expects integers. 
-     case LockGlbChp:
-        tAction = 1;
-        break;
-     case UnlockGlbChp:
-        tAction = 2;
-	break;
-     case CrashNode:
-        tAction = 3;
-        break;
-     case ReadRestartGCI:
-	tAction = 4;
-	break;
-     default:
-        theError.code = 4102;
-        DBUG_RETURN(-1);
-  }
-
-  tNdbConn = getNdbCon();	// Get free connection object
-  if (tNdbConn == NULL) {
-    theError.code = 4000;
-    DBUG_RETURN(-1);
-  }
-  tSignal.setSignal(GSN_DIHNDBTAMPER);
-  tSignal.setData (tAction, 1);
-  tSignal.setData(tNdbConn->ptr2int(),2);
-  tSignal.setData(theMyRef,3);		// Set return block reference
-  tNdbConn->Status(NdbTransaction::Connecting); // Set status to connecting
-  TransporterFacade *tp = theImpl->m_transporter_facade;
-  if (tAction == 3) {
-    tp->lock_mutex();
-    tp->sendSignal(&tSignal, aNode);
-    tp->unlock_mutex();
-    releaseNdbCon(tNdbConn);
-  } else if ( (tAction == 2) || (tAction == 1) ) {
-    tp->lock_mutex();
-    tNode = tp->get_an_alive_node();
-    if (tNode == 0) {
-      theError.code = 4002;
-      releaseNdbCon(tNdbConn);
-      DBUG_RETURN(-1);
-    }//if
-    ret_code = tp->sendSignal(&tSignal,aNode);
-    tp->unlock_mutex();
-    releaseNdbCon(tNdbConn);
-    DBUG_RETURN(ret_code);
-  } else {
-    do {
-      tp->lock_mutex();
-      // Start protected area
-      tNode = tp->get_an_alive_node();
-      tp->unlock_mutex();
-      // End protected area
-      if (tNode == 0) {
-        theError.code = 4009;
-        releaseNdbCon(tNdbConn);
-        DBUG_RETURN(-1);
-      }//if
-      ret_code = sendRecSignal(tNode, WAIT_NDB_TAMPER, &tSignal, 0);
-      if (ret_code == 0) {  
-        if (tNdbConn->Status() != NdbTransaction::Connected) {
-          theRestartGCI = 0;
-        }//if
-        releaseNdbCon(tNdbConn);
-        DBUG_RETURN(theRestartGCI);
-      } else if ((ret_code == -5) || (ret_code == -2)) {
-        TRACE_DEBUG("Continue DIHNDBTAMPER when node failed/stopping");
-      } else {
-        DBUG_RETURN(-1);
-      }//if
-    } while (1);
-  }
-  DBUG_RETURN(0);
-#endif
-}
-#if 0
-/****************************************************************************
-NdbSchemaCon* startSchemaTransaction();
-
-Return Value:   Returns a pointer to a schema connection object.
-                Return NULL otherwise.
-Remark:         Start schema transaction. Synchronous.
-****************************************************************************/ 
-NdbSchemaCon* 
-Ndb::startSchemaTransaction()
-{
-  NdbSchemaCon* tSchemaCon;
-  if (theSchemaConToNdbList != NULL) {
-    theError.code = 4321;
-    return NULL;
-  }//if
-  tSchemaCon = new NdbSchemaCon(this);
-  if (tSchemaCon == NULL) {
-    theError.code = 4000;
-    return NULL;
-  }//if 
-  theSchemaConToNdbList = tSchemaCon;
-  return tSchemaCon;  
-}
-/*****************************************************************************
-void closeSchemaTransaction(NdbSchemaCon* aSchemaCon);
-
-Parameters:     aSchemaCon: the schemacon used in the transaction.
-Remark:         Close transaction by releasing the schemacon and all schemaop.
-*****************************************************************************/
-void
-Ndb::closeSchemaTransaction(NdbSchemaCon* aSchemaCon)
-{
-  if (theSchemaConToNdbList != aSchemaCon) {
-    abort();
-    return;
-  }//if
-  aSchemaCon->release();
-  delete aSchemaCon;
-  theSchemaConToNdbList = NULL;
-  return;
-}//Ndb::closeSchemaTransaction()
-#endif
-
-/*****************************************************************************
-void RestartGCI(int aRestartGCI);
-
-Remark:		Set theRestartGCI on the NDB object
-*****************************************************************************/
-void
-Ndb::RestartGCI(int aRestartGCI)
-{
-  theRestartGCI = aRestartGCI;
-}
-
 /****************************************************************************
 int getBlockNumber(void);
 

=== modified file 'storage/ndb/src/ndbapi/NdbDictionary.cpp'
--- a/storage/ndb/src/ndbapi/NdbDictionary.cpp	2010-09-22 12:10:34 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionary.cpp	2010-09-30 14:27:18 +0000
@@ -2551,6 +2551,12 @@ NdbDictionary::Dictionary::forceGCPWait(
   return m_impl.forceGCPWait(type);
 }
 
+int
+NdbDictionary::Dictionary::getRestartGCI(Uint32 * gci)
+{
+  return m_impl.getRestartGCI(gci);
+}
+
 void
 NdbDictionary::Dictionary::removeCachedIndex(const Index *index){
   DBUG_ENTER("NdbDictionary::Dictionary::removeCachedIndex");

=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2010-09-30 09:32:28 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2010-09-30 14:27:18 +0000
@@ -4606,7 +4606,7 @@ NdbDictInterface::executeSubscribeEvent(
                        errCodes, -1);
   if (ret == 0)
   {
-    buckets =m_sub_start_conf.m_buckets;
+    buckets = m_data.m_sub_start_conf.m_buckets;
   }
 
   DBUG_RETURN(ret);
@@ -4921,7 +4921,7 @@ NdbDictInterface::execSUB_START_CONF(con
 
   if (signal->getLength() == SubStartConf::SignalLength)
   {
-    m_sub_start_conf.m_buckets = subStartConf->bucketCount;
+    m_data.m_sub_start_conf.m_buckets = subStartConf->bucketCount;
   }
   else
   {
@@ -4929,7 +4929,7 @@ NdbDictInterface::execSUB_START_CONF(con
      * 6.3 doesn't send required bucketCount.  
      * ~0 indicates no bucketCount received
      */
-    m_sub_start_conf.m_buckets = ~0;
+    m_data.m_sub_start_conf.m_buckets = ~0;
   }
   DBUG_PRINT("info",("subscriptionId=%d,subscriptionKey=%d,subscriberData=%d",
 		     subscriptionId,subscriptionKey,subscriberData));
@@ -5778,12 +5778,15 @@ int
 NdbDictInterface::forceGCPWait(int type)
 {
   NdbApiSignal tSignal(m_reference);
-  if (type == 0)
+  if (type == 0 || type == 2)
   {
     WaitGCPReq* const req = CAST_PTR(WaitGCPReq, tSignal.getDataPtrSend());
     req->senderRef = m_reference;
     req->senderData = 0;
-    req->requestType = WaitGCPReq::CompleteForceStart;
+    req->requestType = 
+      type == 0 ? 
+      WaitGCPReq::CompleteForceStart : WaitGCPReq::RestartGCI;
+      
     tSignal.theReceiversBlockNumber = DBDIH;
     tSignal.theVerId_signalNumber = GSN_WAIT_GCP_REQ;
     tSignal.theLength = WaitGCPReq::SignalLength;
@@ -5808,7 +5811,7 @@ NdbDictInterface::forceGCPWait(int type)
       m_waiter.m_state = WAIT_LIST_TABLES_CONF;
       m_waiter.wait(DICT_WAITFOR_TIMEOUT);
       m_transporter->unlock_mutex();
-      return 0;
+      return m_error.code == 0 ? 0 : -1;
     }
     return -1;
   }
@@ -5837,15 +5840,34 @@ NdbDictInterface::forceGCPWait(int type)
       m_transporter->forceSend(refToBlock(m_reference));
       m_transporter->unlock_mutex();
     }
-    return 0;
+    return m_error.code == 0 ? 0 : -1;
+  }
+  else
+  {
+    m_error.code = 4003;
   }
   return -1;
 }
 
+int
+NdbDictionaryImpl::getRestartGCI(Uint32 * gci)
+{
+  int res = m_receiver.forceGCPWait(2);
+  if (res == 0 && gci != 0)
+  {
+    * gci = m_receiver.m_data.m_wait_gcp_conf.gci_hi;
+  }
+  return res;
+}
+
 void
 NdbDictInterface::execWAIT_GCP_CONF(const NdbApiSignal* signal,
 				    const LinearSectionPtr ptr[3])
 {
+  const WaitGCPConf* conf = CAST_CONSTPTR(WaitGCPConf, signal->getDataPtr());
+
+  m_data.m_wait_gcp_conf.gci_lo = conf->gci_lo;
+  m_data.m_wait_gcp_conf.gci_hi = conf->gci_hi;
   m_waiter.signal(NO_WAIT);
 }
 
@@ -5853,6 +5875,9 @@ void
 NdbDictInterface::execWAIT_GCP_REF(const NdbApiSignal* signal,
                                    const LinearSectionPtr ptr[3])
 {
+  const WaitGCPRef* ref = CAST_CONSTPTR(WaitGCPRef, signal->getDataPtr());
+  m_error.code = ref->errorCode;
+
   m_waiter.signal(NO_WAIT);
 }
 

=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2010-09-29 13:25:19 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2010-09-30 14:27:18 +0000
@@ -661,6 +661,7 @@ public:
 			  Uint32 noOfSections, bool fullyQualifiedNames);
 
   int forceGCPWait(int type);
+  int getRestartGCI(Uint32 *);
 
   static int parseTableInfo(NdbTableImpl ** dst, 
 			    const Uint32 * data, Uint32 len,
@@ -787,9 +788,15 @@ private:
   UtilBuffer m_tableData;
   UtilBuffer m_tableNames;
 
-  struct {
-    Uint32 m_buckets;
-  } m_sub_start_conf;
+  union {
+    struct SubStartConfData {
+      Uint32 m_buckets;
+    } m_sub_start_conf;
+    struct WaitGcpData {
+      Uint32 gci_hi;
+      Uint32 gci_lo;
+    } m_wait_gcp_conf;
+  } m_data;
 };
 
 class NdbDictionaryImpl;
@@ -846,6 +853,7 @@ public:
   int stopSubscribeEvent(NdbEventOperationImpl &);
 
   int forceGCPWait(int type);
+  int getRestartGCI(Uint32*);
 
   int listObjects(List& list, NdbDictionary::Object::Type type, 
                   bool fullyQualified);

=== modified file 'storage/ndb/src/ndbapi/NdbTransaction.cpp'
--- a/storage/ndb/src/ndbapi/NdbTransaction.cpp	2010-09-30 10:36:47 +0000
+++ b/storage/ndb/src/ndbapi/NdbTransaction.cpp	2010-09-30 14:27:18 +0000
@@ -1626,26 +1626,6 @@ NdbTransaction::getNdbIndexOperation(con
 
 
 /*******************************************************************************
-int  receiveDIHNDBTAMPER(NdbApiSignal* aSignal)
-
-Return Value:  Return 0 : receiveDIHNDBTAMPER was successful.
-               Return -1: In all other case.
-Parameters:    aSignal: The signal object pointer.
-Remark:        Sets theRestartGCI in the NDB object. 
-*******************************************************************************/
-int			
-NdbTransaction::receiveDIHNDBTAMPER(const NdbApiSignal* aSignal)
-{
-  if (theStatus != Connecting) {
-    return -1;
-  } else {
-    theNdb->RestartGCI((Uint32)aSignal->readData(2));
-    theStatus = Connected;
-  }//if
-  return 0;  
-}//NdbTransaction::receiveDIHNDBTAMPER()
-
-/*******************************************************************************
 int  receiveTCSEIZECONF(NdbApiSignal* aSignal);
 
 Return Value:  Return 0 : receiveTCSEIZECONF was successful.

=== modified file 'storage/ndb/src/ndbapi/Ndbif.cpp'
--- a/storage/ndb/src/ndbapi/Ndbif.cpp	2010-09-30 11:52:49 +0000
+++ b/storage/ndb/src/ndbapi/Ndbif.cpp	2010-09-30 14:27:18 +0000
@@ -773,21 +773,6 @@ Ndb::handleReceivedSignal(const NdbApiSi
     theEventBuffer->insertDataL(op, sdata, tLen, copy);
     return;
   }
-  case GSN_DIHNDBTAMPER:
-    {
-      tFirstDataPtr = int2void(tFirstData);
-      if (tFirstDataPtr == 0) goto InvalidSignal;
-      
-      if (tWaitState != WAIT_NDB_TAMPER)
-	return;
-      tCon = void2con(tFirstDataPtr);
-      if (tCon->checkMagicNumber() != 0)
-	return;
-      tReturnCode = tCon->receiveDIHNDBTAMPER(aSignal);
-      if (tReturnCode != -1)
-	theImpl->theWaiter.m_state = NO_WAIT;
-      break;
-    }
   case GSN_SCAN_TABCONF:
     {
       tFirstDataPtr = int2void(tFirstData);

=== modified file 'storage/ndb/test/ndbapi/testDict.cpp'
--- a/storage/ndb/test/ndbapi/testDict.cpp	2010-08-26 12:33:33 +0000
+++ b/storage/ndb/test/ndbapi/testDict.cpp	2010-09-30 14:27:18 +0000
@@ -7749,8 +7749,10 @@ runBug46585(NDBT_Context* ctx, NDBT_Step
     CHECK2(res.waitClusterStarted() == 0,
            "wait cluster started failed");
 
-    int restartGCI = pNdb->NdbTamper(Ndb::ReadRestartGCI, 0);
-    ndbout_c("restartGCI: %d", restartGCI);
+    Uint32 restartGCI = 0;
+    CHECK2(pDic->getRestartGCI(&restartGCI) == 0,
+           "getRestartGCI failed");
+    ndbout_c("restartGCI: %u", restartGCI);
 
     pDic->invalidateTable(tab.getName());
     {

=== modified file 'storage/ndb/test/ndbapi/testRestartGci.cpp'
--- a/storage/ndb/test/ndbapi/testRestartGci.cpp	2010-09-15 09:43:39 +0000
+++ b/storage/ndb/test/ndbapi/testRestartGci.cpp	2010-09-30 14:27:18 +0000
@@ -132,7 +132,14 @@ int runVerifyInserts(NDBT_Context* ctx, 
   HugoOperations hugoOps(*ctx->getTab());
   NdbRestarter restarter;
 
-  int restartGCI = pNdb->NdbTamper(Ndb::ReadRestartGCI, 0);    
+  Uint32 restartGCI;
+  int res = pNdb->getDictionary()->getRestartGCI(&restartGCI);
+  if (res != 0)
+  {
+    ndbout << "Failed to retreive restart gci" << endl;
+    ndbout << pNdb->getDictionary()->getNdbError() << endl;
+    return NDBT_FAILED;
+  }
 
   ndbout << "restartGCI = " << restartGCI << endl;
   int count = 0;


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20100930143538-omp7yj3w3s2lqyg2.bundle
Thread
bzr commit into mysql-5.1-telco-7.1 branch (jonas:3852) Jonas Oreland30 Sep