List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:October 1 2010 9:45am
Subject:bzr commit into mysql-5.1-telco-6.3 branch (jonas:3292)
View as plain text  
#At file:///home/jonas/src/telco-6.3/ based on revid:jonas@stripped

 3292 Jonas Oreland	2010-10-01
      ndb - replace mysterious arguments for NodeStatusFunction with an enum

    modified:
      storage/ndb/include/ndbapi/Ndb.hpp
      storage/ndb/src/mgmsrv/MgmtSrvr.cpp
      storage/ndb/src/mgmsrv/MgmtSrvr.hpp
      storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
      storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
      storage/ndb/src/ndbapi/Ndbif.cpp
      storage/ndb/src/ndbapi/SignalSender.cpp
      storage/ndb/src/ndbapi/SignalSender.hpp
      storage/ndb/src/ndbapi/TransporterFacade.cpp
      storage/ndb/src/ndbapi/TransporterFacade.hpp
=== modified file 'storage/ndb/include/ndbapi/Ndb.hpp'
--- a/storage/ndb/include/ndbapi/Ndb.hpp	2010-02-11 10:57:41 +0000
+++ b/storage/ndb/include/ndbapi/Ndb.hpp	2010-10-01 09:45:39 +0000
@@ -1939,7 +1939,7 @@ private:
 
   static void executeMessage(void*, NdbApiSignal *, 
 			     struct LinearSectionPtr ptr[3]);
-  static void statusMessage(void*, Uint32, bool, bool);
+  static void statusMessage(void*, Uint32, Uint32);
 #ifdef VM_TRACE
 #include <my_attribute.h>
   void printState(const char* fmt, ...)

=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2010-08-30 09:07:26 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2010-10-01 09:45:39 +0000
@@ -2057,7 +2057,7 @@ MgmtSrvr::handleReceivedSignal(NdbApiSig
 }
 
 void
