List:Internals« Previous MessageNext Message »
From:Stewart Smith Date:September 21 2005 4:41pm
Subject:bk commit into 4.1 tree (stewart:1.2438) BUG#12037
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of stewart. When stewart 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
  1.2438 05/09/22 00:41:46 stewart@stripped +5 -0
  BUG#11595 ndb_mgm shows from IP for second mgmd
  BUG#12037 ndb_mgmd IP address do not show in other ndb_mgmd processes
  
  Extend ApiVersionConf to include address.

  ndb/src/mgmsrv/Services.cpp
    1.38 05/09/22 00:41:44 stewart@stripped +5 -3
    Get the connect address from mgmsrv.status()

  ndb/src/mgmsrv/MgmtSrvr.hpp
    1.32 05/09/22 00:41:44 stewart@stripped +4 -3
    Add char **address to prototypes.

  ndb/src/mgmsrv/MgmtSrvr.cpp
    1.71 05/09/22 00:41:44 stewart@stripped +43 -7
    ::status() now also returns char* address of the node.
    For API or MGM, this is in ApiVersionConf.
    For NDB, this is the standard get_connect_address.
    
    When sending ApiVersionReq, try to send to a STARTED node (as these have
    properly joined the cluster and know the connect addresses).
    
    If versionNode is called for getOwnNodeId()==nodeId, try to get the address
    via ApiVersionConf. If that fails, look it up in the configuration.

  ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
    1.15 05/09/22 00:41:41 stewart@stripped +2 -0
    include connect address in ApiVersionConf

  ndb/include/kernel/signaldata/ApiVersion.hpp
    1.2 05/09/22 00:41:40 stewart@stripped +2 -3
    Extend ApiVersionConf to include inet_addr. the address used for communication to this
node.

# 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:	stewart
# Host:	willster.(none)
# Root:	/home/stewart/Documents/MySQL/4.1/mgmd

--- 1.1/ndb/include/kernel/signaldata/ApiVersion.hpp	2004-04-14 18:23:53 +10:00
+++ 1.2/ndb/include/kernel/signaldata/ApiVersion.hpp	2005-09-22 00:41:40 +10:00
@@ -49,12 +49,11 @@
    */
   friend class MgmtSrv;  
 public:
-  STATIC_CONST( SignalLength = 3 );
+  STATIC_CONST( SignalLength = 4 );
   Uint32 senderRef; 
   Uint32 nodeId; //api node id
   Uint32 version; // Version of API node
-
-  
+  Uint32 inet_addr;
 };
 
 #endif

--- 1.14/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2005-08-18 22:04:50 +10:00
+++ 1.15/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2005-09-22 00:41:41 +10:00
@@ -2012,6 +2012,8 @@
   else
     conf->version =  0;
   conf->nodeId = nodeId;
