sendCommitLqh/sendCompleteLqh

sendCommitLqh/sendCompleteLqh currently sends 16 commit/complete
in tight loop before doing continueb

Change this so that it counts local/remote differently signals

---
 storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp     |    6 ++--
 storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp |   36 +++++++++++++++---------
 2 files changed, 26 insertions(+), 16 deletions(-)

Index: 64-rel/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
===================================================================
--- 64-rel.orig/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2009-12-21 12:14:02.000000000 +0100
+++ 64-rel/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2009-12-21 12:14:56.000000000 +0100
@@ -1393,10 +1393,10 @@ private:
                             HostRecord * ahostptr,
                             UintR hostId);
   void sendPackedSignalLqh(Signal* signal, HostRecord * ahostptr);
-  void sendCommitLqh(Signal* signal,
-                     TcConnectRecord * const regTcPtr);
-  void sendCompleteLqh(Signal* signal,
+  Uint32 sendCommitLqh(Signal* signal,
                        TcConnectRecord * const regTcPtr);
+  Uint32 sendCompleteLqh(Signal* signal,
+                         TcConnectRecord * const regTcPtr);
   void sendTCKEY_FAILREF(Signal* signal, ApiConnectRecord *);
   void sendTCKEY_FAILCONF(Signal* signal, ApiConnectRecord *);
   void routeTCKEY_FAILREFCONF(Signal* signal, const ApiConnectRecord *, 
Index: 64-rel/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
===================================================================
--- 64-rel.orig/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2009-12-21 12:14:02.000000000 +0100
+++ 64-rel/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2009-12-21 12:26:59.000000000 +0100
@@ -4829,10 +4829,9 @@ void Dbtc::commit020Lab(Signal* signal) 
     /* *********< */
     localTcConnectptr.i = localTcConnectptr.p->nextTcConnect;
     localTcConnectptr.p->tcConnectstate = OS_COMMITTING;
-    sendCommitLqh(signal, localTcConnectptr.p);
+    Tcount += sendCommitLqh(signal, localTcConnectptr.p);
 
     if (localTcConnectptr.i != RNIL) {
-      Tcount = Tcount + 1;
       if (Tcount < 16 && !ERROR_INSERTED(8057) && !ERROR_INSERTED(8073)) {
         ptrCheckGuard(localTcConnectptr,
                       TtcConnectFilesize, localTcConnectRecord);
@@ -4869,8 +4868,9 @@ void Dbtc::commit020Lab(Signal* signal) 
   } while (1);
 }//Dbtc::commit020Lab()
 
-void Dbtc::sendCommitLqh(Signal* signal,
-                         TcConnectRecord * const regTcPtr)
+Uint32
+Dbtc::sendCommitLqh(Signal* signal,
+                    TcConnectRecord * const regTcPtr)
 {
   HostRecordPtr Thostptr;
   UintR ThostFilesize = chostFilesize;
@@ -4878,6 +4878,10 @@ void Dbtc::sendCommitLqh(Signal* signal,
   Thostptr.i = regTcPtr->lastLqhNodeId;
   ptrCheckGuard(Thostptr, ThostFilesize, hostRecord);
 
+  Uint32 Tnode = Thostptr.i;
+  Uint32 self = getOwnNodeId();
+  Uint32 ret = (Tnode == self) ? 4 : 1;
+
   Uint32 Tdata[5];
   Tdata[0] = regTcPtr->lastLqhCon;
   Tdata[1] = Uint32(regApiPtr->globalcheckpointid >> 32);
@@ -4896,13 +4900,11 @@ void Dbtc::sendCommitLqh(Signal* signal,
   // currently packed signal cannot address specific instance
   const bool send_unpacked = getNodeInfo(Thostptr.i).m_lqh_workers != 0;
   if (send_unpacked) {
-    Uint32* data = signal->getDataPtrSend();
     memcpy(&signal->theData[0], &Tdata[0], len << 2);
-    Uint32 Tnode = Thostptr.i;
     Uint32 instanceKey = regTcPtr->lqhInstanceKey;
     BlockReference lqhRef = numberToRef(DBLQH, instanceKey, Tnode);
     sendSignal(lqhRef, GSN_COMMIT, signal, len, JBB);
-    return;
+    return ret;
   }
 
   if (Thostptr.p->noOfPackedWordsLqh > 25 - 5) {
@@ -4910,6 +4912,7 @@ void Dbtc::sendCommitLqh(Signal* signal,
     sendPackedSignalLqh(signal, Thostptr.p);
   } else {
     jam();
+    ret = 1;
     updatePackedList(signal, Thostptr.p, Thostptr.i);
   }
 
@@ -4918,6 +4921,7 @@ void Dbtc::sendCommitLqh(Signal* signal,
   UintR* TDataPtr = &Thostptr.p->packedWordsLqh[Tindex];
   memcpy(TDataPtr, &Tdata[0], len << 2);
   Thostptr.p->noOfPackedWordsLqh = Tindex + len;
+  return ret;
 }
 
 void
@@ -5227,10 +5231,9 @@ void Dbtc::complete010Lab(Signal* signal
     /*  COMPLETE  < */
     /* ************ */
     const Uint32 nextTcConnect = localTcConnectptr.p->nextTcConnect;
-    sendCompleteLqh(signal, localTcConnectptr.p);
+    Tcount += sendCompleteLqh(signal, localTcConnectptr.p);
     localTcConnectptr.i = nextTcConnect;
     if (localTcConnectptr.i != RNIL) {
-      Tcount++;
       if (Tcount < 16) {
         ptrCheckGuard(localTcConnectptr,
                       TtcConnectFilesize, localTcConnectRecord);
@@ -5256,8 +5259,9 @@ void Dbtc::complete010Lab(Signal* signal
   } while (1);
 }//Dbtc::complete010Lab()
 
-void Dbtc::sendCompleteLqh(Signal* signal,
-                           TcConnectRecord * const regTcPtr)
+Uint32
+Dbtc::sendCompleteLqh(Signal* signal,
+                      TcConnectRecord * const regTcPtr)
 {
   HostRecordPtr Thostptr;
   UintR ThostFilesize = chostFilesize;
@@ -5265,6 +5269,10 @@ void Dbtc::sendCompleteLqh(Signal* signa
   Thostptr.i = regTcPtr->lastLqhNodeId; //last???
   ptrCheckGuard(Thostptr, ThostFilesize, hostRecord);
 
+  Uint32 Tnode = Thostptr.i;
+  Uint32 self = getOwnNodeId();
+  Uint32 ret = (Tnode == self) ? 4 : 1;
+
   Uint32 Tdata[3];
   Tdata[0] = regTcPtr->lastLqhCon;
   Tdata[1] = regApiPtr->transid[0];
@@ -5275,11 +5283,10 @@ void Dbtc::sendCompleteLqh(Signal* signa
   const bool send_unpacked = getNodeInfo(Thostptr.i).m_lqh_workers != 0;
   if (send_unpacked) {
     memcpy(&signal->theData[0], &Tdata[0], len << 2);
-    Uint32 Tnode = Thostptr.i;
     Uint32 instanceKey = regTcPtr->lqhInstanceKey;
     BlockReference lqhRef = numberToRef(DBLQH, instanceKey, Tnode);
     sendSignal(lqhRef, GSN_COMPLETE, signal, 3, JBB);
-    return;
+    return ret;
   }
   
   if (Thostptr.p->noOfPackedWordsLqh > 22) {
@@ -5287,6 +5294,7 @@ void Dbtc::sendCompleteLqh(Signal* signa
     sendPackedSignalLqh(signal, Thostptr.p);
   } else {
     jam();
+    ret = 1;
     updatePackedList(signal, Thostptr.p, Thostptr.i);
   }
 
@@ -5295,6 +5303,8 @@ void Dbtc::sendCompleteLqh(Signal* signa
   UintR* TDataPtr = &Thostptr.p->packedWordsLqh[Tindex];
   memcpy(TDataPtr, &Tdata[0], len << 2);
   Thostptr.p->noOfPackedWordsLqh = Tindex + len;
+
+  return ret;
 }
 
 void
