List:Commits« Previous MessageNext Message »
From:Stewart Smith Date:October 3 2008 9:29am
Subject:bzr commit into mysql-5.1 branch (stewart:2878)
View as plain text  
#At file:///home/stewart/mysql/ndbwin32/

 2878 Stewart Smith	2008-10-03 [merge]
      merge 6.4
modified:
  storage/ndb/include/kernel/signaldata/DiGetNodes.hpp
  storage/ndb/include/kernel/signaldata/DictTabInfo.hpp
  storage/ndb/include/kernel/signaldata/DropTrigImpl.hpp
  storage/ndb/src/common/debugger/SignalLoggerManager.cpp
  storage/ndb/src/kernel/blocks/backup/Backup.cpp
  storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
  storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
  storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
  storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp
  storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.hpp
  storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
  storage/ndb/src/kernel/blocks/dbtup/DbtupBuffer.cpp
  storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp
  storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
  storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp
  storage/ndb/src/kernel/blocks/suma/Suma.cpp
  storage/ndb/src/mgmsrv/Services.cpp
  storage/ndb/src/mgmsrv/main.cpp
  storage/ndb/test/ndbapi/bench/asyncGenerator.cpp
  storage/ndb/test/ndbapi/bench/dbPopulate.cpp
  storage/ndb/test/ndbapi/bench/mainPopulate.cpp
  storage/ndb/test/ndbapi/bench/testData.h
  storage/ndb/test/ndbapi/bench/userInterface.cpp
  storage/ndb/test/ndbapi/bench/userInterface.h

=== modified file 'storage/ndb/include/kernel/signaldata/DiGetNodes.hpp'
--- a/storage/ndb/include/kernel/signaldata/DiGetNodes.hpp	2008-08-11 11:44:42 +0000
+++ b/storage/ndb/include/kernel/signaldata/DiGetNodes.hpp	2008-10-02 21:58:44 +0000
@@ -32,13 +32,12 @@ struct DiGetNodesConf {
    */
   friend class Dbdih;
 
-  STATIC_CONST( SignalLength = 4 + MAX_REPLICAS );
+  STATIC_CONST( SignalLength = 3 + MAX_REPLICAS );
   STATIC_CONST( REORG_MOVING = 0x80000000);
 
   Uint32 zero;
   Uint32 fragId;
   Uint32 reqinfo;
-  Uint32 instanceKey;
   Uint32 nodes[MAX_REPLICAS]; //+1
 };
 /**

=== modified file 'storage/ndb/include/kernel/signaldata/DictTabInfo.hpp'
--- a/storage/ndb/include/kernel/signaldata/DictTabInfo.hpp	2008-06-05 20:25:12 +0000
+++ b/storage/ndb/include/kernel/signaldata/DictTabInfo.hpp	2008-10-02 21:58:44 +0000
@@ -183,8 +183,7 @@ public:
     DistrKeyHash = 4,
     DistrKeyLin = 5,
     UserDefined = 6,
-    DistrKeyUniqueHashIndex = 7,
-    DistrKeyOrderedIndex = 8,
+    DistrKeyOrderedIndex = 8, // alias
     HashMapPartition = 9
   };
   

=== modified file 'storage/ndb/include/kernel/signaldata/DropTrigImpl.hpp'
--- a/storage/ndb/include/kernel/signaldata/DropTrigImpl.hpp	2008-09-19 22:10:17 +0000
+++ b/storage/ndb/include/kernel/signaldata/DropTrigImpl.hpp	2008-10-02 17:51:17 +0000
@@ -19,7 +19,7 @@
 #include "SignalData.hpp"
 
 struct DropTrigImplReq {
-  STATIC_CONST( SignalLength = 10 );
+  STATIC_CONST( SignalLength = 11 );
   SECTION( TRIGGER_NAME_SECTION = 0 ); // optional
 
   Uint32 senderRef;
@@ -32,6 +32,7 @@ struct DropTrigImplReq {
   Uint32 triggerNo;
   Uint32 triggerId;
   Uint32 triggerInfo;
+  Uint32 receiverRef;
 };
 
 struct DropTrigImplConf {

=== modified file 'storage/ndb/src/common/debugger/SignalLoggerManager.cpp'
--- a/storage/ndb/src/common/debugger/SignalLoggerManager.cpp	2008-10-01 07:23:17 +0000
+++ b/storage/ndb/src/common/debugger/SignalLoggerManager.cpp	2008-10-03 08:22:13 +0000
@@ -22,6 +22,7 @@
 #include <NdbTick.h>
 #include <NdbEnv.h>
 
+#ifdef VM_TRACE_TIME
 static char* mytime()
 {
   NDB_TICKS t = NdbTick_CurrentMillisecond();
@@ -31,7 +32,7 @@ static char* mytime()
   sprintf(buf, "%u.%03u", s, ms);
   return buf;
 }
-
+#endif
 SignalLoggerManager::SignalLoggerManager()
 {
   for (int i = 0; i < NO_OF_BLOCKS; i++){

=== modified file 'storage/ndb/src/kernel/blocks/backup/Backup.cpp'
--- a/storage/ndb/src/kernel/blocks/backup/Backup.cpp	2008-10-01 04:35:20 +0000
+++ b/storage/ndb/src/kernel/blocks/backup/Backup.cpp	2008-10-02 21:58:44 +0000
@@ -2296,6 +2296,7 @@ Backup::sendDropTrig(Signal* signal, Bac
   req->tableVersion = 0;
   req->indexId = RNIL;
   req->indexVersion = 0;
+  req->receiverRef = reference();
 
   // TUP needs some triggerInfo to find right list
   Uint32 ti = 0;
@@ -3916,7 +3917,7 @@ Backup::execTRANSID_AI(Signal* signal)
   const Uint32 filePtrI = signal->theData[0];
   //const Uint32 transId1 = signal->theData[1];
   //const Uint32 transId2 = signal->theData[2];
-  const Uint32 dataLen  = signal->length() - 3;
+  Uint32 dataLen  = signal->length() - 3;
   
   BackupFilePtr filePtr LINT_SET_PTR;
   c_backupFilePool.getPtr(filePtr, filePtrI);
@@ -3926,14 +3927,30 @@ Backup::execTRANSID_AI(Signal* signal)
   /**
    * Unpack data
    */