-MgmtSrvr::handleStatus(NodeId nodeId, bool alive, bool nfComplete)
+MgmtSrvr::handleStatus(NodeId nodeId, Uint32 _event)
 {
   DBUG_ENTER("MgmtSrvr::handleStatus");
   union {
@@ -2065,20 +2065,24 @@ MgmtSrvr::handleStatus(NodeId nodeId, bo
     EventReport repData;
   };
   EventReport * rep = &repData;
+  NS_Event event = (NS_Event)_event;
 
   theData[1] = nodeId;
-  if (alive) {
+  switch(event){
+  case NS_CONNECTED:
+    DBUG_VOID_RETURN;
+  case NS_NODE_ALIVE:
     if (nodeTypes[nodeId] == NODE_TYPE_DB)
     {
       m_started_nodes.push_back(nodeId);
     }
     rep->setEventType(NDB_LE_Connected);
-  } else {
+    break;
+  case NS_NODE_FAILED:
     rep->setEventType(NDB_LE_Disconnected);
-    if(nfComplete)
-    {
-      DBUG_VOID_RETURN;
-    }
+    break;
+  case NS_NODE_NF_COMPLETE:
+    DBUG_VOID_RETURN;
   }
   rep->setNodeId(_ownNodeId);
   eventReport(theData, 1);
@@ -2100,12 +2104,11 @@ MgmtSrvr::signalReceivedNotification(voi
 //****************************************************************************
 //****************************************************************************
 void 
-MgmtSrvr::nodeStatusNotification(void* mgmSrv, Uint32 nodeId, 
-				 bool alive, bool nfComplete)
+MgmtSrvr::nodeStatusNotification(void* mgmSrv, Uint32 nodeId, Uint32 event)
 {
   DBUG_ENTER("MgmtSrvr::nodeStatusNotification");
-  DBUG_PRINT("enter",("nodeid= %d, alive= %d, nfComplete= %d", nodeId, alive, nfComplete));
-  ((MgmtSrvr*)mgmSrv)->handleStatus(nodeId, alive, nfComplete);
+  DBUG_PRINT("enter",("nodeid= %d, event: %u", nodeId, event));
+  ((MgmtSrvr*)mgmSrv)->handleStatus(nodeId, event);
   DBUG_VOID_RETURN;
 }
 

=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.hpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2010-03-02 14:18:53 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2010-10-01 09:45:39 +0000
@@ -542,7 +542,7 @@ private:
   // Returns: -
   //**************************************************************************
 
-  void handleStatus(NodeId nodeId, bool alive, bool nfComplete);
+  void handleStatus(NodeId nodeId, Uint32 event);
   //**************************************************************************
   // Description: Handle the death of a process
   // Parameters:
@@ -591,8 +591,7 @@ private:
    *                       shall receive the notification.
    *   @param  processId:  Id of the dead process.
    */
-  static void nodeStatusNotification(void* mgmSrv, Uint32 nodeId, 
-				     bool alive, bool nfCompleted);
+  static void nodeStatusNotification(void* mgmSrv, Uint32 nodeId, Uint32 event);
   
   /**
    * An event from <i>nodeId</i> has arrived

=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2010-09-14 09:25:48 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2010-10-01 09:45:39 +0000
@@ -2192,17 +2192,17 @@ NdbDictInterface::execSignal(void* dictI
 }
 
 void
-NdbDictInterface::execNodeStatus(void* dictImpl, Uint32 aNode,
-				 bool alive, bool nfCompleted)
+NdbDictInterface::execNodeStatus(void* dictImpl, Uint32 aNode, Uint32 ns_event)
 {
   NdbDictInterface * tmp = (NdbDictInterface*)dictImpl;
+  NS_Event event = (NS_Event)ns_event;
   
-  if(!alive && !nfCompleted){
-    return;
-  }
-  
-  if (!alive && nfCompleted){
+  switch(event){
+  case NS_NODE_FAILED:
     tmp->m_waiter.nodeFail(aNode);
+    break;
+  default:
+    break;
   }
 }
 

=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2010-09-22 12:06:29 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2010-10-01 09:45:39 +0000
@@ -647,8 +647,7 @@ private:
 			 class NdbApiSignal* signal, 
 			 struct LinearSectionPtr ptr[3]);
   
-  static void execNodeStatus(void* dictImpl, Uint32, 
-			     bool alive, bool nfCompleted);  
+  static void execNodeStatus(void* dictImpl, Uint32, Uint32);
   
   void execGET_TABINFO_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
   void execGET_TABINFO_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);

=== modified file 'storage/ndb/src/ndbapi/Ndbif.cpp'
--- a/storage/ndb/src/ndbapi/Ndbif.cpp	2010-08-26 09:00:51 +0000
+++ b/storage/ndb/src/ndbapi/Ndbif.cpp	2010-10-01 09:45:39 +0000
@@ -222,28 +222,30 @@ void Ndb::report_node_connected(Uint32 n
 }
 
 void
-Ndb::statusMessage(void* NdbObject, Uint32 a_node, bool alive, bool nfComplete)
+Ndb::statusMessage(void* NdbObject, Uint32 a_node, Uint32 _event)
 {
   DBUG_ENTER("Ndb::statusMessage");
-  DBUG_PRINT("info", ("a_node: %u  alive: %u  nfComplete: %u",
-                      a_node, alive, nfComplete));
+  NS_Event event = (NS_Event)_event;
+  DBUG_PRINT("info", ("a_node: %u  event: %u",
+                      a_node, _event));
   Ndb* tNdb = (Ndb*)NdbObject;
-  if (alive) {
-    if (nfComplete) {
-      // cluster connect, a_node == own reference
-      tNdb->connected(a_node);
-      DBUG_VOID_RETURN;
-    }//if
+  switch(event){
+  case NS_CONNECTED:
+    // cluster connect, a_node == own reference
+    tNdb->connected(a_node);
+    break;
+  case NS_NODE_ALIVE:
     tNdb->report_node_connected(a_node);
-  } else {
-    if (nfComplete) {
-      tNdb->report_node_failure_completed(a_node);
-    } else {
-      tNdb->report_node_failure(a_node);
-    }//if
+    break;
+  case NS_NODE_FAILED:
+    tNdb->report_node_failure(a_node);
+    break;
+  case NS_NODE_NF_COMPLETE:
+    tNdb->report_node_failure_completed(a_node);
+    break;
   }//if
   NdbDictInterface::execNodeStatus(&tNdb->theDictionary->m_receiver,
-				   a_node, alive, nfComplete);
+				   a_node, event);
   DBUG_VOID_RETURN;
 }
 

=== modified file 'storage/ndb/src/ndbapi/SignalSender.cpp'
--- a/storage/ndb/src/ndbapi/SignalSender.cpp	2010-02-19 11:04:34 +0000
+++ b/storage/ndb/src/ndbapi/SignalSender.cpp	2010-10-01 09:45:39 +0000
@@ -249,18 +249,25 @@ SignalSender::execSignal(void* signalSen
 void 
 SignalSender::execNodeStatus(void* signalSender, 
 			     Uint32 nodeId, 
-			     bool alive, 
-			     bool nfCompleted){
-  if (alive) {
-    // node connected
+                             Uint32 _event)
+{
+  NS_Event event = (NS_Event)_event;
+  switch(event){
+  case NS_CONNECTED:
+  case NS_NODE_ALIVE:
     return;
+  case NS_NODE_FAILED:
+  case NS_NODE_NF_COMPLETE:
+    goto ok;
   }
+  return;
 
+ok:
   SimpleSignal * s = new SimpleSignal(true);
   SignalSender * ss = (SignalSender*)signalSender;
 
   // node disconnected
-  if(nfCompleted)
+  if (event == NS_NODE_NF_COMPLETE)
   {
     // node shutdown complete
     s->header.theVerId_signalNumber = GSN_NF_COMPLETEREP;

=== modified file 'storage/ndb/src/ndbapi/SignalSender.hpp'
--- a/storage/ndb/src/ndbapi/SignalSender.hpp	2010-03-16 08:50:44 +0000
+++ b/storage/ndb/src/ndbapi/SignalSender.hpp	2010-10-01 09:45:39 +0000
@@ -98,8 +98,7 @@ private:
 			 NdbApiSignal* signal, 
 			 class LinearSectionPtr ptr[3]);
   
-  static void execNodeStatus(void* signalSender, Uint32 nodeId, 
-			     bool alive, bool nfCompleted);
+  static void execNodeStatus(void* signalSender, Uint32 nodeId, Uint32 event);
   
   int m_lock;
   struct NdbCondition * m_cond;

=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.cpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.cpp	2010-08-17 11:48:42 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.cpp	2010-10-01 09:45:39 +0000
@@ -846,7 +846,7 @@ TransporterFacade::connected()
     if (m_threads.getInUse(i)){
       void * obj = m_threads.m_objectExecute[i].m_object;
       NodeStatusFunction RegPC = m_threads.m_statusFunction[i];
-      (*RegPC) (obj, numberToRef(indexToNumber(i), theOwnId), true, true);
+      (*RegPC) (obj, numberToRef(indexToNumber(i), theOwnId), NS_CONNECTED);
     }
   }
   DBUG_VOID_RETURN;
@@ -870,7 +870,7 @@ TransporterFacade::ReportNodeDead(NodeId
     if (m_threads.getInUse(i)){
       void * obj = m_threads.m_objectExecute[i].m_object;
       NodeStatusFunction RegPC = m_threads.m_statusFunction[i];
-      (*RegPC) (obj, tNodeId, false, false);
+      (*RegPC) (obj, tNodeId, NS_NODE_FAILED);
     }
   }
   DBUG_VOID_RETURN;
@@ -895,7 +895,7 @@ TransporterFacade::ReportNodeFailureComp
     if (m_threads.getInUse(i)){
       void * obj = m_threads.m_objectExecute[i].m_object;
       NodeStatusFunction RegPC = m_threads.m_statusFunction[i];
-      (*RegPC) (obj, tNodeId, false, true);
+      (*RegPC) (obj, tNodeId, NS_NODE_NF_COMPLETE);
     }
   }
   DBUG_VOID_RETURN;
@@ -918,7 +918,7 @@ TransporterFacade::ReportNodeAlive(NodeI
     if (m_threads.getInUse(i)){
       void * obj = m_threads.m_objectExecute[i].m_object;
       NodeStatusFunction RegPC = m_threads.m_statusFunction[i];
-      (*RegPC) (obj, tNodeId, true, false);
+      (*RegPC) (obj, tNodeId, NS_NODE_ALIVE);
     }
   }
 }
@@ -951,7 +951,7 @@ TransporterFacade::open(void* objRef, 
     DBUG_RETURN(r);
 #if 1
   if (theOwnId > 0) {
-    (*statusFun)(objRef, numberToRef(r, theOwnId), true, true);
+    (*statusFun)(objRef, numberToRef(r, theOwnId), NS_CONNECTED);
   }
 #endif
   DBUG_RETURN(r);

=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.hpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.hpp	2010-08-26 09:00:51 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.hpp	2010-10-01 09:45:39 +0000
@@ -38,8 +38,16 @@ class Ndb;
 class NdbApiSignal;
 class NdbWaiter;
 
+enum NS_Event
+{
+  NS_CONNECTED,   // *we* are connected and have nodeId (report as NodeId)
+  NS_NODE_ALIVE,  // *nodeId* is alive (connected and API_REGCONF)
+  NS_NODE_FAILED, // *nodeId* has failed
+  NS_NODE_NF_COMPLETE
+};
+
 typedef void (* ExecuteFunction)(void *, NdbApiSignal *, LinearSectionPtr ptr[3]);
-typedef void (* NodeStatusFunction)(void *, Uint32, bool nodeAlive, bool nfComplete);
+typedef void (* NodeStatusFunction)(void *, Uint32, Uint32 ns_Event);
 
 extern "C" {
   void* runSendRequest_C(void*);


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20101001094539-j55nk83h8iduhlh0.bundle
Thread
bzr commit into mysql-5.1-telco-6.3 branch (jonas:3292) Jonas Oreland1 Oct