List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:April 27 2011 11:50am
Subject:bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (jonas:3484 to
3485)
View as plain text  
 3485 Jonas Oreland	2011-04-27 [merge]
      ndb - merge 70 to 70-spj

    added:
      storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.cpp
      storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.hpp
    modified:
      storage/ndb/include/kernel/signaldata/PrepDropTab.hpp
      storage/ndb/include/ndbapi/Ndb.hpp
      storage/ndb/include/ndbapi/NdbTransaction.hpp
      storage/ndb/src/kernel/blocks/CMakeLists.txt
      storage/ndb/src/kernel/blocks/LocalProxy.cpp
      storage/ndb/src/kernel/blocks/Makefile.am
      storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
      storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
      storage/ndb/src/ndbapi/Ndb.cpp
      storage/ndb/src/ndbapi/NdbApiSignal.cpp
      storage/ndb/src/ndbapi/NdbOperation.cpp
      storage/ndb/src/ndbapi/NdbOperationDefine.cpp
      storage/ndb/src/ndbapi/NdbOperationSearch.cpp
      storage/ndb/src/ndbapi/NdbQueryOperation.cpp
      storage/ndb/src/ndbapi/NdbScanOperation.cpp
      storage/ndb/src/ndbapi/NdbTransaction.cpp
      storage/ndb/src/ndbapi/Ndbif.cpp
      storage/ndb/src/ndbapi/Ndblist.cpp
 3484 Ole John Aske	2011-04-27
      Fixed yet another 'Unused variable' compiler warning ....

    modified:
      sql/ha_ndbcluster_push.cc