+  Uint32 * dst = op.dst;
+  if (signal->getNoOfSections() == 0)
+  {
+    jam();
+    const Uint32 * src = &signal->theData[3];
+    * dst = htonl(dataLen);
+    memcpy(dst + 1, src, 4*dataLen);
+  }
+  else
+  {
+    jam();
+    SectionHandle handle(this, signal);
+    SegmentedSectionPtr dataPtr;
+    handle.getSection(dataPtr, 0);
+    dataLen = dataPtr.sz;
+
+    * dst = htonl(dataLen);
+    copy(dst + 1, dataPtr);
+    releaseSections(handle);
+  }
+
   op.attrSzTotal += dataLen;
   ndbrequire(dataLen < op.maxRecordSize);
 
-  const Uint32 * src = &signal->theData[3];
-  Uint32 * dst = op.dst;
-
-  * dst = htonl(dataLen);
-  memcpy(dst + 1, src, 4*dataLen);
   op.finished(dataLen);
 
   op.newRecord(dst + dataLen + 1);
@@ -4613,6 +4630,21 @@ Backup::execFIRE_TRIG_ORD(Signal* signal
     return;
   }//if
 
+  if (isNdbMtLqh())
+  {
+    jam();
+    TablePtr tabPtr;
+    c_tablePool.getPtr(tabPtr, trigPtr.p->tab_ptr_i);
+    FragmentPtr fragPtr;
+    tabPtr.p->fragments.getPtr(fragPtr, fragId);
+    if (fragPtr.p->node != getOwnNodeId()) 
+    {
+      jam();
+      trigPtr.p->logEntry = 0;      
+      return;
+    }
+  }
+
   ndbrequire(trigPtr.p->logEntry != 0);
   Uint32 len = trigPtr.p->logEntry->Length;
   trigPtr.p->logEntry->FragId = htonl(fragId);

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2008-09-17 13:23:21 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2008-10-02 21:58:44 +0000
@@ -4277,8 +4277,9 @@ void Dbdict::handleTabInfoInit(SimplePro
     if (fragments == 0)
     {
       jam();
-      fragments = get_default_fragments();
+      tablePtr.p->fragmentCount = fragments = get_default_fragments();
     }
+
     char buf[MAX_TAB_NAME_SIZE+1];
     BaseString::snprintf(buf, sizeof(buf), "DEFAULT-HASHMAP-%u-%u",
                          NDB_DEFAULT_HASHMAP_BUCKTETS,
@@ -4858,8 +4859,7 @@ Dbdict::create_fragmentation(Signal* sig
      * and distributed in the same manner but has always a normal hash
      * fragmentation.
      */
-    frag_req->primaryTableId = tabPtr.p->primaryTableId;
-    frag_req->fragmentationType = DictTabInfo::DistrKeyUniqueHashIndex;
+    frag_req->primaryTableId = RNIL;
   }
   else
   {
@@ -15975,6 +15975,7 @@ Dbdict::createTrigger_abortPrepare(Signa
   req->triggerNo = 0;
   req->triggerId = impl_req->triggerId;
   req->triggerInfo = impl_req->triggerInfo;
+  req->receiverRef = impl_req->receiverRef;
 
   BlockReference ref = createTriggerPtr.p->m_block_list[0];
   sendSignal(ref, GSN_DROP_TRIG_IMPL_REQ, signal,
@@ -16601,6 +16602,7 @@ Dbdict::send_drop_trig_req(Signal* signa
   req->triggerNo = 0;
   req->triggerId = impl_req->triggerId;
   req->triggerInfo = impl_req->triggerInfo;
+  req->receiverRef = impl_req->receiverRef;
 
   BlockReference ref = dropTriggerPtr.p->m_block_list[0];
   sendSignal(ref, GSN_DROP_TRIG_IMPL_REQ, signal,

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2008-10-01 13:27:50 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2008-10-03 09:28:54 +0000
@@ -110,6 +110,7 @@ extern EventLogger * g_eventLogger;
   } while (specNodePtr.i != RNIL);                                      \
 }
 
+#if 0
 static
 Uint32
 oldPrevLcpNo(Uint32 lcpNo){
@@ -117,6 +118,7 @@ oldPrevLcpNo(Uint32 lcpNo){
     return MAX_LCP_STORED - 1;
   return lcpNo - 1;
 }
+#endif
 
 static
 Uint32
@@ -1222,14 +1224,12 @@ void Dbdih::execREAD_CONFIG_REQ(Signal* 
   ndbrequireErr(!ndb_mgm_get_int_parameter(p, CFG_DIH_TABLE, &ctabFileSize),
 		NDBD_EXIT_INVALID_CONFIG);
 
-  Uint32 workers = 1;
   if (isNdbMtLqh())
   {
     jam();
-    ndb_mgm_get_int_parameter(p, CFG_NDBMT_LQH_THREADS, &workers);
-    c_fragments_per_node = workers;
+    c_fragments_per_node = getLqhWorkers();
   }
-  ndbout_c("Using %u fragments per node", workers);
+  ndbout_c("Using %u fragments per node", c_fragments_per_node);
 
   cfileFileSize = (2 * ctabFileSize) + 2;
   initRecords();
@@ -6916,7 +6916,8 @@ void Dbdih::execCREATE_FRAGMENTATION_REQ
   const Uint32 flags = req->requestInfo;
 
   Uint32 err = 0;
-  const Uint32 defaultFragments = cnoOfNodeGroups * cnoReplicas;
+  const Uint32 defaultFragments = 
+    c_fragments_per_node * cnoOfNodeGroups * cnoReplicas;
 
   do {
     NodeGroupRecordPtr NGPtr;
@@ -7273,7 +7274,6 @@ void Dbdih::execDIADDTABREQ(Signal* sign
     jam();
     tabPtr.p->method = TabRecord::NORMAL_HASH;
     break;
-  case DictTabInfo::DistrKeyUniqueHashIndex:
   case DictTabInfo::DistrKeyOrderedIndex:
   {
     TabRecordPtr primTabPtr;
@@ -7340,6 +7340,9 @@ void Dbdih::execDIADDTABREQ(Signal* sign
     jam();
     tabPtr.p->m_map_ptr_i = req->hashMapPtrI;
     tabPtr.p->m_new_map_ptr_i = RNIL;
+    Ptr<Hash2FragmentMap> mapPtr;
+    g_hash_map.getPtr(mapPtr, tabPtr.p->m_map_ptr_i);
+    ndbrequire(tabPtr.p->totalfragments >= mapPtr.p->m_fragments);
   }
 
   Uint32 index = 2;
@@ -8256,11 +8259,11 @@ void Dbdih::execDIGETNODESREQ(Signal* si
   getFragstore(tabPtr.p, fragId, fragPtr);
   Uint32 nodeCount = extractNodeInfo(fragPtr.p, conf->nodes);
   Uint32 sig2 = (nodeCount - 1) + 
-    (fragPtr.p->distributionKey << 16);
+    (fragPtr.p->distributionKey << 16) + 
+    (dihGetInstanceKey(fragPtr) << 24);
   conf->zero = 0;
   conf->reqinfo = sig2;
   conf->fragId = fragId;
-  conf->instanceKey = dihGetInstanceKey(fragPtr);
 
   if (unlikely(newFragId != RNIL))
   {
@@ -8270,7 +8273,8 @@ void Dbdih::execDIGETNODESREQ(Signal* si
     nodeCount = extractNodeInfo(fragPtr.p, conf->nodes + 2 + MAX_REPLICAS);
     conf->nodes[MAX_REPLICAS] = newFragId;
     conf->nodes[MAX_REPLICAS + 1] = (nodeCount - 1) +
-      (fragPtr.p->distributionKey << 16);
+      (fragPtr.p->distributionKey << 16) +
+      (dihGetInstanceKey(fragPtr) << 24);
   }
 }//Dbdih::execDIGETNODESREQ()
 

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2008-10-01 06:53:01 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2008-10-02 21:58:44 +0000
@@ -10358,7 +10358,7 @@ Uint32 Dblqh::sendKeyinfo20(Signal* sign
    */
   const BlockReference ref = scanP->scanApiBlockref;
   const Uint32 scanOp = scanP->m_curr_batch_size_rows;
-  const Uint32 nodeId = refToNode(ref);
+  Uint32 nodeId = refToNode(ref);
   const bool connectedToNode = getNodeInfo(nodeId).m_connected;
 #ifdef NOT_USED
   const Uint32 type = getNodeInfo(nodeId).m_type;
@@ -10370,7 +10370,23 @@ Uint32 Dblqh::sendKeyinfo20(Signal* sign
   Uint32 * dst = keyInfo->keyData;
   dst += nodeId == getOwnNodeId() ? 0 : KeyInfo20::DataLength;
 
-  Uint32 keyLen = readPrimaryKeys(scanP, tcConP, dst);
+  /**
+   * This is ugly :-(
+   *  currently only SUMA receives KEYINFO20 inside kernel..
+   *  and it's not really interested in the actual keyinfo,
+   *  only the scanInfo_Node...so send only that and avoid 
+   *  messing with if's below...
+   */
+  Uint32 keyLen ;
+  if (refToMain(ref) == SUMA && nodeId == getOwnNodeId())
+  {
+    keyLen = 0;
+  }
+  else
+  {
+    keyLen = readPrimaryKeys(scanP, tcConP, dst);
+  }
+
   Uint32 fragId = tcConP->fragmentid;
   keyInfo->clientOpPtr   = scanP->scanApiOpPtr;
   keyInfo->keyLen        = keyLen;
@@ -10384,6 +10400,11 @@ Uint32 Dblqh::sendKeyinfo20(Signal* sign
   {
     jam();
     
+    if (isNdbMtLqh() && instance() != refToInstance(ref))
+    {
+      jam();
+      nodeId = 0; // prevent execute direct
+    }
     if (nodeId == getOwnNodeId())
     {
       EXECUTE_DIRECT(refToBlock(ref), GSN_KEYINFO20, signal,

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp	2008-09-16 18:33:52 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp	2008-10-02 21:58:44 +0000
@@ -32,8 +32,6 @@ DblqhProxy::DblqhProxy(Block_context& ct
 
   // GSN_LQHFRAGREQ
   addRecSignal(GSN_LQHFRAGREQ, &DblqhProxy::execLQHFRAGREQ);
-  addRecSignal(GSN_LQHFRAGCONF, &DblqhProxy::execLQHFRAGCONF);
-  addRecSignal(GSN_LQHFRAGREF, &DblqhProxy::execLQHFRAGREF);
 
   // GSN_TAB_COMMITREQ
   addRecSignal(GSN_TAB_COMMITREQ, &DblqhProxy::execTAB_COMMITREQ);
@@ -273,92 +271,17 @@ DblqhProxy::sendLQHADDATTCONF(Signal* si
   ssRelease<Ss_LQHADDATTREQ>(ssId);
 }
 
-// GSN_LQHFRAGREQ [ sub-op ]
+// GSN_LQHFRAGREQ [ pass-through ]
 
 void
 DblqhProxy::execLQHFRAGREQ(Signal* signal)
 {
-  Ss_LQHFRAGREQ& ss = ssSeize<Ss_LQHFRAGREQ>(1); // lost connection
-
-  const LqhFragReq* req = (const LqhFragReq*)signal->getDataPtr();
-  ss.m_req = *req;
-  sendREQ(signal, ss);
-}
-
-void
-DblqhProxy::sendLQHFRAGREQ(Signal* signal, Uint32 ssId)
-{
-  Ss_LQHFRAGREQ& ss = ssFind<Ss_LQHFRAGREQ>(ssId);
-
   LqhFragReq* req = (LqhFragReq*)signal->getDataPtrSend();
-  *req = ss.m_req;
-
-  NdbLogPartInfo lpinfo(workerInstance(ss.m_worker));
-  Uint32 logPartNo = lpinfo.partNoFromId(req->logPartId);
-  if (!lpinfo.partNoOwner(logPartNo)) {
-    jam();
-    skipReq(ss);
-    return;
-  }
-
-  req->senderRef = reference();
-  req->senderData = ssId;
-  sendSignal(workerRef(ss.m_worker), GSN_LQHFRAGREQ,
-             signal, LqhFragReq::SignalLength, JBB);
-}
-
-void
-DblqhProxy::execLQHFRAGCONF(Signal* signal)
-{
-  const LqhFragConf* conf = (const LqhFragConf*)signal->getDataPtr();
-  Uint32 ssId = conf->senderData;
-  Ss_LQHFRAGREQ& ss = ssFind<Ss_LQHFRAGREQ>(ssId);
-  recvCONF(signal, ss);
-}
-
-void
-DblqhProxy::execLQHFRAGREF(Signal* signal)
-{
-  const LqhFragRef* ref = (const LqhFragRef*)signal->getDataPtr();
-  Uint32 ssId = ref->senderData;
-  Ss_LQHFRAGREQ& ss = ssFind<Ss_LQHFRAGREQ>(ssId);
-  recvREF(signal, ss, ref->errorCode);
-}
-
-void
-DblqhProxy::sendLQHFRAGCONF(Signal* signal, Uint32 ssId)
-{
-  Ss_LQHFRAGREQ& ss = ssFind<Ss_LQHFRAGREQ>(ssId);
-  Ss_CREATE_TAB_REQ& ss_main = ssFind<Ss_CREATE_TAB_REQ>(ssId);
-  BlockReference dictRef = ss_main.m_req.senderRef;
-
-  if (!lastReply(ss))
-    return;
-
-  if (ss.m_error == 0) {
-    LqhFragConf* conf = (LqhFragConf*)signal->getDataPtrSend();
-    conf->senderData = ss.m_req.senderData;
-    conf->lqhFragPtr = RNIL; //wl4391_todo
-    conf->tableId = ss.m_req.tableId;
-    conf->fragId = ss.m_req.fragId;
-    conf->changeMask = 0;
-    sendSignal(dictRef, GSN_LQHFRAGCONF,
-               signal, LqhFragConf::SignalLength, JBB);
-  } else {
-    jam();
-    LqhFragRef* ref = (LqhFragRef*)signal->getDataPtrSend();
-    ref->senderData = ss.m_req.senderData;
-    ref->errorCode = ss.m_error;
-    ref->tableId = ss.m_req.tableId;
-    ref->fragId = ss.m_req.fragId;
-    ref->requestInfo = 0;
-    ref->changeMask = 0;
-    sendSignal(dictRef, GSN_LQHFRAGREF,
-               signal, LqhFragRef::SignalLength, JBB);
-    ssRelease<Ss_CREATE_TAB_REQ>(ssId);
-  }
+  Uint32 instance = getInstanceKey(req->tableId, req->fragId);
 
-  ssRelease<Ss_LQHFRAGREQ>(ssId);
+  // wl4391_todo impl. method that fakes senders block-ref
+  sendSignal(numberToRef(DBLQH, instance, getOwnNodeId()),
+             GSN_LQHFRAGREQ, signal, LqhFragReq::SignalLength, JBB);
 }
 
 // GSN_TAB_COMMITREQ

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.hpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.hpp	2008-09-16 18:33:52 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.hpp	2008-10-02 21:58:44 +0000
@@ -82,24 +82,8 @@ protected:
   void execLQHADDATTREF(Signal*);
   void sendLQHADDATTCONF(Signal*, Uint32 ssId);
 
-  // GSN_LQHFRAGREQ [ sub-op ]
-  struct Ss_LQHFRAGREQ : SsParallel {
-    LqhFragReq m_req;
-    Ss_LQHFRAGREQ() {
-      m_sendREQ = (SsFUNC)&DblqhProxy::sendLQHFRAGREQ;
-      m_sendCONF = (SsFUNC)&DblqhProxy::sendLQHFRAGCONF;
-    }
-    enum { poolSize = 1 };
-    static SsPool<Ss_LQHFRAGREQ>& pool(LocalProxy* proxy) {
-      return ((DblqhProxy*)proxy)->c_ss_LQHFRAGREQ;
-    }
-  };
-  SsPool<Ss_LQHFRAGREQ> c_ss_LQHFRAGREQ;
+  // GSN_LQHFRAGREQ [ pass-through ]
   void execLQHFRAGREQ(Signal*);
-  void sendLQHFRAGREQ(Signal*, Uint32 ssId);
-  void execLQHFRAGCONF(Signal*);
-  void execLQHFRAGREF(Signal*);
-  void sendLQHFRAGCONF(Signal*, Uint32 ssId);
 
   // GSN_TAB_COMMITREQ [ sub-op ]
   struct Ss_TAB_COMMITREQ : SsParallel {

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2008-10-01 06:36:52 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2008-10-02 21:58:44 +0000
@@ -3083,8 +3083,7 @@ void Dbtc::tckeyreq050Lab(Signal* signal
   regTcPtr->tcNodedata[2] = Tdata5;
   regTcPtr->tcNodedata[3] = Tdata6;
 
-  UintR Tdata7 = conf->instanceKey;
-  regTcPtr->lqhInstanceKey = Tdata7;
+  regTcPtr->lqhInstanceKey = (Tdata2 >> 24) & 127;// 1 bit used for reorg moving
 
   Uint8 Toperation = regTcPtr->operation;
   Uint8 Tdirty = regTcPtr->dirtyOp;

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupBuffer.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupBuffer.cpp	2008-09-16 18:29:47 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupBuffer.cpp	2008-10-02 21:58:44 +0000
@@ -250,22 +250,20 @@ void Dbtup::sendReadAttrinfo(Signal* sig
      * in LCP case since user-backup uses single worker.
      */
     BlockNumber blockMain = blockToMain(block);
+    const bool sameInstance = blockToInstance(block) == instance();
     if (blockMain == DBLQH)
     {
       EXECUTE_DIRECT(blockMain, GSN_TRANSID_AI, signal, 3 + ToutBufIndex);
       jamEntry();
     }
-    else if (blockMain == SUMA)
+    else if (blockMain == SUMA && sameInstance)
     {
-      // wl4391_todo not MT safe
-      EXECUTE_DIRECT(blockMain, GSN_TRANSID_AI, signal, 3 + ToutBufIndex, 0);
+      EXECUTE_DIRECT(blockMain, GSN_TRANSID_AI, signal, 3 + ToutBufIndex);
       jamEntry();
     }
-    else if (blockMain == BACKUP)
+    else if (blockMain == BACKUP && sameInstance)
     {
-      Uint32 iNo = blockToInstance(block);
-      // wl4391_todo maybe not MT safe in non-LCP case
-      EXECUTE_DIRECT(blockMain, GSN_TRANSID_AI, signal, 3 + ToutBufIndex, iNo);
+      EXECUTE_DIRECT(blockMain, GSN_TRANSID_AI, signal, 3 + ToutBufIndex);
       jamEntry();
     }
     else

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp	2008-09-30 15:10:29 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp	2008-10-03 08:22:13 +0000
@@ -176,7 +176,7 @@ Dbtup::dealloc_tuple(Signal* signal,
     * ptr->get_mm_gci(regTabPtr) = gci;
   }
 }
-
+#if 0
 static void dump_buf_hex(unsigned char *p, Uint32 bytes)
 {
   char buf[3001];
@@ -194,6 +194,8 @@ static void dump_buf_hex(unsigned char *
   }
   ndbout_c("%8p: %s", p, buf);
 }
+#endif
+
 void
 Dbtup::commit_operation(Signal* signal,
 			Uint32 gci,

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp	2008-04-03 12:30:16 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp	2008-10-03 08:22:13 +0000
@@ -280,6 +280,7 @@ Dbtup::setUpQueryRoutines(Tablerec *regT
   }
 }
 
+#if 0
 /* Dump a byte buffer, for debugging. */
 static void dump_buf_hex(unsigned char *p, Uint32 bytes)
 {
@@ -298,6 +299,7 @@ static void dump_buf_hex(unsigned char *
   }
   ndbout_c("%8p: %s", p, buf);
 }
+#endif
 
 static
 inline

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp	2008-09-30 15:10:29 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp	2008-10-02 17:51:17 +0000
@@ -185,6 +185,7 @@ Dbtup::execDROP_TRIG_IMPL_REQ(Signal* si
   const Uint32 senderData = req->senderData;
   const Uint32 tableId = req->tableId;
   const Uint32 triggerId = req->triggerId;
+  const Uint32 receiverRef = req->receiverRef;
 
   // Find table
   TablerecPtr tabPtr;
@@ -192,7 +193,7 @@ Dbtup::execDROP_TRIG_IMPL_REQ(Signal* si
   ptrCheckGuard(tabPtr, cnoOfTablerec, tablerec);
 
   // Drop trigger
-  Uint32 r = dropTrigger(tabPtr.p, req, refToBlock(senderRef));
+  Uint32 r = dropTrigger(tabPtr.p, req, refToBlock(receiverRef));
   if (r == 0){
     // Send conf
     DropTrigImplConf* conf = (DropTrigImplConf*)signal->getDataPtrSend();
@@ -368,7 +369,7 @@ Dbtup::primaryKey(Tablerec* const regTab
 /*                                                                  */
 /* ---------------------------------------------------------------- */
 Uint32
-Dbtup::dropTrigger(Tablerec* table, const DropTrigImplReq* req, BlockNumber sender)
+Dbtup::dropTrigger(Tablerec* table, const DropTrigImplReq* req, BlockNumber receiver)
 {
   if (ERROR_INSERTED(4004)) {
     CLEAR_ERROR_INSERT_VALUE;
@@ -420,7 +421,7 @@ Dbtup::dropTrigger(Tablerec* table, cons
       if (ptr.p->triggerId == triggerId)
       {
 	if(ttype==TriggerType::SUBSCRIPTION &&
-	   sender != refToBlock(ptr.p->m_receiverRef))
+	   receiver != refToBlock(ptr.p->m_receiverRef))
 	{
 	  /**
 	   * You can only drop your own triggers for subscription triggers.
@@ -886,8 +887,14 @@ void Dbtup::executeTrigger(KeyReqStruct 
   ptrCheckGuard(regFragPtr, cnoOfFragrec, fragrecord);
   Fragrecord::FragState fragstatus = regFragPtr.p->fragStatus;
 
-  if (refToMain(ref) == BACKUP) {
+  if (refToMain(ref) == BACKUP)
+  {
     jam();
+    if (isNdbMtLqh())
+    {
+      goto out;
+    }
+
     /*
     In order for the implementation of BACKUP to work even when changing
     primaries in the middle of the backup we need to set the trigger on
@@ -905,6 +912,8 @@ void Dbtup::executeTrigger(KeyReqStruct 
       jam();
       return;
     }
+out:
+    (void)1;
   }
   else if (unlikely(triggerType == TriggerType::REORG_TRIGGER))
   {
@@ -1294,10 +1303,15 @@ void Dbtup::sendFireTrigOrd(Signal* sign
     // Since only backup uses subscription triggers we 
     // send to backup directly for now
     fireTrigOrd->setGCI(req_struct->gci_hi);
-    EXECUTE_DIRECT(refToMain(trigPtr->m_receiverRef),
-                   GSN_FIRE_TRIG_ORD,
-                   signal,
-		   FireTrigOrd::SignalWithGCILength);
+
+    if (refToInstance(trigPtr->m_receiverRef) == instance())
+      EXECUTE_DIRECT(refToMain(trigPtr->m_receiverRef),
+                     GSN_FIRE_TRIG_ORD,
+                     signal,
+                     FireTrigOrd::SignalWithGCILength);
+    else
+      sendSignal(trigPtr->m_receiverRef, GSN_FIRE_TRIG_ORD,
+                 signal, FireTrigOrd::SignalWithGCILength, JBB);
     break;
   default:
     ndbrequire(false);

=== modified file 'storage/ndb/src/kernel/blocks/suma/Suma.cpp'
--- a/storage/ndb/src/kernel/blocks/suma/Suma.cpp	2008-09-17 13:23:21 +0000
+++ b/storage/ndb/src/kernel/blocks/suma/Suma.cpp	2008-10-03 08:22:13 +0000
@@ -2892,7 +2892,8 @@ Suma::drop_triggers(Signal* signal, Subs
         req->indexId = RNIL;
         req->indexVersion = 0;
         req->triggerId = triggerId;
-        
+        req->receiverRef = SUMA_REF;
+
         sendSignal(DBTUP_REF, GSN_DROP_TRIG_IMPL_REQ,
                    signal, DropTrigImplReq::SignalLength, JBB);
       }
@@ -3414,7 +3415,7 @@ Suma::execTRANSID_AI(Signal* signal)
   CRASH_INSERTION(13015);
   TransIdAI * const data = (TransIdAI*)signal->getDataPtr();
   const Uint32 opPtrI = data->connectPtr;
-  const Uint32 length = signal->length() - 3;
+  Uint32 length = signal->length() - 3;
 
   if(f_bufferLock == 0){
     f_bufferLock = opPtrI;
@@ -3422,6 +3423,16 @@ Suma::execTRANSID_AI(Signal* signal)
     ndbrequire(f_bufferLock == opPtrI);
   }
   
+  if (signal->getNoOfSections())
+  {
+    SectionHandle handle(this, signal);
+    SegmentedSectionPtr dataPtr;
+    handle.getSection(dataPtr, 0);
+    length = dataPtr.sz;
+    copy(data->attrData, dataPtr);
+    releaseSections(handle);
+  }
+
   Ptr<SyncRecord> syncPtr;
   c_syncPool.getPtr(syncPtr, (opPtrI >> 16));
   
@@ -5622,7 +5633,7 @@ Suma::execCREATE_NODEGROUP_IMPL_REQ(Sign
   }
   return;
 
-error:
+//error:
   CreateNodegroupImplRef *ref =
     (CreateNodegroupImplRef*)signal->getDataPtrSend();
   ref->senderRef = reference();
@@ -5699,7 +5710,7 @@ Suma::execDROP_NODEGROUP_IMPL_REQ(Signal
   }
   return;
 
-error:
+//error:
   DropNodegroupImplRef *ref =
     (DropNodegroupImplRef*)signal->getDataPtrSend();
   ref->senderRef = reference();

=== modified file 'storage/ndb/src/mgmsrv/Services.cpp'
--- a/storage/ndb/src/mgmsrv/Services.cpp	2008-09-17 13:23:21 +0000
+++ b/storage/ndb/src/mgmsrv/Services.cpp	2008-10-03 08:22:13 +0000
@@ -1836,7 +1836,7 @@ MgmApiSession::drop_nodegroup(Parser_t::
     result.assfmt("error: %d", res);
   }
 
-end:
+//end:
   m_output->println("drop nodegroup reply");
   m_output->println("result: %s", result.c_str());
   m_output->println("");

=== modified file 'storage/ndb/src/mgmsrv/main.cpp'
--- a/storage/ndb/src/mgmsrv/main.cpp	2008-08-21 06:33:18 +0000
+++ b/storage/ndb/src/mgmsrv/main.cpp	2008-10-03 08:22:13 +0000
@@ -83,9 +83,6 @@ bool g_RestartServer= false;
 static MgmtSrvr* mgm;
 static MgmtSrvr::MgmtOpts opts;
 
-static int opt_daemon;
-static int opt_non_interactive;
-
 static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS("ndb_mgmd"),

=== modified file 'storage/ndb/test/ndbapi/bench/asyncGenerator.cpp'
--- a/storage/ndb/test/ndbapi/bench/asyncGenerator.cpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/test/ndbapi/bench/asyncGenerator.cpp	2008-10-02 18:08:43 +0000
@@ -39,7 +39,7 @@
 static void getRandomSubscriberNumber(SubscriberNumber number);
 static void getRandomServerId(ServerId *serverId);
 static void getRandomChangedBy(ChangedBy changedBy);
-static void getRandomChangedTime(ChangedTime changedTime);
+//static void getRandomChangedTime(ChangedTime changedTime);
 
 static void clearTransaction(TransactionDefinition *trans);
 static void initGeneratorStatistics(GeneratorStatistics *gen);
@@ -74,7 +74,7 @@ static SequenceValues rollbackDefinition
    {0,  0}
 };
 
-static int maxsize = 0;
+static unsigned maxsize = 0;
 
 /***************************************************************
 * P U B L I C   D A T A                                        *
@@ -106,11 +106,13 @@ static void getRandomChangedBy(ChangedBy
    changedBy[CHANGED_BY_LENGTH] = 0;
 }
 
+#if 0
 static void getRandomChangedTime(ChangedTime changedTime)
 {
    memset(changedTime, myRandom48(26)+'A', CHANGED_TIME_LENGTH);
    changedTime[CHANGED_TIME_LENGTH] = 0;
 }
+#endif
 
 static void clearTransaction(TransactionDefinition *trans)
 {

=== modified file 'storage/ndb/test/ndbapi/bench/dbPopulate.cpp'
--- a/storage/ndb/test/ndbapi/bench/dbPopulate.cpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/test/ndbapi/bench/dbPopulate.cpp	2008-10-02 18:08:43 +0000
@@ -41,7 +41,7 @@ static void getRandomSubscriberData(int 
 		                    SubscriberNumber number,
 		                    SubscriberName   name);
 
-static void populate(char *title,
+static void populate(const char *title,
                      int   count,
                      void (*func)(UserHandle*,int),
                      UserHandle *uh);
@@ -82,7 +82,7 @@ static void getRandomSubscriberData(int 
    memset(name, myRandom48(26)+'A', SUBSCRIBER_NAME_LENGTH);
 }
 
-static void populate(char *title,
+static void populate(const char *title,
                      int   count,
                      void (*func)(UserHandle*, int),
                      UserHandle *uh)

=== modified file 'storage/ndb/test/ndbapi/bench/mainPopulate.cpp'
--- a/storage/ndb/test/ndbapi/bench/mainPopulate.cpp	2008-08-21 14:38:31 +0000
+++ b/storage/ndb/test/ndbapi/bench/mainPopulate.cpp	2008-10-02 18:08:43 +0000
@@ -32,10 +32,6 @@ int useTableLogging;
 #endif
 
 
-static void usage()
-{
-}
-
 static 
 void usage(const char *prog)
 {

=== modified file 'storage/ndb/test/ndbapi/bench/testData.h'
--- a/storage/ndb/test/ndbapi/bench/testData.h	2008-09-30 08:18:41 +0000
+++ b/storage/ndb/test/ndbapi/bench/testData.h	2008-10-02 18:08:43 +0000
@@ -121,13 +121,13 @@ typedef struct {
 } TransactionData ;
 
 typedef struct {
-  const struct NdbRecord* subscriberTableNdbRecord;
-  const struct NdbRecord* groupTableNdbRecord;
-  const struct NdbRecord* sessionTableNdbRecord;
-  const struct NdbInterpretedCode* incrServerReadsProg;
-  const struct NdbInterpretedCode* incrServerInsertsProg;
-  const struct NdbInterpretedCode* incrServerDeletesProg;
-  const struct NdbRecord* serverTableNdbRecord;
+  const class NdbRecord* subscriberTableNdbRecord;
+  const class NdbRecord* groupTableNdbRecord;
+  const class NdbRecord* sessionTableNdbRecord;
+  const class NdbInterpretedCode* incrServerReadsProg;
+  const class NdbInterpretedCode* incrServerInsertsProg;
+  const class NdbInterpretedCode* incrServerDeletesProg;
+  const class NdbRecord* serverTableNdbRecord;
 } NdbRecordSharedData ;
 
 typedef struct {
@@ -148,7 +148,7 @@ typedef struct {
   RunState              runState;
   double                startTime;
   TransactionData       transactionData;
-  struct Ndb            * pNDB;
+  class Ndb           * pNDB;
   NdbRecordSharedData*  ndbRecordSharedData;
   bool                  useCombinedUpdate;
 } ThreadData;

=== modified file 'storage/ndb/test/ndbapi/bench/userInterface.cpp'
--- a/storage/ndb/test/ndbapi/bench/userInterface.cpp	2008-08-21 05:06:43 +0000
+++ b/storage/ndb/test/ndbapi/bench/userInterface.cpp	2008-10-02 18:08:43 +0000
@@ -46,7 +46,7 @@
 
 extern int localDbPrepare(UserHandle *uh);
 
-static int dbCreate(UserHandle *uh);
+//static int dbCreate(UserHandle *uh);
 
 /***************************************************************
 * L O C A L   D A T A                                          *
@@ -106,7 +106,7 @@ double userGetTimeSync(void)
 int 
 userDbCommit(UserHandle *uh){
   if(uh->pCurrTrans != 0){
-    int check = uh->pCurrTrans->execute( Commit ); 
+    /* int check = */ uh->pCurrTrans->execute( Commit ); 
     NdbError err = uh->pCurrTrans->getNdbError();
     uh->pNDB->closeTransaction(uh->pCurrTrans);
     uh->pCurrTrans = 0;
@@ -560,7 +560,7 @@ static int dbCreate(Ndb * pNdb)
 #endif
 
 UserHandle*
-userDbConnect(uint32 createDb, char *dbName)
+userDbConnect(uint32 createDb, const char *dbName)
 {
   Ndb_cluster_connection *con= new Ndb_cluster_connection();
   if(con->connect(12, 5, 1) != 0)

=== modified file 'storage/ndb/test/ndbapi/bench/userInterface.h'
--- a/storage/ndb/test/ndbapi/bench/userInterface.h	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/test/ndbapi/bench/userInterface.h	2008-10-02 18:08:43 +0000
@@ -44,7 +44,7 @@
 * P U B L I C    F U N C T I O N S                             *
 ***************************************************************/
 
-typedef struct Ndb Ndb;
+class Ndb;
 
 #ifdef __cplusplus
 extern "C" {
@@ -98,9 +98,9 @@ extern "C" {
 ***************************************************************/
 
 typedef struct {
-  struct Ndb_cluster_connection* pNCC;
-  struct Ndb           * pNDB;
-  struct NdbTransaction * pCurrTrans;
+  class Ndb_cluster_connection* pNCC;
+  class Ndb           * pNDB;
+  class NdbTransaction * pCurrTrans;
 } UserHandle;
 
 /***************************************************************
@@ -115,7 +115,7 @@ extern double userGetTimeSync(void);
 
 extern void userCheckpoint(UserHandle *uh);
 
-extern UserHandle *userDbConnect(uint32 createDb, char *dbName);
+extern UserHandle *userDbConnect(uint32 createDb, const char *dbName);
 extern void        userDbDisconnect(UserHandle *uh);
 
 extern int userDbInsertServer(UserHandle      *uh,

Thread
bzr commit into mysql-5.1 branch (stewart:2878) Stewart Smith3 Oct