MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:Stewart Smith Date:June 6 2005 3:30pm
Subject:bk commit into 5.0 tree (stewart:1.1926) BUG#10893
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://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1926 05/06/07 01:29:59 stewart@stripped +2 -0
  BUG#10893
  
  We weren't able to reconnect to the management server as we had previously destroyed
  the handle when we re-used the mgm connection for a transporter.
  
  Save the connect string in TransporterRegistry and use it to create a new mgm handle
  when needed.

  ndb/src/common/transporter/TransporterRegistry.cpp
    1.53 05/06/07 01:29:52 stewart@stripped +23 -5
    Reconnect to management server when needed.
    (create new mgm handle)

  ndb/include/transporter/TransporterRegistry.hpp
    1.19 05/06/07 01:29:52 stewart@stripped +1 -0
    Add m_mgm_connectstring to keep track of the connect string we need to use to recreate
    a mgm handle when needed

# 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/bug10893

--- 1.18/ndb/include/transporter/TransporterRegistry.hpp	2005-02-24 17:57:11 +11:00
+++ 1.19/ndb/include/transporter/TransporterRegistry.hpp	2005-06-07 01:29:52 +10:00
@@ -267,6 +267,7 @@
   void * callbackObj;
 
   NdbMgmHandle m_mgm_handle;
+  char *m_mgm_connectstring;
 
   struct NdbThread   *m_start_clients_thread;
   bool                m_run_start_clients_thread;

--- 1.52/ndb/src/common/transporter/TransporterRegistry.cpp	2005-03-04 06:21:35 +11:00
+++ 1.53/ndb/src/common/transporter/TransporterRegistry.cpp	2005-06-07 01:29:52 +10:00
@@ -80,7 +80,8 @@
   maxTransporters = _maxTransporters;
   sendCounter = 1;
   m_mgm_handle= 0;
-  
+  m_mgm_connectstring= NULL;
+
   callbackObj=callback;
 
   theTCPTransporters  = new TCP_Transporter * [maxTransporters];
@@ -116,16 +117,19 @@
 
 void TransporterRegistry::set_mgm_handle(NdbMgmHandle h)
 {
+  char buf[1024];
   DBUG_ENTER("TransporterRegistry::set_mgm_handle");
   if (m_mgm_handle)
+  {
     ndb_mgm_destroy_handle(&m_mgm_handle);
+    ndb_mgm_get_connectstring(h,buf,sizeof(buf));
+    m_mgm_connectstring= strdup(buf);
+  }
   m_mgm_handle= h;
 #ifndef DBUG_OFF
   if (h)
   {
-    char buf[256];
-    DBUG_PRINT("info",("handle set with connectstring: %s",
-		       ndb_mgm_get_connectstring(h,buf, sizeof(buf))));
+    DBUG_PRINT("info",("handle set with connectstring: %s",buf));
   }
   else
   {
@@ -1248,6 +1252,14 @@
 	    int server_port= 0;
 	    struct ndb_mgm_reply mgm_reply;
 
+	    if(!m_mgm_handle)
+	    {
+	      if(!m_mgm_connectstring)
+		abort(); // should never happen
+	      m_mgm_handle= ndb_mgm_create_handle();
+	      ndb_mgm_set_connectstring(m_mgm_handle,m_mgm_connectstring);
+	    }
+
 	    if(!ndb_mgm_is_connected(m_mgm_handle))
 	      ndb_mgm_connect(m_mgm_handle, 0, 0, 0);
 	    
@@ -1541,7 +1553,13 @@
     ndbout_c("%s: %d", __FILE__, __LINE__);
     return false;
   }
-  DBUG_RETURN(t->connect_client(connect_ndb_mgmd(h)));
+  if(t->connect_client(connect_ndb_mgmd(h)))
+  {
+    if(m_mgm_handle==*h)
+      m_mgm_handle= NULL;
+    return true;
+  }
+  return false;
 }
 
 /**
Thread
bk commit into 5.0 tree (stewart:1.1926) BUG#10893Stewart Smith6 Jun