List:Commits« Previous MessageNext Message »
From:jonas Date:October 23 2006 11:16am
Subject:bk commit into 5.0 tree (jonas:1.2257)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jonas. When jonas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-10-23 13:16:05+02:00, jonas@stripped +4 -0
  ndb - Add support for routing TCKEY_FAILREF/CONF
    Assumes API is always fully connected to a node group, if connected to any node in node group
    This should make partially connected API fully functional

  ndb/include/kernel/GlobalSignalNumbers.h@stripped, 2006-10-23 13:16:03+02:00, jonas@stripped +2 -1
    Add support for routing TCKEY_FAILREF/CONF

  ndb/src/kernel/blocks/dbtc/Dbtc.hpp@stripped, 2006-10-23 13:16:04+02:00, jonas@stripped +3 -0
    Add support for routing TCKEY_FAILREF/CONF

  ndb/src/kernel/blocks/dbtc/DbtcInit.cpp@stripped, 2006-10-23 13:16:04+02:00, jonas@stripped +2 -1
    Add support for routing TCKEY_FAILREF/CONF

  ndb/src/kernel/blocks/dbtc/DbtcMain.cpp@stripped, 2006-10-23 13:16:04+02:00, jonas@stripped +103 -6
    Add support for routing TCKEY_FAILREF/CONF

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jonas
# Host:	perch.ndb.mysql.com
# Root:	/home/jonas/src/50-alcatel

--- 1.16/ndb/include/kernel/GlobalSignalNumbers.h	2006-10-23 13:16:09 +02:00
+++ 1.17/ndb/include/kernel/GlobalSignalNumbers.h	2006-10-23 13:16:09 +02:00
@@ -91,7 +91,8 @@
 #define GSN_TCSEIZEREF                  38
 #define GSN_TCSEIZEREQ                  39
 
-/* 40 unused */
+#define GSN_TCKEY_FAILREFCONF_R         40
+
 /* 41 unused */
 /* 42 unused */
 /* 43 unused */

--- 1.35/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2006-10-23 13:16:09 +02:00
+++ 1.36/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2006-10-23 13:16:09 +02:00
@@ -1383,6 +1383,9 @@
                        TcConnectRecord * const regTcPtr);
   void sendTCKEY_FAILREF(Signal* signal, const ApiConnectRecord *);
   void sendTCKEY_FAILCONF(Signal* signal, ApiConnectRecord *);
+  void routeTCKEY_FAILREFCONF(Signal* signal, const ApiConnectRecord *, 
+			      Uint32 gsn, Uint32 len);
+  void execTCKEY_FAILREFCONF_R(Signal* signal);
   void checkStartTimeout(Signal* signal);
   void checkStartFragTimeout(Signal* signal);
   void timeOutFoundFragLab(Signal* signal, Uint32 TscanConPtr);

--- 1.12/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp	2006-10-23 13:16:09 +02:00
+++ 1.13/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp	2006-10-23 13:16:09 +02:00
@@ -290,7 +290,8 @@
   addRecSignal(GSN_WAIT_DROP_TAB_CONF, &Dbtc::execWAIT_DROP_TAB_CONF);
   
   addRecSignal(GSN_ALTER_TAB_REQ, &Dbtc::execALTER_TAB_REQ);
-
+  addRecSignal(GSN_TCKEY_FAILREFCONF_R, &Dbtc::execTCKEY_FAILREFCONF_R);
+  
   cacheRecord = 0;
   apiConnectRecord = 0;
   tcConnectRecord = 0;

--- 1.97/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2006-10-23 13:16:09 +02:00
+++ 1.98/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2006-10-23 13:16:09 +02:00
@@ -70,6 +70,7 @@
 
 #include <NdbOut.hpp>
 #include <DebuggerNames.hpp>
+#include <signaldata/CheckNodeGroups.hpp>
 
 // Use DEBUG to print messages that should be
 // seen only when we debug the product
@@ -7482,12 +7483,24 @@
   jam();
 
   const Uint32 ref = regApiPtr->ndbapiBlockref;