=== modified file 'storage/ndb/include/kernel/signaldata/PrepDropTab.hpp'
--- a/storage/ndb/include/kernel/signaldata/PrepDropTab.hpp	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/include/kernel/signaldata/PrepDropTab.hpp	2011-04-27 10:48:16 +0000
@@ -34,6 +34,7 @@ class PrepDropTabReq {
   friend class Dblqh;
   friend class DblqhProxy;
   friend class Dbdih;
+  friend class DbtcProxy;
 
   friend bool printPREP_DROP_TAB_REQ(FILE *, const Uint32 *, Uint32, Uint16);
 public:
@@ -54,6 +55,7 @@ class PrepDropTabConf {
   friend class Dblqh;
   friend class DblqhProxy;
   friend class Dbdih;
+  friend class DbtcProxy;
 
   /**
    * Receiver(s)
@@ -78,6 +80,7 @@ class PrepDropTabRef {
   friend class Dblqh;
   friend class DblqhProxy;
   friend class Dbdih;
+  friend class DbtcProxy;
 
   /**
    * Receiver(s)

=== modified file 'storage/ndb/include/ndbapi/Ndb.hpp'
--- a/storage/ndb/include/ndbapi/Ndb.hpp	2011-04-17 18:25:41 +0000
+++ b/storage/ndb/include/ndbapi/Ndb.hpp	2011-04-27 11:50:17 +0000
@@ -1824,11 +1824,12 @@ private:
   void connected(Uint32 block_reference);
  
 
-  NdbTransaction*  startTransactionLocal(Uint32 aPrio, Uint32 aFragmentId); 
+  NdbTransaction*  startTransactionLocal(Uint32 aPrio, Uint32 aNode,
+                                         Uint32 instance);
 
 // Connect the connection object to the Database.
-  int NDB_connect(Uint32 tNode);
-  NdbTransaction* doConnect(Uint32 nodeId); 
+  int NDB_connect(Uint32 tNode, Uint32 instance);
+  NdbTransaction* doConnect(Uint32 nodeId, Uint32 instance);
   void    doDisconnect();	 
   
   NdbReceiver*	        getNdbScanRec();// Get a NdbScanReceiver from idle list
@@ -1906,7 +1907,7 @@ private:
    * Get a connected NdbTransaction to nodeId
    *   Returns NULL if none found
    */
-  NdbTransaction* getConnectedNdbTransaction(Uint32 nodeId);
+  NdbTransaction* getConnectedNdbTransaction(Uint32 nodeId, Uint32 instance);
 
   // Release and disconnect from DBTC a connection
   // and seize it to theConIdleList

=== modified file 'storage/ndb/include/ndbapi/NdbTransaction.hpp'
--- a/storage/ndb/include/ndbapi/NdbTransaction.hpp	2011-04-10 17:32:41 +0000
+++ b/storage/ndb/include/ndbapi/NdbTransaction.hpp	2011-04-27 11:50:17 +0000
@@ -1208,6 +1208,8 @@ private:						
   // (Only one of theScanningOp/m_scanningQuery be non-NULL,
   //  which indirectly indicates the type)
   NdbQueryImpl* m_scanningQuery;
+
+  Uint32 m_tcRef;
 };
 
 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL

=== modified file 'storage/ndb/src/kernel/blocks/CMakeLists.txt'
--- a/storage/ndb/src/kernel/blocks/CMakeLists.txt	2011-02-24 07:39:24 +0000
+++ b/storage/ndb/src/kernel/blocks/CMakeLists.txt	2011-04-27 11:50:17 +0000
@@ -67,6 +67,7 @@ ADD_LIBRARY(ndbblocks STATIC
     dbtux/DbtuxProxy.cpp
     backup/BackupProxy.cpp
     RestoreProxy.cpp
+    dbtc/DbtcProxy.cpp
     dbinfo/Dbinfo.cpp
     dblqh/DblqhCommon.cpp
     PgmanProxy.cpp

=== modified file 'storage/ndb/src/kernel/blocks/LocalProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/LocalProxy.cpp	2011-02-02 00:40:07 +0000
+++ b/storage/ndb/src/kernel/blocks/LocalProxy.cpp	2011-04-27 10:48:16 +0000
@@ -848,8 +848,6 @@ LocalProxy::execTIME_SIGNAL(Signal* sign
 {
   Ss_TIME_SIGNAL& ss = ssSeize<Ss_TIME_SIGNAL>();
 
-  // could use same for MT TC
-  ndbrequire(number() == DBLQH);
   sendREQ(signal, ss);
   ssRelease<Ss_TIME_SIGNAL>(ss);
 }

=== modified file 'storage/ndb/src/kernel/blocks/Makefile.am'
--- a/storage/ndb/src/kernel/blocks/Makefile.am	2011-02-24 07:39:24 +0000
+++ b/storage/ndb/src/kernel/blocks/Makefile.am	2011-04-27 11:50:17 +0000
@@ -67,7 +67,8 @@ libblocks_a_SOURCES = tsman.cpp lgman.cp
   dbinfo/Dbinfo.cpp \
   dblqh/DblqhCommon.cpp \
   PgmanProxy.cpp \
-  dbtup/DbtupClient.cpp
+  dbtup/DbtupClient.cpp \
+  dbtc/DbtcProxy.cpp
 
 ndbtools_PROGRAMS = ndb_print_file
 ndb_print_file_SOURCES = print_file.cpp diskpage.cpp dbtup/tuppage.cpp

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2011-04-27 08:39:36 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2011-04-27 11:50:17 +0000
@@ -3690,6 +3690,16 @@ void Dblqh::sendCompleteLqh(Signal* sign
 
 void Dblqh::sendCommittedTc(Signal* signal, BlockReference atcBlockref)
 {
+  if (refToInstance(atcBlockref))
+  {
+    jam();
+    signal->theData[0] = tcConnectptr.p->clientConnectrec;
+    signal->theData[1] = tcConnectptr.p->transid[0];
+    signal->theData[2] = tcConnectptr.p->transid[1];
+    sendSignal(atcBlockref, GSN_COMMITTED, signal, 3, JBB);
+    return;
+  }
+
   HostRecordPtr Thostptr;
   Thostptr.i = refToNode(atcBlockref);
   ptrCheckGuard(Thostptr, chostFileSize, hostRecord);
@@ -3726,6 +3736,16 @@ void Dblqh::sendCommittedTc(Signal* sign
 
 void Dblqh::sendCompletedTc(Signal* signal, BlockReference atcBlockref)
 {
+  if (refToInstance(atcBlockref))
+  {
+    jam();
+    signal->theData[0] = tcConnectptr.p->clientConnectrec;
+    signal->theData[1] = tcConnectptr.p->transid[0];
+    signal->theData[2] = tcConnectptr.p->transid[1];
+    sendSignal(atcBlockref, GSN_COMPLETED, signal, 3, JBB);
+    return;
+  }
+
   HostRecordPtr Thostptr;
   Thostptr.i = refToNode(atcBlockref);
   ptrCheckGuard(Thostptr, chostFileSize, hostRecord);
@@ -4617,8 +4637,16 @@ void Dblqh::execLQHKEYREQ(Signal* signal
   /* Only node restart copy allowed to send no KeyInfo */
   if (unlikely(keyLenWithLQHReq == 0))
   {
-    if (! (LqhKeyReq::getNrCopyFlag(Treqinfo)) &&
-        refToMain(senderRef) != DBSPJ)
+    if (refToMain(senderRef) == DBSPJ)
+    {
+      jam();
+      ndbassert(! LqhKeyReq::getNrCopyFlag(Treqinfo));
+      terrorCode = ZNO_TUPLE_FOUND;
+      abortErrorLab(signal);
+      return;
+    }
+
+    if (! LqhKeyReq::getNrCopyFlag(Treqinfo))
     {
       LQHKEY_error(signal, 3);
       return;

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2011-04-10 17:32:41 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2011-04-27 11:50:17 +0000
@@ -1199,6 +1199,11 @@ void Dbtc::execTCSEIZEREQ(Signal* signal
   jamEntry();
   tapiPointer = signal->theData[0]; /* REQUEST SENDERS CONNECT RECORD POINTER*/
   tapiBlockref = signal->theData[1]; /* SENDERS BLOCK REFERENCE*/
+
+  if (signal->getLength() > 2)
+  {
+    ndbassert(instance() == signal->theData[2]);
+  }
   
   const NodeState::StartLevel sl = 
     (NodeState::StartLevel)getNodeState().startLevel;

=== added file 'storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.cpp	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.cpp	2011-04-27 10:48:16 +0000
@@ -0,0 +1,925 @@
+/*
+   Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+
+#include "DbtcProxy.hpp"
+#include "Dbtc.hpp"
+
+DbtcProxy::DbtcProxy(Block_context& ctx) :
+  LocalProxy(DBTC, ctx)
+{
+  // GSN_TC_SCHVERREQ
+  addRecSignal(GSN_TC_SCHVERREQ, &DbtcProxy::execTC_SCHVERREQ);
+  addRecSignal(GSN_TC_SCHVERCONF, &DbtcProxy::execTC_SCHVERCONF);
+
+  // GSN_TAB_COMMITREQ
+  addRecSignal(GSN_TAB_COMMITREQ, &DbtcProxy::execTAB_COMMITREQ);
+  addRecSignal(GSN_TAB_COMMITCONF, &DbtcProxy::execTAB_COMMITCONF);
+  addRecSignal(GSN_TAB_COMMITREF, &DbtcProxy::execTAB_COMMITREF);
+
+  // GSN_TCSEIZEREQ
+  addRecSignal(GSN_TCSEIZEREQ, &DbtcProxy::execTCSEIZEREQ);
+
+  // GSN_TCGETOPSIZEREQ
+  addRecSignal(GSN_TCGETOPSIZEREQ, &DbtcProxy::execTCGETOPSIZEREQ);
+  addRecSignal(GSN_TCGETOPSIZECONF, &DbtcProxy::execTCGETOPSIZECONF);
+
+  // GSN_TCGETOPSIZEREQ
+  addRecSignal(GSN_TC_CLOPSIZEREQ, &DbtcProxy::execTC_CLOPSIZEREQ);
+  addRecSignal(GSN_TC_CLOPSIZECONF, &DbtcProxy::execTC_CLOPSIZECONF);
+
+  // GSN_GCP_NOMORETRANS
+  addRecSignal(GSN_GCP_NOMORETRANS, &DbtcProxy::execGCP_NOMORETRANS);
+  addRecSignal(GSN_GCP_TCFINISHED, &DbtcProxy::execGCP_TCFINISHED);
+
+  // GSN_API_FAILREQ
+  addRecSignal(GSN_API_FAILREQ, &DbtcProxy::execAPI_FAILREQ);
+  addRecSignal(GSN_API_FAILCONF, &DbtcProxy::execAPI_FAILCONF);
+
+  // GSN_PREP_DROP_TAB_REQ
+  addRecSignal(GSN_PREP_DROP_TAB_REQ, &DbtcProxy::execPREP_DROP_TAB_REQ);
+  addRecSignal(GSN_PREP_DROP_TAB_CONF, &DbtcProxy::execPREP_DROP_TAB_CONF);
+  addRecSignal(GSN_PREP_DROP_TAB_REF, &DbtcProxy::execPREP_DROP_TAB_REF);
+
+  // GSN_DROP_TAB_REQ
+  addRecSignal(GSN_DROP_TAB_REQ, &DbtcProxy::execDROP_TAB_REQ);
+  addRecSignal(GSN_DROP_TAB_CONF, &DbtcProxy::execDROP_TAB_CONF);
+  addRecSignal(GSN_DROP_TAB_REF, &DbtcProxy::execDROP_TAB_REF);
+
+  // GSN_ALTER_TAB_REQ
+  addRecSignal(GSN_ALTER_TAB_REQ, &DbtcProxy::execALTER_TAB_REQ);
+  addRecSignal(GSN_ALTER_TAB_CONF, &DbtcProxy::execALTER_TAB_CONF);
+  addRecSignal(GSN_ALTER_TAB_REF, &DbtcProxy::execALTER_TAB_REF);
+
+  // GSN_CREATE_INDX_IMPL_REQ
+  addRecSignal(GSN_CREATE_INDX_IMPL_REQ, &DbtcProxy::execCREATE_INDX_IMPL_REQ);
+  addRecSignal(GSN_CREATE_INDX_IMPL_CONF,&DbtcProxy::execCREATE_INDX_IMPL_CONF);
+  addRecSignal(GSN_CREATE_INDX_IMPL_REF, &DbtcProxy::execCREATE_INDX_IMPL_REF);
+
+  // GSN_ALTER_INDX_IMPL_REQ
+  addRecSignal(GSN_ALTER_INDX_IMPL_REQ, &DbtcProxy::execALTER_INDX_IMPL_REQ);
+  addRecSignal(GSN_ALTER_INDX_IMPL_CONF,&DbtcProxy::execALTER_INDX_IMPL_CONF);
+  addRecSignal(GSN_ALTER_INDX_IMPL_REF, &DbtcProxy::execALTER_INDX_IMPL_REF);
+
+  // GSN_DROP_INDX_IMPL_REQ
+  addRecSignal(GSN_DROP_INDX_IMPL_REQ, &DbtcProxy::execDROP_INDX_IMPL_REQ);
+  addRecSignal(GSN_DROP_INDX_IMPL_CONF,&DbtcProxy::execDROP_INDX_IMPL_CONF);
+  addRecSignal(GSN_DROP_INDX_IMPL_REF, &DbtcProxy::execDROP_INDX_IMPL_REF);
+
+  m_tc_seize_req_instance = 0;
+}
+
+DbtcProxy::~DbtcProxy()
+{
+}
+
+SimulatedBlock*
+DbtcProxy::newWorker(Uint32 instanceNo)
+{
+  return new Dbtc(m_ctx, instanceNo);
+}
+
+// GSN_NDB_STTOR
+
+void
+DbtcProxy::callNDB_STTOR(Signal* signal)
+{
+  Ss_READ_NODES_REQ& ss = c_ss_READ_NODESREQ;
+  ndbrequire(ss.m_gsn == 0);
+
+  const Uint32 startPhase = signal->theData[2];
+  switch (startPhase) {
+  case 3:
+    ss.m_gsn = GSN_NDB_STTOR;
+    sendREAD_NODESREQ(signal);
+    break;
+  default:
+    backNDB_STTOR(signal);
+    break;
+  }
+}
+
+// GSN_TC_SCHVERREQ
+
+void
+DbtcProxy::execTC_SCHVERREQ(Signal* signal)
+{
+  Ss_TC_SCHVERREQ& ss = ssSeize<Ss_TC_SCHVERREQ>(1);
+
+  const TcSchVerReq* req = (const TcSchVerReq*)signal->getDataPtr();
+  ss.m_req = *req;
+
+  sendREQ(signal, ss);
+}
+
+void
+DbtcProxy::sendTC_SCHVERREQ(Signal* signal, Uint32 ssId, SectionHandle*)
+{
+  Ss_TC_SCHVERREQ& ss = ssFind<Ss_TC_SCHVERREQ>(ssId);
+
+  TcSchVerReq* req = (TcSchVerReq*)signal->getDataPtrSend();
+  *req = ss.m_req;
+  req->senderRef = reference();
+  req->senderData = ssId;
+  sendSignal(workerRef(ss.m_worker), GSN_TC_SCHVERREQ,
+             signal, TcSchVerReq::SignalLength, JBB);
+}
+
+void
+DbtcProxy::execTC_SCHVERCONF(Signal* signal)
+{
+  const TcSchVerConf* conf = (const TcSchVerConf*)signal->getDataPtr();
+  Uint32 ssId = conf->senderData;
+  Ss_TC_SCHVERREQ& ss = ssFind<Ss_TC_SCHVERREQ>(ssId);
+  recvCONF(signal, ss);
+}
+
+void
+DbtcProxy::sendTC_SCHVERCONF(Signal* signal, Uint32 ssId)
+{
+  Ss_TC_SCHVERREQ& ss = ssFind<Ss_TC_SCHVERREQ>(ssId);
+  BlockReference dictRef = ss.m_req.senderRef;
+
+  if (!lastReply(ss))
+    return;
+
+  TcSchVerConf* conf = (TcSchVerConf*)signal->getDataPtrSend();
+  conf->senderRef = reference();
+  conf->senderData = ss.m_req.senderData;
+  sendSignal(dictRef, GSN_TC_SCHVERCONF,
+             signal, TcSchVerConf::SignalLength, JBB);
+
+  ssRelease<Ss_TC_SCHVERREQ>(ssId);
+}
+
+// GSN_TAB_COMMITREQ [ sub-op ]
+
+void
+DbtcProxy::execTAB_COMMITREQ(Signal* signal)
+{
+  Ss_TAB_COMMITREQ& ss = ssSeize<Ss_TAB_COMMITREQ>(1); // lost connection
+
+  const TabCommitReq* req = (const TabCommitReq*)signal->getDataPtr();
+  ss.m_req = *req;
+  sendREQ(signal, ss);
+}
+
+void
+DbtcProxy::sendTAB_COMMITREQ(Signal* signal, Uint32 ssId, SectionHandle*)
+{
+  Ss_TAB_COMMITREQ& ss = ssFind<Ss_TAB_COMMITREQ>(ssId);
+
+  TabCommitReq* req = (TabCommitReq*)signal->getDataPtrSend();
+  req->senderRef = reference();
+  req->senderData = ssId;
+  req->tableId = ss.m_req.tableId;
+  sendSignal(workerRef(ss.m_worker), GSN_TAB_COMMITREQ,
+             signal, TabCommitReq::SignalLength, JBB);
+}
+
+void
+DbtcProxy::execTAB_COMMITCONF(Signal* signal)
+{
+  const TabCommitConf* conf = (TabCommitConf*)signal->getDataPtr();
+  Uint32 ssId = conf->senderData;
+  Ss_TAB_COMMITREQ& ss = ssFind<Ss_TAB_COMMITREQ>(ssId);
+  recvCONF(signal, ss);
+}
+
+void
+DbtcProxy::execTAB_COMMITREF(Signal* signal)
+{
+  const TabCommitRef* ref = (TabCommitRef*)signal->getDataPtr();
+  Uint32 ssId = ref->senderData;
+  Ss_TAB_COMMITREQ& ss = ssFind<Ss_TAB_COMMITREQ>(ssId);
+
+  recvREF(signal, ss, ref->errorCode);
+}
+
+void
+DbtcProxy::sendTAB_COMMITCONF(Signal* signal, Uint32 ssId)
+{
+  Ss_TAB_COMMITREQ& ss = ssFind<Ss_TAB_COMMITREQ>(ssId);
+  BlockReference dictRef = ss.m_req.senderRef;
+
+  if (!lastReply(ss))
+    return;
+
+  if (ss.m_error == 0) {
+    jam();
+    TabCommitConf* conf = (TabCommitConf*)signal->getDataPtrSend();
+    conf->senderData = ss.m_req.senderData;
+    conf->nodeId = getOwnNodeId();
+    conf->tableId = ss.m_req.tableId;
+    sendSignal(dictRef, GSN_TAB_COMMITCONF,
+               signal, TabCommitConf::SignalLength, JBB);
+  } else {
+    jam();
+    TabCommitRef* ref = (TabCommitRef*)signal->getDataPtrSend();
+    ref->senderData = ss.m_req.senderData;
+    ref->nodeId = getOwnNodeId();
+    ref->tableId = ss.m_req.tableId;
+    sendSignal(dictRef, GSN_TAB_COMMITREF,
+               signal, TabCommitRef::SignalLength, JBB);
+    return;
+  }
+
+  ssRelease<Ss_TAB_COMMITREQ>(ssId);
+}
+
+// GSN_PREP_DROP_TAB_REQ
+
+void
+DbtcProxy::execPREP_DROP_TAB_REQ(Signal* signal)
+{
+  const PrepDropTabReq* req = (const PrepDropTabReq*)signal->getDataPtr();
+  Uint32 ssId = getSsId(req);
+  Ss_PREP_DROP_TAB_REQ& ss = ssSeize<Ss_PREP_DROP_TAB_REQ>(ssId);
+  ss.m_req = *req;
+  ndbrequire(signal->getLength() == PrepDropTabReq::SignalLength);
+  sendREQ(signal, ss);
+}
+
+void
+DbtcProxy::sendPREP_DROP_TAB_REQ(Signal* signal, Uint32 ssId, SectionHandle*)
+{
+  Ss_PREP_DROP_TAB_REQ& ss = ssFind<Ss_PREP_DROP_TAB_REQ>(ssId);
+
+  PrepDropTabReq* req = (PrepDropTabReq*)signal->getDataPtrSend();
+  *req = ss.m_req;
+  req->senderRef = reference();
+  req->senderData = ssId; // redundant since tableId is used
+  sendSignal(workerRef(ss.m_worker), GSN_PREP_DROP_TAB_REQ,
+             signal, PrepDropTabReq::SignalLength, JBB);
+}
+
+void
+DbtcProxy::execPREP_DROP_TAB_CONF(Signal* signal)
+{
+  const PrepDropTabConf* conf = (const PrepDropTabConf*)signal->getDataPtr();
+  Uint32 ssId = getSsId(conf);
+  Ss_PREP_DROP_TAB_REQ& ss = ssFind<Ss_PREP_DROP_TAB_REQ>(ssId);
+  recvCONF(signal, ss);
+}
+
+void
+DbtcProxy::execPREP_DROP_TAB_REF(Signal* signal)
+{
+  const PrepDropTabRef* ref = (const PrepDropTabRef*)signal->getDataPtr();
+  Uint32 ssId = getSsId(ref);
+  Ss_PREP_DROP_TAB_REQ& ss = ssFind<Ss_PREP_DROP_TAB_REQ>(ssId);
+  recvREF(signal, ss, ref->errorCode);
+}
+
+void
+DbtcProxy::sendPREP_DROP_TAB_CONF(Signal* signal, Uint32 ssId)
+{
+  Ss_PREP_DROP_TAB_REQ& ss = ssFind<Ss_PREP_DROP_TAB_REQ>(ssId);
+  BlockReference dictRef = ss.m_req.senderRef;
+
+  if (!lastReply(ss))
+    return;
+
+  if (ss.m_error == 0) {
+    jam();
+    PrepDropTabConf* conf = (PrepDropTabConf*)signal->getDataPtrSend();
+    conf->senderRef = reference();
+    conf->senderData = ss.m_req.senderData;
+    conf->tableId = ss.m_req.tableId;
+    sendSignal(dictRef, GSN_PREP_DROP_TAB_CONF,
+               signal, PrepDropTabConf::SignalLength, JBB);
+  } else {
+    jam();
+    PrepDropTabRef* ref = (PrepDropTabRef*)signal->getDataPtrSend();
+    ref->senderRef = reference();
+    ref->senderData = ss.m_req.senderData;
+    ref->tableId = ss.m_req.tableId;
+    ref->errorCode = ss.m_error;
+    sendSignal(dictRef, GSN_PREP_DROP_TAB_REF,
+               signal, PrepDropTabRef::SignalLength, JBB);
+  }
+
+  ssRelease<Ss_PREP_DROP_TAB_REQ>(ssId);
+}
+
+// GSN_DROP_TAB_REQ
+
+void
+DbtcProxy::execDROP_TAB_REQ(Signal* signal)
+{
+  const DropTabReq* req = (const DropTabReq*)signal->getDataPtr();
+  Uint32 ssId = getSsId(req);
+  Ss_DROP_TAB_REQ& ss = ssSeize<Ss_DROP_TAB_REQ>(ssId);
+  ss.m_req = *req;
+  ndbrequire(signal->getLength() == DropTabReq::SignalLength);
+  sendREQ(signal, ss);
+}
+
+void
+DbtcProxy::sendDROP_TAB_REQ(Signal* signal, Uint32 ssId, SectionHandle*)
+{
+  Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
+
+  DropTabReq* req = (DropTabReq*)signal->getDataPtrSend();
+  *req = ss.m_req;
+  req->senderRef = reference();
+  req->senderData = ssId; // redundant since tableId is used
+  sendSignal(workerRef(ss.m_worker), GSN_DROP_TAB_REQ,
+             signal, DropTabReq::SignalLength, JBB);
+}
+
+void
+DbtcProxy::execDROP_TAB_CONF(Signal* signal)
+{
+  const DropTabConf* conf = (const DropTabConf*)signal->getDataPtr();
+  Uint32 ssId = getSsId(conf);
+  Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
+  recvCONF(signal, ss);
+}
+
+void
+DbtcProxy::execDROP_TAB_REF(Signal* signal)
+{
+  const DropTabRef* ref = (const DropTabRef*)signal->getDataPtr();
+  Uint32 ssId = getSsId(ref);
+  Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
+  recvREF(signal, ss, ref->errorCode);
+}
+
+void
+DbtcProxy::sendDROP_TAB_CONF(Signal* signal, Uint32 ssId)
+{
+  Ss_DROP_TAB_REQ& ss = ssFind<Ss_DROP_TAB_REQ>(ssId);
+  BlockReference dictRef = ss.m_req.senderRef;
+
+  if (!lastReply(ss))
+    return;
+
+  if (ss.m_error == 0) {
+    jam();
+    DropTabConf* conf = (DropTabConf*)signal->getDataPtrSend();
+    conf->senderRef = reference();
+    conf->senderData = ss.m_req.senderData;
+    conf->tableId = ss.m_req.tableId;
+    sendSignal(dictRef, GSN_DROP_TAB_CONF,
+               signal, DropTabConf::SignalLength, JBB);
+  } else {
+    jam();
+    DropTabRef* ref = (DropTabRef*)signal->getDataPtrSend();
+    ref->senderRef = reference();
+    ref->senderData = ss.m_req.senderData;
+    ref->tableId = ss.m_req.tableId;
+    ref->errorCode = ss.m_error;
+    sendSignal(dictRef, GSN_DROP_TAB_REF,
+               signal, DropTabConf::SignalLength, JBB);
+  }
+
+  ssRelease<Ss_DROP_TAB_REQ>(ssId);
+}
+
+// GSN_ALTER_TAB_REQ
+
+void
+DbtcProxy::execALTER_TAB_REQ(Signal* signal)
+{
+  if (!assembleFragments(signal))
+  {
+    jam();
+    return;
+  }
+
+  const AlterTabReq* req = (const AlterTabReq*)signal->getDataPtr();
+  Uint32 ssId = getSsId(req);
+  Ss_ALTER_TAB_REQ& ss = ssSeize<Ss_ALTER_TAB_REQ>(ssId);
+  ss.m_req = *req;
+
+  SectionHandle handle(this, signal);
+  saveSections(ss, handle);
+
+  sendREQ(signal, ss);
+}
+
+void
+DbtcProxy::sendALTER_TAB_REQ(Signal* signal, Uint32 ssId,
+                             SectionHandle* handle)
+{
+  Ss_ALTER_TAB_REQ& ss = ssFind<Ss_ALTER_TAB_REQ>(ssId);
+
+  AlterTabReq* req = (AlterTabReq*)signal->getDataPtrSend();
+  *req = ss.m_req;
+  req->senderRef = reference();
+  req->senderData = ssId;
+  sendSignalNoRelease(workerRef(ss.m_worker), GSN_ALTER_TAB_REQ,
+                      signal, AlterTabReq::SignalLength, JBB, handle);
+}
+
+void
+DbtcProxy::execALTER_TAB_CONF(Signal* signal)
+{
+  const AlterTabConf* conf = (const AlterTabConf*)signal->getDataPtr();
+  Uint32 ssId = getSsId(conf);
+  Ss_ALTER_TAB_REQ& ss = ssFind<Ss_ALTER_TAB_REQ>(ssId);
+  recvCONF(signal, ss);
+}
+
+void
+DbtcProxy::execALTER_TAB_REF(Signal* signal)
+{
+  const AlterTabRef* ref = (const AlterTabRef*)signal->getDataPtr();
+  Uint32 ssId = getSsId(ref);
+  Ss_ALTER_TAB_REQ& ss = ssFind<Ss_ALTER_TAB_REQ>(ssId);
+  recvREF(signal, ss, ref->errorCode);
+}
+
+void
+DbtcProxy::sendALTER_TAB_CONF(Signal* signal, Uint32 ssId)
+{
+  Ss_ALTER_TAB_REQ& ss = ssFind<Ss_ALTER_TAB_REQ>(ssId);
+  BlockReference dictRef = ss.m_req.senderRef;
+
+  if (!lastReply(ss))
+    return;
+
+  if (ss.m_error == 0) {
+    jam();
+    AlterTabConf* conf = (AlterTabConf*)signal->getDataPtrSend();
+    conf->senderRef = reference();
+    conf->senderData = ss.m_req.senderData;
+    sendSignal(dictRef, GSN_ALTER_TAB_CONF,
+               signal, AlterTabConf::SignalLength, JBB);
+  } else {
+    jam();
+    AlterTabRef* ref = (AlterTabRef*)signal->getDataPtrSend();
+    ref->senderRef = reference();
+    ref->senderData = ss.m_req.senderData;
+    ref->errorCode = ss.m_error;
+    sendSignal(dictRef, GSN_ALTER_TAB_REF,
+               signal, AlterTabConf::SignalLength, JBB);
+  }
+
+  ssRelease<Ss_ALTER_TAB_REQ>(ssId);
+}
+
+void
+DbtcProxy::execTCSEIZEREQ(Signal* signal)
+{
+  jamEntry();
+
+  if (signal->getLength() >= 3 && signal->theData[2] != 0)
+  {
+    /**
+     * Specific instance requested...
+     */
+    Uint32 instance = signal->theData[2];
+    if (instance >= c_workers)
+    {
+      jam();
+      Uint32 senderData = signal->theData[0];
+      Uint32 senderRef = signal->theData[1];
+      signal->theData[0] = senderData;
+      signal->theData[1] = 289;
+      sendSignal(senderRef, GSN_TCSEIZEREF, signal, 2, JBB);
+      return;
+    }
+
+    sendSignal(workerRef(instance), GSN_TCSEIZEREQ, signal,
+               signal->getLength(), JBB);
+    return;
+  }
+
+  signal->theData[2] = 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;
+}
+
+// GSN_TCGETOPSIZEREQ
+
+void
+DbtcProxy::execTCGETOPSIZEREQ(Signal* signal)
+{
+  Ss_TCGETOPSIZEREQ& ss = ssSeize<Ss_TCGETOPSIZEREQ>(1);
+
+  ss.m_sum = 0;
+  memcpy(ss.m_req, signal->getDataPtr(), 2*4);
+  sendREQ(signal, ss);
+}
+
+void
+DbtcProxy::sendTCGETOPSIZEREQ(Signal* signal, Uint32 ssId, SectionHandle*)
+{
+  Ss_TCGETOPSIZEREQ& ss = ssFind<Ss_TCGETOPSIZEREQ>(ssId);
+
+  signal->theData[0] = ssId;
+  signal->theData[1] = reference();
+  sendSignal(workerRef(ss.m_worker), GSN_TCGETOPSIZEREQ,
+             signal, 2, JBB);
+}
+
+void
+DbtcProxy::execTCGETOPSIZECONF(Signal* signal)
+{
+  Uint32 ssId = signal->theData[0];
+  Ss_TCGETOPSIZEREQ& ss = ssFind<Ss_TCGETOPSIZEREQ>(ssId);
+  ss.m_sum += signal->theData[1];
+  recvCONF(signal, ss);
+}
+
+void
+DbtcProxy::sendTCGETOPSIZECONF(Signal* signal, Uint32 ssId)
+{
+  Ss_TCGETOPSIZEREQ& ss = ssFind<Ss_TCGETOPSIZEREQ>(ssId);
+
+  if (!lastReply(ss))
+    return;
+
+  signal->theData[0] = ss.m_req[0];
+  signal->theData[1] = ss.m_sum;
+  sendSignal(ss.m_req[1], GSN_TCGETOPSIZECONF,
+             signal, 2, JBB);
+
+  ssRelease<Ss_TCGETOPSIZEREQ>(ssId);
+}
+
+// GSN_TC_CLOPSIZEREQ
+
+void
+DbtcProxy::execTC_CLOPSIZEREQ(Signal* signal)
+{
+  Ss_TC_CLOPSIZEREQ& ss = ssSeize<Ss_TC_CLOPSIZEREQ>(1);
+
+  memcpy(ss.m_req, signal->getDataPtr(), 2*4);
+  sendREQ(signal, ss);
+}
+
+void
+DbtcProxy::sendTC_CLOPSIZEREQ(Signal* signal, Uint32 ssId, SectionHandle*)
+{
+  Ss_TC_CLOPSIZEREQ& ss = ssFind<Ss_TC_CLOPSIZEREQ>(ssId);
+
+  signal->theData[0] = ssId;
+  signal->theData[1] = reference();
+  sendSignal(workerRef(ss.m_worker), GSN_TC_CLOPSIZEREQ,
+             signal, 2, JBB);
+}
+
+void
+DbtcProxy::execTC_CLOPSIZECONF(Signal* signal)
+{
+  Uint32 ssId = signal->theData[0];
+  Ss_TC_CLOPSIZEREQ& ss = ssFind<Ss_TC_CLOPSIZEREQ>(ssId);
+  recvCONF(signal, ss);
+}
+
+void
+DbtcProxy::sendTC_CLOPSIZECONF(Signal* signal, Uint32 ssId)
+{
+  Ss_TC_CLOPSIZEREQ& ss = ssFind<Ss_TC_CLOPSIZEREQ>(ssId);
+
+  if (!lastReply(ss))
+    return;
+
+  signal->theData[0] = ss.m_req[0];
+  sendSignal(ss.m_req[1], GSN_TC_CLOPSIZECONF,
+             signal, 1, JBB);
+
+  ssRelease<Ss_TC_CLOPSIZEREQ>(ssId);
+}
+
+// GSN_GCP_NOMORETRANS
+
+void
+DbtcProxy::execGCP_NOMORETRANS(Signal* signal)
+{
+  Ss_GCP_NOMORETRANS& ss = ssSeize<Ss_GCP_NOMORETRANS>(1);
+
+  ss.m_req = *(GCPNoMoreTrans*)signal->getDataPtr();
+  sendREQ(signal, ss);
+}
+
+void
+DbtcProxy::sendGCP_NOMORETRANS(Signal* signal, Uint32 ssId, SectionHandle*)
+{
+  Ss_GCP_NOMORETRANS& ss = ssFind<Ss_GCP_NOMORETRANS>(ssId);
+
+  GCPNoMoreTrans * req = (GCPNoMoreTrans*)signal->getDataPtrSend();
+  req->senderRef = reference();
+  req->senderData = ssId;
+  req->gci_hi = ss.m_req.gci_hi;
+  req->gci_lo = ss.m_req.gci_lo;
+  sendSignal(workerRef(ss.m_worker), GSN_GCP_NOMORETRANS,
+             signal, GCPNoMoreTrans::SignalLength, JBB);
+}
+
+void
+DbtcProxy::execGCP_TCFINISHED(Signal* signal)
+{
+  GCPTCFinished* conf = (GCPTCFinished*)signal->getDataPtr();
+  Uint32 ssId = conf->senderData;
+  Ss_GCP_NOMORETRANS& ss = ssFind<Ss_GCP_NOMORETRANS>(ssId);
+  recvCONF(signal, ss);
+}
+
+void
+DbtcProxy::sendGCP_TCFINISHED(Signal* signal, Uint32 ssId)
+{
+  Ss_GCP_NOMORETRANS& ss = ssFind<Ss_GCP_NOMORETRANS>(ssId);
+
+  if (!lastReply(ss))
+    return;
+
+  GCPTCFinished* conf = (GCPTCFinished*)signal->getDataPtrSend();
+  conf->senderData = ss.m_req.senderData;
+  conf->gci_hi = ss.m_req.gci_hi;
+  conf->gci_lo = ss.m_req.gci_lo;
+  sendSignal(ss.m_req.senderRef, GSN_GCP_TCFINISHED,
+             signal, GCPTCFinished::SignalLength, JBB);
+
+  ssRelease<Ss_GCP_NOMORETRANS>(ssId);
+}
+
+
+// GSN_API_FAILREQ
+
+void
+DbtcProxy::execAPI_FAILREQ(Signal* signal)
+{
+  Uint32 nodeId = signal->theData[0];
+  Ss_API_FAILREQ& ss = ssSeize<Ss_API_FAILREQ>(nodeId);
+
+  ss.m_ref = signal->theData[1];
+  sendREQ(signal, ss);
+}
+
+void
+DbtcProxy::sendAPI_FAILREQ(Signal* signal, Uint32 ssId, SectionHandle*)
+{
+  Ss_API_FAILREQ& ss = ssFind<Ss_API_FAILREQ>(ssId);
+
+  signal->theData[0] = ssId;
+  signal->theData[1] = reference();
+  sendSignal(workerRef(ss.m_worker), GSN_API_FAILREQ,
+             signal, 2, JBB);
+}
+
+void
+DbtcProxy::execAPI_FAILCONF(Signal* signal)
+{
+  Uint32 nodeId = signal->theData[0];
+  Ss_API_FAILREQ& ss = ssFind<Ss_API_FAILREQ>(nodeId);
+  recvCONF(signal, ss);
+}
+
+void
+DbtcProxy::sendAPI_FAILCONF(Signal* signal, Uint32 ssId)
+{
+  Ss_API_FAILREQ& ss = ssFind<Ss_API_FAILREQ>(ssId);
+
+  if (!lastReply(ss))
+    return;
+
+  signal->theData[0] = ssId;
+  signal->theData[1] = calcTcBlockRef(getOwnNodeId());
+  sendSignal(ss.m_ref, GSN_API_FAILCONF,
+             signal, 2, JBB);
+
+  ssRelease<Ss_API_FAILREQ>(ssId);
+}
+
+// GSN_CREATE_INDX_IMPL_REQ
+
+void
+DbtcProxy::execCREATE_INDX_IMPL_REQ(Signal* signal)
+{
+  jamEntry();
+  if (!assembleFragments(signal))
+  {
+    jam();
+    return;
+  }
+
+  const CreateIndxImplReq* req = (const CreateIndxImplReq*)signal->getDataPtr();
+  Ss_CREATE_INDX_IMPL_REQ& ss = ssSeize<Ss_CREATE_INDX_IMPL_REQ>();
+  ss.m_req = *req;
+  SectionHandle handle(this, signal);
+  saveSections(ss, handle);
+  sendREQ(signal, ss);
+}
+
+void
+DbtcProxy::sendCREATE_INDX_IMPL_REQ(Signal* signal, Uint32 ssId,
+                                    SectionHandle * handle)
+{
+  Ss_CREATE_INDX_IMPL_REQ& ss = ssFind<Ss_CREATE_INDX_IMPL_REQ>(ssId);
+
+  CreateIndxImplReq* req = (CreateIndxImplReq*)signal->getDataPtrSend();
+  *req = ss.m_req;
+  req->senderRef = reference();
+  req->senderData = ssId;
+  sendSignalNoRelease(workerRef(ss.m_worker), GSN_CREATE_INDX_IMPL_REQ,
+                      signal, CreateIndxImplReq::SignalLength, JBB,
+                      handle);
+}
+
+void
+DbtcProxy::execCREATE_INDX_IMPL_CONF(Signal* signal)
+{
+  const CreateIndxImplConf* conf = (const CreateIndxImplConf*)signal->getDataPtr();
+  Uint32 ssId = conf->senderData;
+  Ss_CREATE_INDX_IMPL_REQ& ss = ssFind<Ss_CREATE_INDX_IMPL_REQ>(ssId);
+  recvCONF(signal, ss);
+}
+
+void
+DbtcProxy::execCREATE_INDX_IMPL_REF(Signal* signal)
+{
+  const CreateIndxImplRef* ref = (const CreateIndxImplRef*)signal->getDataPtr();
+  Uint32 ssId = ref->senderData;
+  Ss_CREATE_INDX_IMPL_REQ& ss = ssFind<Ss_CREATE_INDX_IMPL_REQ>(ssId);
+  recvREF(signal, ss, ref->errorCode);
+}
+
+void
+DbtcProxy::sendCREATE_INDX_IMPL_CONF(Signal* signal, Uint32 ssId)
+{
+  Ss_CREATE_INDX_IMPL_REQ& ss = ssFind<Ss_CREATE_INDX_IMPL_REQ>(ssId);
+  BlockReference dictRef = ss.m_req.senderRef;
+
+  if (!lastReply(ss))
+    return;
+
+  if (ss.m_error == 0) {
+    jam();
+    CreateIndxImplConf* conf = (CreateIndxImplConf*)signal->getDataPtrSend();
+    conf->senderRef = reference();
+    conf->senderData = ss.m_req.senderData;
+    sendSignal(dictRef, GSN_CREATE_INDX_IMPL_CONF,
+               signal, CreateIndxImplConf::SignalLength, JBB);
+  } else {
+    CreateIndxImplRef* ref = (CreateIndxImplRef*)signal->getDataPtrSend();
+    ref->senderRef = reference();
+    ref->senderData = ss.m_req.senderData;
+    ref->errorCode = ss.m_error;
+    sendSignal(dictRef, GSN_CREATE_INDX_IMPL_REF,
+               signal, CreateIndxImplRef::SignalLength, JBB);
+  }
+
+  ssRelease<Ss_CREATE_INDX_IMPL_REQ>(ssId);
+}
+
+// GSN_ALTER_INDX_IMPL_REQ
+
+void
+DbtcProxy::execALTER_INDX_IMPL_REQ(Signal* signal)
+{
+  const AlterIndxImplReq* req = (const AlterIndxImplReq*)signal->getDataPtr();
+  Ss_ALTER_INDX_IMPL_REQ& ss = ssSeize<Ss_ALTER_INDX_IMPL_REQ>();
+  ss.m_req = *req;
+  ndbrequire(signal->getLength() == AlterIndxImplReq::SignalLength);
+  sendREQ(signal, ss);
+}
+
+void
+DbtcProxy::sendALTER_INDX_IMPL_REQ(Signal* signal, Uint32 ssId, SectionHandle*)
+{
+  Ss_ALTER_INDX_IMPL_REQ& ss = ssFind<Ss_ALTER_INDX_IMPL_REQ>(ssId);
+
+  AlterIndxImplReq* req = (AlterIndxImplReq*)signal->getDataPtrSend();
+  *req = ss.m_req;
+  req->senderRef = reference();
+  req->senderData = ssId;
+  sendSignal(workerRef(ss.m_worker), GSN_ALTER_INDX_IMPL_REQ,
+             signal, AlterIndxImplReq::SignalLength, JBB);
+}
+
+void
+DbtcProxy::execALTER_INDX_IMPL_CONF(Signal* signal)
+{
+  const AlterIndxImplConf* conf = (const AlterIndxImplConf*)signal->getDataPtr();
+  Uint32 ssId = conf->senderData;
+  Ss_ALTER_INDX_IMPL_REQ& ss = ssFind<Ss_ALTER_INDX_IMPL_REQ>(ssId);
+  recvCONF(signal, ss);
+}
+
+void
+DbtcProxy::execALTER_INDX_IMPL_REF(Signal* signal)
+{
+  const AlterIndxImplRef* ref = (const AlterIndxImplRef*)signal->getDataPtr();
+  Uint32 ssId = ref->senderData;
+  Ss_ALTER_INDX_IMPL_REQ& ss = ssFind<Ss_ALTER_INDX_IMPL_REQ>(ssId);
+  recvREF(signal, ss, ref->errorCode);
+}
+
+void
+DbtcProxy::sendALTER_INDX_IMPL_CONF(Signal* signal, Uint32 ssId)
+{
+  Ss_ALTER_INDX_IMPL_REQ& ss = ssFind<Ss_ALTER_INDX_IMPL_REQ>(ssId);
+  BlockReference dictRef = ss.m_req.senderRef;
+
+  if (!lastReply(ss))
+    return;
+
+  if (ss.m_error == 0) {
+    jam();
+    AlterIndxImplConf* conf = (AlterIndxImplConf*)signal->getDataPtrSend();
+    conf->senderRef = reference();
+    conf->senderData = ss.m_req.senderData;
+    sendSignal(dictRef, GSN_ALTER_INDX_IMPL_CONF,
+               signal, AlterIndxImplConf::SignalLength, JBB);
+  } else {
+    AlterIndxImplRef* ref = (AlterIndxImplRef*)signal->getDataPtrSend();
+    ref->senderRef = reference();
+    ref->senderData = ss.m_req.senderData;
+    ref->errorCode = ss.m_error;
+    sendSignal(dictRef, GSN_ALTER_INDX_IMPL_REF,
+               signal, AlterIndxImplRef::SignalLength, JBB);
+  }
+
+  ssRelease<Ss_ALTER_INDX_IMPL_REQ>(ssId);
+}
+
+// GSN_DROP_INDX_IMPL_REQ
+
+void
+DbtcProxy::execDROP_INDX_IMPL_REQ(Signal* signal)
+{
+  const DropIndxImplReq* req = (const DropIndxImplReq*)signal->getDataPtr();
+  Ss_DROP_INDX_IMPL_REQ& ss = ssSeize<Ss_DROP_INDX_IMPL_REQ>();
+  ss.m_req = *req;
+  ndbrequire(signal->getLength() == DropIndxImplReq::SignalLength);
+  sendREQ(signal, ss);
+}
+
+void
+DbtcProxy::sendDROP_INDX_IMPL_REQ(Signal* signal, Uint32 ssId, SectionHandle*)
+{
+  Ss_DROP_INDX_IMPL_REQ& ss = ssFind<Ss_DROP_INDX_IMPL_REQ>(ssId);
+
+  DropIndxImplReq* req = (DropIndxImplReq*)signal->getDataPtrSend();
+  *req = ss.m_req;
+  req->senderRef = reference();
+  req->senderData = ssId;
+  sendSignal(workerRef(ss.m_worker), GSN_DROP_INDX_IMPL_REQ,
+             signal, DropIndxImplReq::SignalLength, JBB);
+}
+
+void
+DbtcProxy::execDROP_INDX_IMPL_CONF(Signal* signal)
+{
+  const DropIndxImplConf* conf = (const DropIndxImplConf*)signal->getDataPtr();
+  Uint32 ssId = conf->senderData;
+  Ss_DROP_INDX_IMPL_REQ& ss = ssFind<Ss_DROP_INDX_IMPL_REQ>(ssId);
+  recvCONF(signal, ss);
+}
+
+void
+DbtcProxy::execDROP_INDX_IMPL_REF(Signal* signal)
+{
+  const DropIndxImplRef* ref = (const DropIndxImplRef*)signal->getDataPtr();
+  Uint32 ssId = ref->senderData;
+  Ss_DROP_INDX_IMPL_REQ& ss = ssFind<Ss_DROP_INDX_IMPL_REQ>(ssId);
+  recvREF(signal, ss, ref->errorCode);
+}
+
+void
+DbtcProxy::sendDROP_INDX_IMPL_CONF(Signal* signal, Uint32 ssId)
+{
+  Ss_DROP_INDX_IMPL_REQ& ss = ssFind<Ss_DROP_INDX_IMPL_REQ>(ssId);
+  BlockReference dictRef = ss.m_req.senderRef;
+
+  if (!lastReply(ss))
+    return;
+
+  if (ss.m_error == 0) {
+    jam();
+    DropIndxImplConf* conf = (DropIndxImplConf*)signal->getDataPtrSend();
+    conf->senderRef = reference();
+    conf->senderData = ss.m_req.senderData;
+    sendSignal(dictRef, GSN_DROP_INDX_IMPL_CONF,
+               signal, DropIndxImplConf::SignalLength, JBB);
+  } else {
+    DropIndxImplRef* ref = (DropIndxImplRef*)signal->getDataPtrSend();
+    ref->senderRef = reference();
+    ref->senderData = ss.m_req.senderData;
+    ref->errorCode = ss.m_error;
+    sendSignal(dictRef, GSN_DROP_INDX_IMPL_REF,
+               signal, DropIndxImplRef::SignalLength, JBB);
+  }
+
+  ssRelease<Ss_DROP_INDX_IMPL_REQ>(ssId);
+}
+
+BLOCK_FUNCTIONS(DbtcProxy)

=== added file 'storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.hpp	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.hpp	2011-04-27 10:48:16 +0000
@@ -0,0 +1,309 @@
+/*
+   Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+
+#ifndef NDB_DBTC_PROXY_HPP
+#define NDB_DBTC_PROXY_HPP
+
+#include <LocalProxy.hpp>
+#include <signaldata/CreateTab.hpp>
+#include <signaldata/TabCommit.hpp>
+#include <signaldata/PrepDropTab.hpp>
+#include <signaldata/DropTab.hpp>
+#include <signaldata/AlterTab.hpp>
+#include <signaldata/GCP.hpp>
+
+#include <signaldata/CreateIndxImpl.hpp>
+#include <signaldata/AlterIndxImpl.hpp>
+#include <signaldata/DropIndxImpl.hpp>
+
+class DbtcProxy : public LocalProxy {
+public:
+  DbtcProxy(Block_context& ctx);
+  virtual ~DbtcProxy();
+  BLOCK_DEFINES(DbtcProxy);
+
+protected:
+  virtual SimulatedBlock* newWorker(Uint32 instanceNo);
+
+  // GSN_NDB_STTOR
+  virtual void callNDB_STTOR(Signal*);
+
+  // GSN_TC_SCHVERREQ
+  struct Ss_TC_SCHVERREQ : SsParallel {
+    TcSchVerReq m_req;
+    Ss_TC_SCHVERREQ() {
+      m_sendREQ = (SsFUNCREQ)&DbtcProxy::sendTC_SCHVERREQ;
+      m_sendCONF = (SsFUNCREP)&DbtcProxy::sendTC_SCHVERCONF;
+    }
+    enum { poolSize = 1 };
+    static SsPool<Ss_TC_SCHVERREQ>& pool(LocalProxy* proxy) {
+      return ((DbtcProxy*)proxy)->c_ss_TC_SCHVERREQ;
+    }
+  };
+  SsPool<Ss_TC_SCHVERREQ> c_ss_TC_SCHVERREQ;
+  void execTC_SCHVERREQ(Signal*);
+  void sendTC_SCHVERREQ(Signal*, Uint32 ssId, SectionHandle*);
+  void execTC_SCHVERCONF(Signal*);
+  void sendTC_SCHVERCONF(Signal*, Uint32 ssId);
+
+  // GSN_TAB_COMMITREQ [ sub-op ]
+  struct Ss_TAB_COMMITREQ : SsParallel {
+    TabCommitReq m_req;
+    Ss_TAB_COMMITREQ() {
+      m_sendREQ = (SsFUNCREQ)&DbtcProxy::sendTAB_COMMITREQ;
+      m_sendCONF = (SsFUNCREP)&DbtcProxy::sendTAB_COMMITCONF;
+    }
+    enum { poolSize = 1 };
+    static SsPool<Ss_TAB_COMMITREQ>& pool(LocalProxy* proxy) {
+      return ((DbtcProxy*)proxy)->c_ss_TAB_COMMITREQ;
+    }
+  };
+  SsPool<Ss_TAB_COMMITREQ> c_ss_TAB_COMMITREQ;
+  void execTAB_COMMITREQ(Signal*);
+  void sendTAB_COMMITREQ(Signal*, Uint32 ssId, SectionHandle*);
+  void execTAB_COMMITCONF(Signal*);
+  void execTAB_COMMITREF(Signal*);
+  void sendTAB_COMMITCONF(Signal*, Uint32 ssId);
+
+  // GSN_PREP_DROP_TAB_REQ
+  struct Ss_PREP_DROP_TAB_REQ : SsParallel {
+    PrepDropTabReq m_req;
+    Ss_PREP_DROP_TAB_REQ() {
+      m_sendREQ = (SsFUNCREQ)&DbtcProxy::sendPREP_DROP_TAB_REQ;
+      m_sendCONF = (SsFUNCREP)&DbtcProxy::sendPREP_DROP_TAB_CONF;
+    }
+    enum { poolSize = 1 };
+    static SsPool<Ss_PREP_DROP_TAB_REQ>& pool(LocalProxy* proxy) {
+      return ((DbtcProxy*)proxy)->c_ss_PREP_DROP_TAB_REQ;
+    }
+  };
+
+  SsPool<Ss_PREP_DROP_TAB_REQ> c_ss_PREP_DROP_TAB_REQ;
+  Uint32 getSsId(const PrepDropTabReq* req) {
+    return SsIdBase | req->tableId;
+  }
+  Uint32 getSsId(const PrepDropTabConf* conf) {
+    return SsIdBase | conf->tableId;
+  }
+  Uint32 getSsId(const PrepDropTabRef* ref) {
+    return SsIdBase | ref->tableId;
+  }
+  void execPREP_DROP_TAB_REQ(Signal*);
+  void sendPREP_DROP_TAB_REQ(Signal*, Uint32 ssId, SectionHandle*);
+  void execPREP_DROP_TAB_CONF(Signal*);
+  void execPREP_DROP_TAB_REF(Signal*);
+  void sendPREP_DROP_TAB_CONF(Signal*, Uint32 ssId);
+
+  // GSN_DROP_TAB_REQ
+  struct Ss_DROP_TAB_REQ : SsParallel {
+    DropTabReq m_req;
+    Ss_DROP_TAB_REQ() {
+      m_sendREQ = (SsFUNCREQ)&DbtcProxy::sendDROP_TAB_REQ;
+      m_sendCONF = (SsFUNCREP)&DbtcProxy::sendDROP_TAB_CONF;
+    }
+    enum { poolSize = 1 };
+    static SsPool<Ss_DROP_TAB_REQ>& pool(LocalProxy* proxy) {
+      return ((DbtcProxy*)proxy)->c_ss_DROP_TAB_REQ;
+    }
+  };
+  SsPool<Ss_DROP_TAB_REQ> c_ss_DROP_TAB_REQ;
+  Uint32 getSsId(const DropTabReq* req) {
+    return SsIdBase | req->tableId;
+  }
+  Uint32 getSsId(const DropTabConf* conf) {
+    return SsIdBase | conf->tableId;
+  }
+  Uint32 getSsId(const DropTabRef* ref) {
+    return SsIdBase | ref->tableId;
+  }
+  void execDROP_TAB_REQ(Signal*);
+  void sendDROP_TAB_REQ(Signal*, Uint32 ssId, SectionHandle*);
+  void execDROP_TAB_CONF(Signal*);
+  void execDROP_TAB_REF(Signal*);
+  void sendDROP_TAB_CONF(Signal*, Uint32 ssId);
+
+  // GSN_ALTER_TAB_REQ
+  struct Ss_ALTER_TAB_REQ : SsParallel {
+    AlterTabReq m_req;
+    Ss_ALTER_TAB_REQ() {
+      m_sendREQ = (SsFUNCREQ)&DbtcProxy::sendALTER_TAB_REQ;
+      m_sendCONF = (SsFUNCREP)&DbtcProxy::sendALTER_TAB_CONF;
+    }
+    enum { poolSize = 1 };
+    static SsPool<Ss_ALTER_TAB_REQ>& pool(LocalProxy* proxy) {
+      return ((DbtcProxy*)proxy)->c_ss_ALTER_TAB_REQ;
+    }
+  };
+  SsPool<Ss_ALTER_TAB_REQ> c_ss_ALTER_TAB_REQ;
+  Uint32 getSsId(const AlterTabReq* req) {
+    return SsIdBase | req->tableId;
+  }
+  Uint32 getSsId(const AlterTabConf* conf) {
+    return conf->senderData;
+  }
+  Uint32 getSsId(const AlterTabRef* ref) {
+    return ref->senderData;
+  }
+  void execALTER_TAB_REQ(Signal*);
+  void sendALTER_TAB_REQ(Signal*, Uint32 ssId, SectionHandle*);
+  void execALTER_TAB_CONF(Signal*);
+  void execALTER_TAB_REF(Signal*);
+  void sendALTER_TAB_CONF(Signal*, Uint32 ssId);
+
+  /**
+   * TCSEIZEREQ
+   */
+  Uint32 m_tc_seize_req_instance; // round robin
+  void execTCSEIZEREQ(Signal* signal);
+
+  /**
+   * TCGETOPSIZEREQ
+   */
+  struct Ss_TCGETOPSIZEREQ : SsParallel {
+    Uint32 m_sum;
+    Uint32 m_req[2];
+    Ss_TCGETOPSIZEREQ() {
+      m_sendREQ = (SsFUNCREQ)&DbtcProxy::sendTCGETOPSIZEREQ;
+      m_sendCONF = (SsFUNCREP)&DbtcProxy::sendTCGETOPSIZECONF;
+    }
+    enum { poolSize = 1 };
+    static SsPool<Ss_TCGETOPSIZEREQ>& pool(LocalProxy* proxy) {
+      return ((DbtcProxy*)proxy)->c_ss_TCGETOPSIZEREQ;
+    }
+  };
+  SsPool<Ss_TCGETOPSIZEREQ> c_ss_TCGETOPSIZEREQ;
+  void execTCGETOPSIZEREQ(Signal*);
+  void sendTCGETOPSIZEREQ(Signal*, Uint32 ssId, SectionHandle*);
+  void execTCGETOPSIZECONF(Signal*);
+  void sendTCGETOPSIZECONF(Signal*, Uint32 ssId);
+
+  /**
+   * TC_CLOPSIZEREQ
+   */
+  struct Ss_TC_CLOPSIZEREQ : SsParallel {
+    Uint32 m_req[2];
+    Ss_TC_CLOPSIZEREQ() {
+      m_sendREQ = (SsFUNCREQ)&DbtcProxy::sendTC_CLOPSIZEREQ;
+      m_sendCONF = (SsFUNCREP)&DbtcProxy::sendTC_CLOPSIZECONF;
+    }
+    enum { poolSize = 1 };
+    static SsPool<Ss_TC_CLOPSIZEREQ>& pool(LocalProxy* proxy) {
+      return ((DbtcProxy*)proxy)->c_ss_TC_CLOPSIZEREQ;
+    }
+  };
+  SsPool<Ss_TC_CLOPSIZEREQ> c_ss_TC_CLOPSIZEREQ;
+  void execTC_CLOPSIZEREQ(Signal*);
+  void sendTC_CLOPSIZEREQ(Signal*, Uint32 ssId, SectionHandle*);
+  void execTC_CLOPSIZECONF(Signal*);
+  void sendTC_CLOPSIZECONF(Signal*, Uint32 ssId);
+
+  // GSN_GCP_NOMORETRANS
+  struct Ss_GCP_NOMORETRANS : SsParallel {
+    GCPNoMoreTrans m_req;
+    Ss_GCP_NOMORETRANS() {
+      m_sendREQ = (SsFUNCREQ)&DbtcProxy::sendGCP_NOMORETRANS;
+      m_sendCONF = (SsFUNCREP)&DbtcProxy::sendGCP_TCFINISHED;
+    }
+    enum { poolSize = 1 };
+    static SsPool<Ss_GCP_NOMORETRANS>& pool(LocalProxy* proxy) {
+      return ((DbtcProxy*)proxy)->c_ss_GCP_NOMORETRANS;
+    }
+  };
+  SsPool<Ss_GCP_NOMORETRANS> c_ss_GCP_NOMORETRANS;
+  void execGCP_NOMORETRANS(Signal*);
+  void sendGCP_NOMORETRANS(Signal*, Uint32 ssId, SectionHandle*);
+  void execGCP_TCFINISHED(Signal*);
+  void sendGCP_TCFINISHED(Signal*, Uint32 ssId);
+
+  // GSN_API_FAILREQ
+  struct Ss_API_FAILREQ : SsParallel {
+    Uint32 m_ref; //
+    Ss_API_FAILREQ() {
+      m_sendREQ = (SsFUNCREQ)&DbtcProxy::sendAPI_FAILREQ;
+      m_sendCONF = (SsFUNCREP)&DbtcProxy::sendAPI_FAILCONF;
+    }
+    enum { poolSize = MAX_NDB_NODES };
+    static SsPool<Ss_API_FAILREQ>& pool(LocalProxy* proxy) {
+      return ((DbtcProxy*)proxy)->c_ss_API_FAILREQ;
+    }
+  };
+  SsPool<Ss_API_FAILREQ> c_ss_API_FAILREQ;
+  void execAPI_FAILREQ(Signal*);
+  void sendAPI_FAILREQ(Signal*, Uint32 ssId, SectionHandle*);
+  void execAPI_FAILCONF(Signal*);
+  void sendAPI_FAILCONF(Signal*, Uint32 ssId);
+
+  // GSN_CREATE_INDX_IMPL_REQ
+  struct Ss_CREATE_INDX_IMPL_REQ : SsParallel {
+    CreateIndxImplReq m_req;
+
+    Ss_CREATE_INDX_IMPL_REQ() {
+      m_sendREQ = (SsFUNCREQ)&DbtcProxy::sendCREATE_INDX_IMPL_REQ;
+      m_sendCONF = (SsFUNCREP)&DbtcProxy::sendCREATE_INDX_IMPL_CONF;
+    }
+    enum { poolSize = 1 };
+    static SsPool<Ss_CREATE_INDX_IMPL_REQ>& pool(LocalProxy* proxy) {
+      return ((DbtcProxy*)proxy)->c_ss_CREATE_INDX_IMPL_REQ;
+    }
+  };
+  SsPool<Ss_CREATE_INDX_IMPL_REQ> c_ss_CREATE_INDX_IMPL_REQ;
+  void execCREATE_INDX_IMPL_REQ(Signal*);
+  void sendCREATE_INDX_IMPL_REQ(Signal*, Uint32 ssId, SectionHandle*);
+  void execCREATE_INDX_IMPL_CONF(Signal*);
+  void execCREATE_INDX_IMPL_REF(Signal*);
+  void sendCREATE_INDX_IMPL_CONF(Signal*, Uint32 ssId);
+
+  // GSN_ALTER_INDX_IMPL_REQ
+  struct Ss_ALTER_INDX_IMPL_REQ : SsParallel {
+    AlterIndxImplReq m_req;
+    Ss_ALTER_INDX_IMPL_REQ() {
+      m_sendREQ = (SsFUNCREQ)&DbtcProxy::sendALTER_INDX_IMPL_REQ;
+      m_sendCONF = (SsFUNCREP)&DbtcProxy::sendALTER_INDX_IMPL_CONF;
+    }
+    enum { poolSize = 1 };
+    static SsPool<Ss_ALTER_INDX_IMPL_REQ>& pool(LocalProxy* proxy) {
+      return ((DbtcProxy*)proxy)->c_ss_ALTER_INDX_IMPL_REQ;
+    }
+  };
+  SsPool<Ss_ALTER_INDX_IMPL_REQ> c_ss_ALTER_INDX_IMPL_REQ;
+  void execALTER_INDX_IMPL_REQ(Signal*);
+  void sendALTER_INDX_IMPL_REQ(Signal*, Uint32 ssId, SectionHandle*);
+  void execALTER_INDX_IMPL_CONF(Signal*);
+  void execALTER_INDX_IMPL_REF(Signal*);
+  void sendALTER_INDX_IMPL_CONF(Signal*, Uint32 ssId);
+
+  // GSN_DROP_INDX_IMPL_REQ
+  struct Ss_DROP_INDX_IMPL_REQ : SsParallel {
+    DropIndxImplReq m_req;
+    Ss_DROP_INDX_IMPL_REQ() {
+      m_sendREQ = (SsFUNCREQ)&DbtcProxy::sendDROP_INDX_IMPL_REQ;
+      m_sendCONF = (SsFUNCREP)&DbtcProxy::sendDROP_INDX_IMPL_CONF;
+    }
+    enum { poolSize = 1 };
+    static SsPool<Ss_DROP_INDX_IMPL_REQ>& pool(LocalProxy* proxy) {
+      return ((DbtcProxy*)proxy)->c_ss_DROP_INDX_IMPL_REQ;
+    }
+  };
+  SsPool<Ss_DROP_INDX_IMPL_REQ> c_ss_DROP_INDX_IMPL_REQ;
+  void execDROP_INDX_IMPL_REQ(Signal*);
+  void sendDROP_INDX_IMPL_REQ(Signal*, Uint32 ssId, SectionHandle*);
+  void execDROP_INDX_IMPL_CONF(Signal*);
+  void execDROP_INDX_IMPL_REF(Signal*);
+  void sendDROP_INDX_IMPL_CONF(Signal*, Uint32 ssId);
+};
+
+#endif

=== modified file 'storage/ndb/src/ndbapi/Ndb.cpp'
--- a/storage/ndb/src/ndbapi/Ndb.cpp	2011-04-13 19:33:59 +0000
+++ b/storage/ndb/src/ndbapi/Ndb.cpp	2011-04-27 10:48:16 +0000
@@ -38,7 +38,7 @@ void connect();
 
 Connect to any node which has no connection at the moment.
 ****************************************************************************/
-NdbTransaction* Ndb::doConnect(Uint32 tConNode) 
+NdbTransaction* Ndb::doConnect(Uint32 tConNode, Uint32 instance)
 {
   Uint32        tNode;
   Uint32        tAnyAlive = 0;
@@ -47,12 +47,12 @@ NdbTransaction* Ndb::doConnect(Uint32 tC
   DBUG_ENTER("Ndb::doConnect");
 
   if (tConNode != 0) {
-    TretCode = NDB_connect(tConNode);
+    TretCode = NDB_connect(tConNode, instance);
     if ((TretCode == 1) || (TretCode == 2)) {
 //****************************************************************************
 // We have connections now to the desired node. Return
 //****************************************************************************
-      DBUG_RETURN(getConnectedNdbTransaction(tConNode));
+      DBUG_RETURN(getConnectedNdbTransaction(tConNode, instance));
     } else if (TretCode < 0) {
       DBUG_RETURN(NULL);
     } else if (TretCode != 0) {
@@ -63,6 +63,7 @@ NdbTransaction* Ndb::doConnect(Uint32 tC
 // We will connect to any node. Make sure that we have connections to all
 // nodes.
 //****************************************************************************
+  Uint32 anyInstance = 0;
   if (theImpl->m_optimized_node_selection)
   {
     Ndb_cluster_connection_node_iter &node_iter= 
@@ -70,14 +71,14 @@ NdbTransaction* Ndb::doConnect(Uint32 tC
     theImpl->m_ndb_cluster_connection.init_get_next_node(node_iter);
     while ((tNode= theImpl->m_ndb_cluster_connection.get_next_node(node_iter)))
     {
-      TretCode= NDB_connect(tNode);
+      TretCode= NDB_connect(tNode, anyInstance);
       if ((TretCode == 1) ||
 	  (TretCode == 2))
       {
 //****************************************************************************
 // We have connections now to the desired node. Return
 //****************************************************************************
-	DBUG_RETURN(getConnectedNdbTransaction(tNode));
+	DBUG_RETURN(getConnectedNdbTransaction(tNode, anyInstance));
       } else if (TretCode < 0) {
         DBUG_RETURN(NULL);
       } else if (TretCode != 0) {
@@ -100,14 +101,14 @@ NdbTransaction* Ndb::doConnect(Uint32 tC
 
       Tcount++;
       tNode= theImpl->theDBnodes[theCurrentConnectIndex];
-      TretCode= NDB_connect(tNode);
+      TretCode= NDB_connect(tNode, anyInstance);
       if ((TretCode == 1) ||
 	  (TretCode == 2))
       {
 //****************************************************************************
 // We have connections now to the desired node. Return
 //****************************************************************************
-	DBUG_RETURN(getConnectedNdbTransaction(tNode));
+	DBUG_RETURN(getConnectedNdbTransaction(tNode, anyInstance));
       } else if (TretCode < 0) {
         DBUG_RETURN(NULL);
       } else if (TretCode != 0) {
@@ -132,7 +133,7 @@ NdbTransaction* Ndb::doConnect(Uint32 tC
 }
 
 int 
-Ndb::NDB_connect(Uint32 tNode) 
+Ndb::NDB_connect(Uint32 tNode, Uint32 instance)
 {
 //****************************************************************************
 // We will perform seize of a transaction record in DBTC in the specified node.
@@ -150,10 +151,35 @@ Ndb::NDB_connect(Uint32 tNode) 
   }
 
   NdbTransaction * tConArray = theConnectionArray[tNode];
-  if (tConArray != NULL) {
+  if (instance != 0 && tConArray != 0)
+  {
+    NdbTransaction* prev = 0;
+    NdbTransaction* curr = tConArray;
+    while (curr)
+    {
+      if (refToInstance(curr->m_tcRef) == instance)
+      {
+        if (prev != 0)
+        {
+          prev->theNext = curr->theNext;
+          curr->theNext = tConArray;
+          theConnectionArray[tNode] = curr;
+        }
+        else
+        {
+          assert(curr == tConArray);
+        }
+        DBUG_RETURN(2);
+      }
+      prev = curr;
+      curr = curr->theNext;
+    }
+  }
+  else if (tConArray != NULL)
+  {
     DBUG_RETURN(2);
   }
-  
+
   NdbTransaction * tNdbCon = getNdbCon();	// Get free connection object.
   if (tNdbCon == NULL) {
     DBUG_RETURN(4);
@@ -173,6 +199,7 @@ Ndb::NDB_connect(Uint32 tNode) 
 // Set connection pointer as NdbTransaction object
 //************************************************
   tSignal->setData(theMyRef, 2);	// Set my block reference
+  tSignal->setData(instance, 3);        // Set requested instance
   tNdbCon->Status(NdbTransaction::Connecting); // Set status to connecting
   Uint32 nodeSequence;
   tReturnCode= sendRecSignal(tNode, WAIT_TC_SEIZE, tSignal,
@@ -220,9 +247,36 @@ Ndb::NDB_connect(Uint32 tNode) 
 }//Ndb::NDB_connect()
 
 NdbTransaction *
-Ndb::getConnectedNdbTransaction(Uint32 nodeId){
+Ndb::getConnectedNdbTransaction(Uint32 nodeId, Uint32 instance){
   NdbTransaction* next = theConnectionArray[nodeId];
+  if (instance != 0)
+  {
+    NdbTransaction * prev = 0;
+    while (next)
+    {
+      if (refToInstance(next->m_tcRef) == instance)
+      {
+        if (prev != 0)
+        {
+          assert(false); // Should have been moved in NDB_connect
+          prev->theNext = next->theNext;
+          goto found_middle;
+        }
+        else
+        {
+          assert(next == theConnectionArray[nodeId]);
+          goto found_first;
+        }
+      }
+      prev = next;
+      next = next->theNext;
+    }
+    assert(false); // !!
+    return 0;
+  }
+found_first:
   theConnectionArray[nodeId] = next->theNext;
+found_middle:
   next->theNext = NULL;
 
   return next;
@@ -703,7 +757,7 @@ Ndb::startTransaction(const NdbDictionar
     
     theImpl->incClientStat(TransStartCount, 1);
 
-    NdbTransaction *trans= startTransactionLocal(0, nodeId);
+    NdbTransaction *trans= startTransactionLocal(0, nodeId, 0);
     DBUG_PRINT("exit",("start trans: 0x%lx  transid: 0x%lx",
                        (long) trans,
                        (long) (trans ? trans->getTransactionId() : 0)));
@@ -772,7 +826,7 @@ Ndb::startTransaction(const NdbDictionar
     theImpl->incClientStat( TransStartCount, 1 );
 
     {
-      NdbTransaction *trans= startTransactionLocal(0, nodeId);
+      NdbTransaction *trans= startTransactionLocal(0, nodeId, 0);
       DBUG_PRINT("exit",("start trans: 0x%lx  transid: 0x%lx",
 			 (long) trans,
                          (long) (trans ? trans->getTransactionId() : 0)));
@@ -808,7 +862,9 @@ Ndb::hupp(NdbTransaction* pBuddyTrans)
     checkFailedNode();
 
     Uint32 nodeId = pBuddyTrans->getConnectedNodeId();
-    NdbTransaction* pCon = startTransactionLocal(aPriority, nodeId);
+    NdbTransaction* pCon =
+      startTransactionLocal(aPriority, nodeId,
+                            refToInstance(pBuddyTrans->m_tcRef));
     if(pCon == NULL)
       DBUG_RETURN(NULL);
 
@@ -831,8 +887,8 @@ Ndb::hupp(NdbTransaction* pBuddyTrans)
   }//if
 }//Ndb::hupp()
 
-NdbTransaction* 
-Ndb::startTransactionLocal(Uint32 aPriority, Uint32 nodeId)
+NdbTransaction*
+Ndb::startTransactionLocal(Uint32 aPriority, Uint32 nodeId, Uint32 instance)
 {
 #ifdef VM_TRACE
   char buf[255];
@@ -853,7 +909,7 @@ Ndb::startTransactionLocal(Uint32 aPrior
   
   NdbTransaction* tConnection;
   Uint64 tFirstTransId = theFirstTransId;
-  tConnection = doConnect(nodeId);
+  tConnection = doConnect(nodeId, instance);
   if (tConnection == NULL) {
     DBUG_RETURN(NULL);
   }//if

=== modified file 'storage/ndb/src/ndbapi/NdbApiSignal.cpp'
--- a/storage/ndb/src/ndbapi/NdbApiSignal.cpp	2011-02-10 07:55:45 +0000
+++ b/storage/ndb/src/ndbapi/NdbApiSignal.cpp	2011-04-27 10:48:16 +0000
@@ -125,7 +125,7 @@ NdbApiSignal::setSignal(int aNdbSignalTy
       theTrace                = TestOrd::TraceAPI;
       theReceiversBlockNumber = DBTC;
       theVerId_signalNumber   = GSN_TCSEIZEREQ;
-      theLength               = 2;
+      theLength               = 3;
     }
     break;
 

=== modified file 'storage/ndb/src/ndbapi/NdbOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperation.cpp	2011-02-10 08:02:41 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperation.cpp	2011-04-27 11:50:17 +0000
@@ -182,7 +182,7 @@ NdbOperation::init(const NdbTableImpl* t
     return -1;
   }
   theTCREQ = tSignal;
-  theTCREQ->setSignal(m_tcReqGSN, DBTC);
+  theTCREQ->setSignal(m_tcReqGSN, refToBlock(theNdbCon->m_tcRef));
 
   theAI_LenInCurrAI = 20;
   TcKeyReq * const tcKeyReq = CAST_PTR(TcKeyReq, theTCREQ->getDataPtrSend());

=== modified file 'storage/ndb/src/ndbapi/NdbOperationDefine.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationDefine.cpp	2011-02-10 08:02:41 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationDefine.cpp	2011-04-27 11:50:17 +0000
@@ -951,7 +951,7 @@ NdbOperation::insertATTRINFO( Uint32 aDa
     tAI_LenInCurrAI = 3;
     tSignal = tNdb->getSignal();
     if (tSignal != NULL) {
-      tSignal->setSignal(m_attrInfoGSN, DBTC);
+      tSignal->setSignal(m_attrInfoGSN, refToBlock(theNdbCon->m_tcRef));
       tAttrPtr = &tSignal->getDataPtrSend()[3];
       if (tFirstAttrinfo == NULL) {
         tSignal->next(NULL);
@@ -1008,7 +1008,7 @@ NdbOperation::insertATTRINFOloop(registe
       tAI_LenInCurrAI = 3;
       tSignal = tNdb->getSignal();
       if (tSignal != NULL) {
-        tSignal->setSignal(m_attrInfoGSN, DBTC);
+        tSignal->setSignal(m_attrInfoGSN, refToBlock(theNdbCon->m_tcRef));
         tAttrPtr = &tSignal->getDataPtrSend()[3];
         if (tFirstAttrinfo == NULL) {
           tSignal->next(NULL);

=== modified file 'storage/ndb/src/ndbapi/NdbOperationSearch.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationSearch.cpp	2011-02-10 07:55:45 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationSearch.cpp	2011-04-27 10:48:16 +0000
@@ -381,7 +381,7 @@ NdbOperation::insertKEYINFO(const char* 
       setErrorCodeAbort(4000);
       return -1;
     }
-    if (tSignal->setSignal(m_keyInfoGSN, DBTC) == -1)
+    if (tSignal->setSignal(m_keyInfoGSN, refToBlock(theNdbCon->m_tcRef)) == -1)
     {
       setErrorCodeAbort(4001);
       return -1;

=== modified file 'storage/ndb/src/ndbapi/NdbQueryOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbQueryOperation.cpp	2011-04-14 09:28:28 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryOperation.cpp	2011-04-27 11:50:17 +0000
@@ -2598,7 +2598,7 @@ NdbQueryImpl::doSend(int nodeId, bool la
     assert (root.getMaxBatchRows() > 0);
 
     NdbApiSignal tSignal(&ndb);
-    tSignal.setSignal(GSN_SCAN_TABREQ, DBTC);
+    tSignal.setSignal(GSN_SCAN_TABREQ, refToBlock(m_scanTransaction->m_tcRef));
 
     ScanTabReq * const scanTabReq = CAST_PTR(ScanTabReq, tSignal.getDataPtrSend());
     Uint32 reqInfo = 0;
@@ -2699,7 +2699,7 @@ NdbQueryImpl::doSend(int nodeId, bool la
   } else {  // Lookup query
 
     NdbApiSignal tSignal(&ndb);
-    tSignal.setSignal(GSN_TCKEYREQ, DBTC);
+    tSignal.setSignal(GSN_TCKEYREQ, refToBlock(m_transaction.m_tcRef));
 
     TcKeyReq * const tcKeyReq = CAST_PTR(TcKeyReq, tSignal.getDataPtrSend());
 
@@ -2844,7 +2844,7 @@ NdbQueryImpl::sendFetchMore(NdbRootFragm
 
   Ndb& ndb = *getNdbTransaction().getNdb();
   NdbApiSignal tSignal(&ndb);
-  tSignal.setSignal(GSN_SCAN_NEXTREQ, DBTC);
+  tSignal.setSignal(GSN_SCAN_NEXTREQ, refToBlock(m_scanTransaction->m_tcRef));
   ScanNextReq * const scanNextReq = 
     CAST_PTR(ScanNextReq, tSignal.getDataPtrSend());
   
@@ -2985,7 +2985,7 @@ NdbQueryImpl::sendClose(int nodeId)
 
   Ndb& ndb = *m_transaction.getNdb();
   NdbApiSignal tSignal(&ndb);
-  tSignal.setSignal(GSN_SCAN_NEXTREQ, DBTC);
+  tSignal.setSignal(GSN_SCAN_NEXTREQ, refToBlock(m_scanTransaction->m_tcRef));
   ScanNextReq * const scanNextReq = CAST_PTR(ScanNextReq, tSignal.getDataPtrSend());
 
   assert (m_scanTransaction);

=== modified file 'storage/ndb/src/ndbapi/NdbScanOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp	2011-04-27 08:39:36 +0000
+++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp	2011-04-27 11:50:17 +0000
@@ -85,7 +85,7 @@ NdbScanOperation::init(const NdbTableImp
 {
   m_transConnection = myConnection;
 
-  if(NdbOperation::init(tab, NULL, false) != 0)
+  if (NdbOperation::init(tab, myConnection, false) != 0)
     return -1;
 
   theNdb->theRemainingStartTransactions++; // will be checked in hupp...
@@ -1411,7 +1411,7 @@ NdbScanOperation::processTableScanDefs(N
     return -1;
   }//if
   
-  theSCAN_TABREQ->setSignal(GSN_SCAN_TABREQ, DBTC);
+  theSCAN_TABREQ->setSignal(GSN_SCAN_TABREQ, refToBlock(theNdbCon->m_tcRef));
   ScanTabReq * req = CAST_PTR(ScanTabReq, theSCAN_TABREQ->getDataPtrSend());
   req->apiConnectPtr = theNdbCon->theTCConPtr;
   req->tableId = m_accessTable->m_id;
@@ -1977,7 +1977,7 @@ NdbScanOperation::send_next_scan(Uint32 
 {
   if(cnt > 0){
     NdbApiSignal tSignal(theNdb->theMyRef);
-    tSignal.setSignal(GSN_SCAN_NEXTREQ, DBTC);
+    tSignal.setSignal(GSN_SCAN_NEXTREQ, refToBlock(theNdbCon->m_tcRef));
     
     Uint32* theData = tSignal.getDataPtrSend();
     theData[0] = theNdbCon->theTCConPtr;
@@ -2639,7 +2639,7 @@ NdbScanOperation::takeOverScanOp(Operati
     
     Uint32 left = len - i;
     while(tSignal && left > KeyInfo::DataLength){
-      tSignal->setSignal(GSN_KEYINFO, DBTC);
+      tSignal->setSignal(GSN_KEYINFO, refToBlock(pTrans->m_tcRef));
       tSignal->setLength(KeyInfo::MaxSignalLength);
       KeyInfo * keyInfo = CAST_PTR(KeyInfo, tSignal->getDataPtrSend());
       memcpy(keyInfo->keyData, src, 4 * KeyInfo::DataLength);
@@ -2652,7 +2652,7 @@ NdbScanOperation::takeOverScanOp(Operati
     }
     
     if(tSignal && left > 0){
-      tSignal->setSignal(GSN_KEYINFO, DBTC);
+      tSignal->setSignal(GSN_KEYINFO, refToBlock(pTrans->m_tcRef));
       tSignal->setLength(KeyInfo::HeaderLength + left);
       newOp->theLastKEYINFO = tSignal;
       KeyInfo * keyInfo = CAST_PTR(KeyInfo, tSignal->getDataPtrSend());
@@ -3796,7 +3796,7 @@ NdbIndexScanOperation::send_next_scan_or
   
   NdbReceiver* tRec = m_api_receivers[idx];
   NdbApiSignal tSignal(theNdb->theMyRef);
-  tSignal.setSignal(GSN_SCAN_NEXTREQ, DBTC);
+  tSignal.setSignal(GSN_SCAN_NEXTREQ, refToBlock(theNdbCon->m_tcRef));
   
   Uint32 last = m_sent_receivers_count;
   Uint32* theData = tSignal.getDataPtrSend();

=== modified file 'storage/ndb/src/ndbapi/NdbTransaction.cpp'
--- a/storage/ndb/src/ndbapi/NdbTransaction.cpp	2011-04-10 17:32:41 +0000
+++ b/storage/ndb/src/ndbapi/NdbTransaction.cpp	2011-04-27 11:50:17 +0000
@@ -84,7 +84,8 @@ NdbTransaction::NdbTransaction( Ndb* aNd
   pendingBlobReadBytes(0),
   pendingBlobWriteBytes(0),
   m_theFirstLockHandle(NULL),
-  m_theLastLockHandle(NULL)
+  m_theLastLockHandle(NULL),
+  m_tcRef(numberToRef(DBTC, 0))
 {
   theListState = NotInList;
   theError.code = 0;
@@ -960,7 +961,7 @@ NdbTransaction::sendTC_HBREP()		// Send 
     return -1;
   }
 
-  if (tSignal->setSignal(GSN_TC_HBREP, DBTC) == -1) {
+  if (tSignal->setSignal(GSN_TC_HBREP, refToBlock(m_tcRef)) == -1) {
     return -1;
   }
 
@@ -1112,7 +1113,7 @@ NdbTransaction::sendROLLBACK()      // S
 
     tTransId1 = (Uint32) theTransactionId;
     tTransId2 = (Uint32) (theTransactionId >> 32);
-    tSignal.setSignal(GSN_TCROLLBACKREQ, DBTC);
+    tSignal.setSignal(GSN_TCROLLBACKREQ, refToBlock(m_tcRef));
     tSignal.setData(theTCConPtr, 1);
     tSignal.setData(tTransId1, 2);
     tSignal.setData(tTransId2, 3);
@@ -1165,7 +1166,7 @@ NdbTransaction::sendCOMMIT()    // Send 
 
   tTransId1 = (Uint32) theTransactionId;
   tTransId2 = (Uint32) (theTransactionId >> 32);
-  tSignal.setSignal(GSN_TC_COMMITREQ, DBTC);
+  tSignal.setSignal(GSN_TC_COMMITREQ, refToBlock(m_tcRef));
   tSignal.setData(theTCConPtr, 1);
   tSignal.setData(tTransId1, 2);
   tSignal.setData(tTransId2, 3);
@@ -1835,6 +1836,17 @@ NdbTransaction::receiveTCSEIZECONF(const
   } else
   {
     theTCConPtr = (Uint32)aSignal->readData(2);
+    if (aSignal->getLength() >= 3)
+    {
+      m_tcRef = aSignal->readData(3);
+    }
+    else
+    {
+      m_tcRef = numberToRef(DBTC, theDBnode);
+    }
+
+    assert(m_tcRef == aSignal->theSendersBlockRef);
+
     theStatus = Connected;
   }
   return 0;

=== modified file 'storage/ndb/src/ndbapi/Ndbif.cpp'
--- a/storage/ndb/src/ndbapi/Ndbif.cpp	2011-04-10 17:32:41 +0000
+++ b/storage/ndb/src/ndbapi/Ndbif.cpp	2011-04-27 11:50:17 +0000
@@ -1437,7 +1437,7 @@ NdbTransaction::sendTC_COMMIT_ACK(NdbImp
 	   refToNode(aTCRef));
 #endif  
   aSignal->theTrace                = TestOrd::TraceAPI;
-  aSignal->theReceiversBlockNumber = DBTC;
+  aSignal->theReceiversBlockNumber = refToBlock(aTCRef);
   aSignal->theVerId_signalNumber   = GSN_TC_COMMIT_ACK;
   aSignal->theLength               = 2;
 

=== modified file 'storage/ndb/src/ndbapi/Ndblist.cpp'
--- a/storage/ndb/src/ndbapi/Ndblist.cpp	2011-02-10 07:55:45 +0000
+++ b/storage/ndb/src/ndbapi/Ndblist.cpp	2011-04-27 10:48:16 +0000
@@ -481,7 +481,7 @@ Ndb::releaseConnectToNdb(NdbTransaction*
 
   Uint32 node_id = a_con->getConnectedNodeId();
   Uint32 conn_seq = a_con->theNodeSequence;
-  tSignal.setSignal(GSN_TCRELEASEREQ, DBTC);
+  tSignal.setSignal(GSN_TCRELEASEREQ, refToBlock(a_con->m_tcRef));
   tSignal.setData((tConPtr = a_con->getTC_ConnectPtr()), 1);
   tSignal.setData(theMyRef, 2);
   tSignal.setData(a_con->ptr2int(), 3); 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (jonas:3484 to3485) Jonas Oreland27 Apr