List:Internals« Previous MessageNext Message »
From:Stewart Smith Date:January 14 2005 5:42am
Subject:bk commit into 5.0 tree (stewart:1.1731)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
  1.1731 05/01/14 15:42:11 stewart@stripped +6 -0
  Distinguish between "real" ports and those that can be negative (dynamic).
  (Suggested by Tomas Ulin as part of review for WL2278)

  ndb/src/ndbapi/ndb_cluster_connection.cpp
    1.21 05/01/14 15:42:05 stewart@stripped +1 -1
    use m_s_service_port to indicate signed port number

  ndb/src/mgmsrv/MgmtSrvr.cpp
    1.62 05/01/14 15:42:05 stewart@stripped +4 -4
    differentiate between signed and unsigned port numbers

  ndb/src/kernel/main.cpp
    1.43 05/01/14 15:42:05 stewart@stripped +1 -1
    use m_s_service_port to indicate signed port number

  ndb/src/common/transporter/TransporterRegistry.cpp
    1.30 05/01/14 15:42:04 stewart@stripped +11 -11
    Use s_port to indicate a signed port number.

  ndb/src/common/mgmcommon/IPCConfig.cpp
    1.15 05/01/14 15:42:04 stewart@stripped +11 -1
    Explain the sign of server_port

  ndb/include/transporter/TransporterRegistry.hpp
    1.11 05/01/14 15:42:04 stewart@stripped +2 -2
    Differentiate signed port numbers from unsigned ones

# 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:	kennedy.(none)
# Root:	/home/stewart/Documents/MySQL/5.0/ndb-dynamic-ports-impl4

--- 1.10/ndb/include/transporter/TransporterRegistry.hpp	2005-01-12 18:13:44 +11:00
+++ 1.11/ndb/include/transporter/TransporterRegistry.hpp	2005-01-14 15:42:04 +11:00
@@ -232,12 +232,12 @@
   class Transporter_interface {
   public:
     NodeId m_remote_nodeId;
-    int m_service_port;
+    int m_s_service_port;			// signed port number
     const char *m_interface;
   };
   Vector<Transporter_interface> m_transporter_interface;
   void add_transporter_interface(NodeId remoteNodeId, const char *interf,
-		  		 int port);
+		  		 int s_port);	// signed port. <0 is dynamic
   Transporter* get_transporter(NodeId nodeId);
   NodeId get_localNodeId() { return localNodeId; };
 

--- 1.14/ndb/src/common/mgmcommon/IPCConfig.cpp	2005-01-12 18:13:44 +11:00
+++ 1.15/ndb/src/common/mgmcommon/IPCConfig.cpp	2005-01-14 15:42:04 +11:00
@@ -371,8 +371,18 @@
     }
     DBUG_PRINT("info", ("Transporter between this node %d and node %d using port %d,
signalId %d, checksum %d",
                nodeId, remoteNodeId, server_port, sendSignalId, checksum));
+    /*
+      This may be a dynamic port. It depends on when we're getting
+      our configuration. If we've been restarted, we'll be getting
+      a configuration with our old dynamic port in it, hence the number
+      here is negative (and we try the old port number first).
+
+      On a first-run, server_port will be zero (with dynamic ports)
+
+      If we're not using dynamic ports, we don't do anything.
+    */
     if((int)server_port<0)