+  struct in_addr in= globalTransporterRegistry.get_connect_address(nodeId);
+  conf->inet_addr= in.s_addr;
 
   sendSignal(senderRef, 
 	     GSN_API_VERSION_CONF,

--- 1.70/ndb/src/mgmsrv/MgmtSrvr.cpp	2005-09-20 17:34:43 +10:00
+++ 1.71/ndb/src/mgmsrv/MgmtSrvr.cpp	2005-09-22 00:41:44 +10:00
@@ -690,30 +690,46 @@
  *****************************************************************************/
 
 int 
-MgmtSrvr::versionNode(int nodeId, Uint32 &version)
+MgmtSrvr::versionNode(int nodeId, Uint32 &version, const char **address)
 {
   version= 0;
   if (getOwnNodeId() == nodeId)
   {
+    sendVersionReq(nodeId, version, address);
     version= NDB_VERSION;
+    if(!*address)
+    {
+      ndb_mgm_configuration_iterator
+	iter(*_config->m_configValues, CFG_SECTION_NODE);
+      unsigned tmp= 0;
+      for(iter.first();iter.valid();iter.next())
+      {
+	if(iter.get(CFG_NODE_ID, &tmp)) require(false);
+	if((unsigned)nodeId!=tmp)
+	  continue;
+	if(iter.get(CFG_NODE_HOST, address)) require(false);
+	break;
+      }
+    }
   }
   else if (getNodeType(nodeId) == NDB_MGM_NODE_TYPE_NDB)
   {
     ClusterMgr::Node node= theFacade->theClusterMgr->getNodeInfo(nodeId);
     if(node.connected)
       version= node.m_info.m_version;
+    *address= get_connect_address(nodeId);
   }
   else if (getNodeType(nodeId) == NDB_MGM_NODE_TYPE_API ||
 	   getNodeType(nodeId) == NDB_MGM_NODE_TYPE_MGM)
   {
-    return sendVersionReq(nodeId, version);
+    return sendVersionReq(nodeId, version, address);
   }
 
   return 0;
 }
 
 int 
-MgmtSrvr::sendVersionReq(int v_nodeId, Uint32 &version)
+MgmtSrvr::sendVersionReq(int v_nodeId, Uint32 &version, const char **address)
 {
   SignalSender ss(theFacade);
   ss.lock();
@@ -734,10 +750,23 @@
     {
       bool next;
       nodeId = 0;
+
       while((next = getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) == true &&
 	    okToSendTo(nodeId, true) != 0);
+
+      const ClusterMgr::Node &node=
+	theFacade->theClusterMgr->getNodeInfo(nodeId);
+      if(next && node.m_state.startLevel != NodeState::SL_STARTED)
+      {
+	NodeId tmp=nodeId;
+	while((next = getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) == true &&
+	      okToSendTo(nodeId, true) != 0);
+	if(!next)
+	  nodeId= tmp;
+      }
+
       if(!next) return NO_CONTACT_WITH_DB_NODES;
-  
+
       if (ss.sendSignal(nodeId, &ssig) != SEND_OK) {
 	return SEND_OR_RECEIVE_FAILED;
       }
@@ -753,6 +782,9 @@
 	CAST_CONSTPTR(ApiVersionConf, signal->getDataPtr());
       assert(conf->nodeId == v_nodeId);
       version = conf->version;
+      struct in_addr in;
+      in.s_addr= conf->inet_addr;
+      *address= inet_ntoa(in);
       return 0;
     }
     case GSN_NF_COMPLETEREP:{
@@ -1060,8 +1092,9 @@
       Uint32 startPhase = 0, version = 0, dynamicId = 0, nodeGroup = 0;
       Uint32 connectCount = 0;
       bool system;
+      const char *address;
       status(nodeId, &s, &version, &startPhase, 
-	     &system, &dynamicId, &nodeGroup, &connectCount);
+	     &system, &dynamicId, &nodeGroup, &connectCount, &address);
       NdbSleep_MilliSleep(100);  
       waitTime = (maxTime - NdbTick_CurrentMillisecond());
     }
@@ -1137,11 +1170,14 @@
 		 bool * _system,
 		 Uint32 * dynamic,
 		 Uint32 * nodegroup,
-		 Uint32 * connectCount)
+		 Uint32 * connectCount,
+		 const char **address)
 {
   if (getNodeType(nodeId) == NDB_MGM_NODE_TYPE_API ||
       getNodeType(nodeId) == NDB_MGM_NODE_TYPE_MGM) {
-    versionNode(nodeId, *version);
+    versionNode(nodeId, *version, address);
+  } else {
+    *address= get_connect_address(nodeId);
   }
 
   const ClusterMgr::Node node = 

--- 1.31/ndb/src/mgmsrv/MgmtSrvr.hpp	2005-09-20 17:34:43 +10:00
+++ 1.32/ndb/src/mgmsrv/MgmtSrvr.hpp	2005-09-22 00:41:44 +10:00
@@ -208,7 +208,8 @@
 	     bool * systemShutdown,
 	     Uint32 * dynamicId,
 	     Uint32 * nodeGroup,
-	     Uint32 * connectCount);
+	     Uint32 * connectCount,
+	     const char **address);
   
   // All the functions below may return any of this error codes:
   // NO_CONTACT_WITH_PROCESS, PROCESS_NOT_CONFIGURED, WRONG_PROCESS_TYPE,
@@ -255,7 +256,7 @@
    *   @param   processId: Id of the DB process to stop
    *   @return  0 if succeeded, otherwise: as stated above, plus:
    */
-  int versionNode(int nodeId, Uint32 &version);
+  int versionNode(int nodeId, Uint32 &version, const char **address);
 
   /**
    *   Maintenance on the system
@@ -611,7 +612,7 @@
 
   class TransporterFacade * theFacade;
 
-  int  sendVersionReq( int processId, Uint32 &version);
+  int  sendVersionReq( int processId, Uint32 &version, const char **address);
   int translateStopRef(Uint32 errCode);
   
   bool _isStopThread;

--- 1.37/ndb/src/mgmsrv/Services.cpp	2005-09-20 17:34:43 +10:00
+++ 1.38/ndb/src/mgmsrv/Services.cpp	2005-09-22 00:41:44 +10:00
@@ -903,8 +903,10 @@
       nodeGroup = 0,
       connectCount = 0;
     bool system;
-    mgmsrv.status(nodeId, &status, &version, &startPhase, 
-		  &system, &dynamicId, &nodeGroup, &connectCount);
+    const char *address= NULL;
+    mgmsrv.status(nodeId, &status, &version, &startPhase,
+		  &system, &dynamicId, &nodeGroup, &connectCount,
+		  &address);
     output->println("node.%d.type: %s",
 		      nodeId,
 		      ndb_mgm_get_node_type_string(type));
@@ -916,7 +918,7 @@
     output->println("node.%d.dynamic_id: %d", nodeId, dynamicId);
     output->println("node.%d.node_group: %d", nodeId, nodeGroup);
     output->println("node.%d.connect_count: %d", nodeId, connectCount);
-    output->println("node.%d.address: %s", nodeId,
mgmsrv.get_connect_address(nodeId));
+    output->println("node.%d.address: %s", nodeId, address);
   }
 
 }
Thread
bk commit into 4.1 tree (stewart:1.2438) BUG#12037Stewart Smith21 Sep