List:Commits« Previous MessageNext Message »
From:jonas oreland Date:January 18 2011 9:53am
Subject:bzr push into mysql-5.1-telco-7.0 branch (jonas:4132 to 4133)
View as plain text  
 4133 jonas oreland	2011-01-18
      ndb - prevent alloc_node_id to success before get_config succeeds

    modified:
      storage/ndb/src/mgmsrv/ConfigManager.cpp
      storage/ndb/src/mgmsrv/ConfigManager.hpp
      storage/ndb/src/mgmsrv/MgmtSrvr.cpp
 4132 jonas oreland	2011-01-18
      ndb - bah...missed patch, causing HB to self being sent to /dev/null - causing api crash at node-failures

    modified:
      storage/ndb/src/ndbapi/ClusterMgr.cpp
=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.cpp	2011-01-18 07:35:35 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.cpp	2011-01-18 09:52:49 +0000
@@ -2197,10 +2197,9 @@ ConfigManager::load_saved_config(const B
   return conf;
 }
 
-
 bool
 ConfigManager::get_packed_config(ndb_mgm_node_type nodetype,
-                                 BaseString& buf64, BaseString& error)
+                                 BaseString* buf64, BaseString& error)
 {
   Guard g(m_config_mutex);
 
@@ -2246,23 +2245,26 @@ ConfigManager::get_packed_config(ndb_mgm
   }
 
   require(m_config != 0);
-  if (!m_packed_config.length())
+  if (buf64)
   {
-    // No packed config exist, generate a new one
-    Config config_copy(m_config);
-    if (!m_dynamic_ports.set_in_config(&config_copy))
-    {
-      error.assign("get_packed_config, failed to set dynamic ports in config");
-      return false;
-    }
-
-    if (!config_copy.pack64(m_packed_config))
+    if (!m_packed_config.length())
     {
-      error.assign("get_packed_config, failed to pack config_copy");
-      return false;
+      // No packed config exist, generate a new one
+      Config config_copy(m_config);
+      if (!m_dynamic_ports.set_in_config(&config_copy))
+      {
+        error.assign("get_packed_config, failed to set dynamic ports in config");
+        return false;
+      }
+      
+      if (!config_copy.pack64(m_packed_config))
+      {
+        error.assign("get_packed_config, failed to pack config_copy");
+        return false;
+      }
     }
+    buf64->assign(m_packed_config, m_packed_config.length());
   }
-  buf64.assign(m_packed_config, m_packed_config.length());
   return true;
 }
 

=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.hpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.hpp	2010-09-17 14:30:59 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.hpp	2011-01-18 09:52:49 +0000
@@ -250,7 +250,7 @@ public:
     Retrieve the current configuration in base64 packed format
    */
   bool get_packed_config(ndb_mgm_node_type nodetype,
-                         BaseString& buf64, BaseString& error);
+                         BaseString * buf64, BaseString& error);
 
   static Config* load_config(const char* config_filename, bool mycnf,
                              BaseString& msg);

=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2011-01-18 07:39:47 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2011-01-18 09:52:49 +0000
@@ -736,7 +736,7 @@ bool
 MgmtSrvr::get_packed_config(ndb_mgm_node_type node_type,
                             BaseString& buf64, BaseString& error)
 {
-  return m_config_manager->get_packed_config(node_type, buf64, error);
+  return m_config_manager->get_packed_config(node_type, &buf64, error);
 }
 
 
@@ -2935,6 +2935,23 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
   }
 
   Uint32 timeout_ms = Uint32(1000 * timeout_s);
+  Uint64 stop = NdbTick_CurrentMillisecond() + timeout_ms;
+  BaseString getconfig_message;
+  while (!m_config_manager->get_packed_config(type, 0, getconfig_message))
+  {
+    /**
+     * Wait for config to get confirmed before allocating node id
+     */
+    if (NdbTick_CurrentMillisecond() > stop)
+    {
+      error_code = NDB_MGM_ALLOCID_ERROR;
+      error_string.append("Unable to allocate nodeid as configuration"
+                          " not yet confirmed");
+      DBUG_RETURN(false);
+    }
+
+    NdbSleep_MilliSleep(20);
+  }
 
   Guard g(m_node_id_mutex);
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0 branch (jonas:4132 to 4133) jonas oreland18 Jan