-  if(ref != 0){
+  const Uint32 nodeId = refToNode(ref);
+  if(ref != 0)
+  {
+    jam();
+    bool connectedToNode = getNodeInfo(nodeId).m_connected;
     signal->theData[0] = regApiPtr->ndbapiConnect;
     signal->theData[1] = regApiPtr->transid[0];
     signal->theData[2] = regApiPtr->transid[1];
-  
-    sendSignal(ref, GSN_TCKEY_FAILREF, signal, 3, JBB);
+    
+    if (likely(connectedToNode))
+    {
+      jam();
+      sendSignal(ref, GSN_TCKEY_FAILREF, signal, 3, JBB);
+    }
+    else
+    {
+      routeTCKEY_FAILREFCONF(signal, regApiPtr, GSN_TCKEY_FAILREF, 3);
+    }
   }
 }
 
@@ -7498,15 +7511,99 @@
   
   const Uint32 ref = regApiPtr->ndbapiBlockref;
   const Uint32 marker = regApiPtr->commitAckMarker;
-  if(ref != 0){
+  const Uint32 nodeId = refToNode(ref);
+  if(ref != 0)
+  {
+    jam()
     failConf->apiConnectPtr = regApiPtr->ndbapiConnect | (marker != RNIL);
     failConf->transId1 = regApiPtr->transid[0];
     failConf->transId2 = regApiPtr->transid[1];
     
-    sendSignal(regApiPtr->ndbapiBlockref,
-	       GSN_TCKEY_FAILCONF, signal, TcKeyFailConf::SignalLength, JBB);
+    bool connectedToNode = getNodeInfo(nodeId).m_connected;
+    if (likely(connectedToNode))
+    {
+      jam();
+      sendSignal(ref, GSN_TCKEY_FAILCONF, signal, 
+		 TcKeyFailConf::SignalLength, JBB);
+    }
+    else
+    {
+      routeTCKEY_FAILREFCONF(signal, regApiPtr,
+			     GSN_TCKEY_FAILCONF, TcKeyFailConf::SignalLength);
+    }
   }
   regApiPtr->commitAckMarker = RNIL;
+}
+
+void
+Dbtc::routeTCKEY_FAILREFCONF(Signal* signal, const ApiConnectRecord* regApiPtr,
+			     Uint32 gsn, Uint32 len)
+{
+  jam();
+
+  Uint32 ref = regApiPtr->ndbapiBlockref;
+
+  /**
+   * We're not connected
+   *   so we find another node in same node group as died node
+   *   and send to it, so that it can forward
+   */
+  tcNodeFailptr.i = regApiPtr->takeOverRec;
+  ptrCheckGuard(tcNodeFailptr, 1, tcFailRecord);
+
+  /**
+   * Save signal
+   */
+  Uint32 save[25];
+  ndbrequire(len <= 25);
+  memcpy(save, signal->theData, 4*len);
+  
+  Uint32 node = tcNodeFailptr.p->takeOverNode;
+  
+  CheckNodeGroups * sd = (CheckNodeGroups*)signal->getDataPtrSend();
+  sd->blockRef = reference();
+  sd->requestType =
+    CheckNodeGroups::Direct |
+    CheckNodeGroups::GetNodeGroupMembers;
+  sd->nodeId = node;
+  EXECUTE_DIRECT(DBDIH, GSN_CHECKNODEGROUPSREQ, signal, 
+		 CheckNodeGroups::SignalLength);
+  jamEntry();
+  
+  NdbNodeBitmask mask;
+  mask.assign(sd->mask);
+  
+  memcpy(signal->theData, save, 4*len);
+  
+  Uint32 i = 0;
+  while((i = mask.find(i + 1)) != NdbNodeBitmask::NotFound)
+  {
+    jam();
+    HostRecordPtr localHostptr;
+    localHostptr.i = i;
+    ptrCheckGuard(localHostptr, chostFilesize, hostRecord);
+    if (localHostptr.p->hostStatus == HS_ALIVE) 
+    {
+      jam();
+      signal->theData[len] = gsn;
+      signal->theData[len+1] = ref;
+      sendSignal(calcTcBlockRef(i), GSN_TCKEY_FAILREFCONF_R, 
+		 signal, len+2, JBB);
+      return;
+    }
+  }
+  
+  ndbrequire(false); // Unable to find alive node in node group...
+}
+
+void
+Dbtc::execTCKEY_FAILREFCONF_R(Signal* signal)
+{
+  jamEntry();
+  Uint32 len = signal->getLength();
+  Uint32 gsn = signal->theData[len-2];
+  Uint32 ref = signal->theData[len-1];
+  sendSignal(ref, gsn, signal, len-2, JBB);
 }
 
 /*------------------------------------------------------------*/
Thread
bk commit into 5.0 tree (jonas:1.2257)jonas23 Oct