List:Commits« Previous MessageNext Message »
From:Magnus Svensson Date:November 12 2008 9:22am
Subject:bzr commit into mysql-5.1 branch (msvensson:3062) WL#4350
View as plain text  
#At file:///home/msvensson/mysql/6.4-wl4350/

 3062 Magnus Svensson	2008-11-12
      WL#4350 Don't set connectstring for TransporterRegistry in mgmd
modified:
  storage/ndb/src/common/mgmcommon/IPCConfig.cpp

per-file messages:
  storage/ndb/src/common/mgmcommon/IPCConfig.cpp
    Add function 'is_mgmd' to determine if a node with NodeId is a MGM node
    Use 'is_mgmd' to avoid setting a new connectstring for TransporterRegistry
    in mgmd - in there it should always be set to "localhost:port", which is
    done in 'connect_to_self'
    Use 'is_mgmd' also to detect when "isMgmConnection" should be turned on.
=== modified file 'storage/ndb/src/common/mgmcommon/IPCConfig.cpp'
--- a/storage/ndb/src/common/mgmcommon/IPCConfig.cpp	2008-11-12 08:17:14 +0000
+++ b/storage/ndb/src/common/mgmcommon/IPCConfig.cpp	2008-11-12 08:22:03 +0000
@@ -21,6 +21,22 @@
 #include <mgmapi.h>
 #include <mgmapi_configuration.hpp>
 
+
+/* Return true if node with "nodeId" is a MGM node */
+static bool is_mgmd(Uint32 nodeId,
+                    const struct ndb_mgm_configuration & config)
+{
+  ndb_mgm_configuration_iterator iter(config, CFG_SECTION_NODE);
+  if (iter.find(CFG_NODE_ID, nodeId))
+    abort();
+  Uint32 type;
+  if(iter.get(CFG_TYPE_OF_SECTION, &type))
+    abort();
+
+  return (type == NODE_TYPE_MGM);
+}
+
+
 bool
 IPCConfig::configureTransporters(Uint32 nodeId,
                                  const struct ndb_mgm_configuration & config,
@@ -30,11 +46,15 @@ IPCConfig::configureTransporters(Uint32 
 
   DBUG_ENTER("IPCConfig::configureTransporters");
 
-  /**
-   * Iterate over all MGM's an construct a connectstring
-   * create mgm_handle and give it to the Transporter Registry
-   */
+
+  if (!is_mgmd(nodeId, config))
   {
+
+    /**
+     * Iterate over all MGM's and construct a connectstring
+     * create mgm_handle and give it to the Transporter Registry
+     */
+
     const char *separator= "";
     BaseString connect_string;
     ndb_mgm_configuration_iterator iter(config, CFG_SECTION_NODE);
@@ -109,19 +129,11 @@ IPCConfig::configureTransporters(Uint32 
     Uint32 nodeIdServer= 0;
     if(iter.get(CFG_CONNECTION_NODE_ID_SERVER, &nodeIdServer)) break;
 
-    /*
-      We check the node type.
-    */
-    Uint32 node1type, node2type;
-    ndb_mgm_configuration_iterator node1iter(config, CFG_SECTION_NODE);
-    ndb_mgm_configuration_iterator node2iter(config, CFG_SECTION_NODE);
-    node1iter.find(CFG_NODE_ID,nodeId1);
-    node2iter.find(CFG_NODE_ID,nodeId2);
-    node1iter.get(CFG_TYPE_OF_SECTION,&node1type);
-    node2iter.get(CFG_TYPE_OF_SECTION,&node2type);
-
-    if(node1type==NODE_TYPE_MGM || node2type==NODE_TYPE_MGM)
+    if(is_mgmd(nodeId1, config) || is_mgmd(nodeId2, config))
+    {
+      // All connections with MGM uses the mgm port as server
       conf.isMgmConnection= true;
+    }
     else
       conf.isMgmConnection= false;
 

Thread
bzr commit into mysql-5.1 branch (msvensson:3062) WL#4350Magnus Svensson12 Nov