-      server_port= -server_port;		// A dynamic port
+      server_port= -server_port;
 
     switch(type){
     case CONNECTION_TYPE_SHM:{

--- 1.29/ndb/src/common/transporter/TransporterRegistry.cpp	2005-01-12 18:40:55 +11:00
+++ 1.30/ndb/src/common/transporter/TransporterRegistry.cpp	2005-01-14 15:42:04 +11:00
@@ -1267,17 +1267,17 @@
 void
 TransporterRegistry::add_transporter_interface(NodeId remoteNodeId,
 					       const char *interf, 
-					       int port)
+					       int s_port)
 {
   DBUG_ENTER("TransporterRegistry::add_transporter_interface");
-  DBUG_PRINT("enter",("interface=%s, port= %d", interf, port));
+  DBUG_PRINT("enter",("interface=%s, s_port= %d", interf, s_port));
   if (interf && strlen(interf) == 0)
     interf= 0;
 
   for (unsigned i= 0; i < m_transporter_interface.size(); i++)
   {
     Transporter_interface &tmp= m_transporter_interface[i];
-    if (port != tmp.m_service_port || tmp.m_service_port==0)
+    if (s_port != tmp.m_s_service_port || tmp.m_s_service_port==0)
       continue;
     if (interf != 0 && tmp.m_interface != 0 &&
 	strcmp(interf, tmp.m_interface) == 0)
@@ -1291,7 +1291,7 @@
   }
   Transporter_interface t;
   t.m_remote_nodeId= remoteNodeId;
-  t.m_service_port= port;
+  t.m_s_service_port= s_port;
   t.m_interface= interf;
   m_transporter_interface.push_back(t);
   DBUG_PRINT("exit",("interface and port added"));
@@ -1311,9 +1311,9 @@
   {
     Transporter_interface &t= m_transporter_interface[i];
 
-    unsigned short port= t.m_service_port;
-    if(t.m_service_port<0)
-      port= -t.m_service_port; // is a dynamic port
+    unsigned short port= (unsigned short)t.m_s_service_port;
+    if(t.m_s_service_port<0)
+      port= -t.m_s_service_port; // is a dynamic port
     TransporterService *transporter_service =
       new TransporterService(new SocketAuthSimple("ndbd", "ndbd passwd"));
     if(!socket_server.setup(transporter_service,
@@ -1321,7 +1321,7 @@
     {
       DBUG_PRINT("info", ("Trying new port"));
       port= 0;
-      if(t.m_service_port>0
+      if(t.m_s_service_port>0
 	 || !socket_server.setup(transporter_service,
 				 &port, t.m_interface))
       {
@@ -1332,13 +1332,13 @@
 	ndbout_c("Unable to setup transporter service port: %s:%d!\n"
 		 "Please check if the port is already used,\n"
 		 "(perhaps the node is already running)",
-		 t.m_interface ? t.m_interface : "*", t.m_service_port);
+		 t.m_interface ? t.m_interface : "*", t.m_s_service_port);
 	delete transporter_service;
 	return false;
       }
     }
-    t.m_service_port= (t.m_service_port<=0)?-port:port; // -`ve if dynamic
-    DBUG_PRINT("info", ("t.m_service_port = %d",t.m_service_port));
+    t.m_s_service_port= (t.m_s_service_port<=0)?-port:port; // -`ve if dynamic
+    DBUG_PRINT("info", ("t.m_s_service_port = %d",t.m_s_service_port));
     transporter_service->setTransporterRegistry(this);
   }
   return true;

--- 1.42/ndb/src/kernel/main.cpp	2005-01-01 23:57:36 +11:00
+++ 1.43/ndb/src/kernel/main.cpp	2005-01-14 15:42:05 +11:00
@@ -211,7 +211,7 @@
 					 globalTransporterRegistry.get_localNodeId(),
 					 globalTransporterRegistry.m_transporter_interface[i].m_remote_nodeId,
 					 CFG_CONNECTION_SERVER_PORT,
-					 globalTransporterRegistry.m_transporter_interface[i].m_service_port,
+					 globalTransporterRegistry.m_transporter_interface[i].m_s_service_port,
 					 &mgm_reply);
 
 

--- 1.61/ndb/src/mgmsrv/MgmtSrvr.cpp	2005-01-12 18:40:55 +11:00
+++ 1.62/ndb/src/mgmsrv/MgmtSrvr.cpp	2005-01-14 15:42:05 +11:00
@@ -620,18 +620,18 @@
   TransporterRegistry *reg = theFacade->get_registry();
   for(unsigned int i=0;i<reg->m_transporter_interface.size();i++) {
     BaseString msg;
-    DBUG_PRINT("info",("Setting dynamic port %d->%d : %u",
+    DBUG_PRINT("info",("Setting dynamic port %d->%d : %d",
 		       reg->get_localNodeId(),
 		       reg->m_transporter_interface[i].m_remote_nodeId,
-		       reg->m_transporter_interface[i].m_service_port
+		       reg->m_transporter_interface[i].m_s_service_port
 		       )
 	       );
     int res = setConnectionDbParameter((int)reg->get_localNodeId(),
 				       (int)reg->m_transporter_interface[i]
 				            .m_remote_nodeId,
 				       (int)CFG_CONNECTION_SERVER_PORT,
-				       (int)reg->m_transporter_interface[i]
-				            .m_service_port,
+				       reg->m_transporter_interface[i]
+				            .m_s_service_port,
 					 msg);
     DBUG_PRINT("info",("Set result: %d: %s",res,msg.c_str()));
   }

--- 1.20/ndb/src/ndbapi/ndb_cluster_connection.cpp	2005-01-11 00:40:51 +11:00
+++ 1.21/ndb/src/ndbapi/ndb_cluster_connection.cpp	2005-01-14 15:42:05 +11:00
@@ -500,7 +500,7 @@
 					   CFG_CONNECTION_SERVER_PORT,
 					   m_impl.m_transporter_facade->get_registry()
 					     ->m_transporter_interface[i]
-					     .m_service_port,
+					     .m_s_service_port,
 					   &mgm_reply);
 
     ndb_mgm_destroy_configuration(props);
Thread
bk commit into 5.0 tree (stewart:1.1731)Stewart Smith14 Jan