summaryrefslogtreecommitdiff
path: root/ndb/src/kernel/vm
diff options
context:
space:
mode:
authorunknown <stewart@mysql.com>2005-03-01 19:53:57 +1100
committerunknown <stewart@mysql.com>2005-03-01 19:53:57 +1100
commit65be842f791570c5c431108d7618940565cc0049 (patch)
treea94ebc3cee96695bd65c52d01c6698e594249501 /ndb/src/kernel/vm
parent09b7d18a60077a16240fc5298e0068d3db243521 (diff)
downloadmariadb-git-65be842f791570c5c431108d7618940565cc0049.tar.gz
Fixes from Tomas's review of 'use configuration mgm handle as a transporter'.
This should help with the PURGE STALE SESSIONS problem. ndb/src/common/transporter/TransporterRegistry.cpp: No longer need to do funny connecting and port reporting in start_service as we convert the configuration mgm after we have bound to the ports we have to report. use a BaseString for constructing the connect string. ndb/src/kernel/main.cpp: Reuse the mgm handle used to fetch configuration as a transporter connection. ndb/src/kernel/vm/Configuration.cpp: m_mgmd_host is now a BaseString. ndb/src/kernel/vm/Configuration.hpp: use BaseString for m_mgmd_host
Diffstat (limited to 'ndb/src/kernel/vm')
-rw-r--r--ndb/src/kernel/vm/Configuration.cpp21
-rw-r--r--ndb/src/kernel/vm/Configuration.hpp5
2 files changed, 5 insertions, 21 deletions
diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp
index 29455e5b115..650d914035f 100644
--- a/ndb/src/kernel/vm/Configuration.cpp
+++ b/ndb/src/kernel/vm/Configuration.cpp
@@ -154,7 +154,6 @@ Configuration::Configuration()
m_config_retriever= 0;
m_clusterConfig= 0;
m_clusterConfigIter= 0;
- m_mgmd_host= NULL;
}
Configuration::~Configuration(){
@@ -167,9 +166,6 @@ Configuration::~Configuration(){
if(_backupPath != NULL)
free(_backupPath);
- if(m_mgmd_host)
- free(m_mgmd_host);
-
if (m_config_retriever) {
delete m_config_retriever;
}
@@ -193,7 +189,6 @@ Configuration::fetch_configuration(){
}
m_mgmd_port= 0;
- m_mgmd_host= 0;
m_config_retriever= new ConfigRetriever(getConnectString(),
NDB_VERSION, NODE_TYPE_DB);
@@ -214,16 +209,8 @@ Configuration::fetch_configuration(){
ERROR_SET(fatal, ERR_INVALID_CONFIG, "Could not connect to ndb_mgmd", s);
}
- {
- m_mgmd_port= m_config_retriever->get_mgmd_port();
- /**
- * We copy the mgmd host as the handle is later
- * destroyed, so a pointer won't work
- */
- int len= strlen(m_config_retriever->get_mgmd_host());
- m_mgmd_host= (char*)malloc(sizeof(char)*len);
- strcpy(m_mgmd_host,m_config_retriever->get_mgmd_host());
- }
+ m_mgmd_port= m_config_retriever->get_mgmd_port();
+ m_mgmd_host.assign(m_config_retriever->get_mgmd_host());
ConfigRetriever &cr= *m_config_retriever;
@@ -325,10 +312,6 @@ Configuration::setupConfiguration(){
ERROR_SET(fatal, ERR_INVALID_CONFIG, "Invalid configuration fetched",
"No transporters configured");
}
- if(!globalTransporterRegistry.connect_client(
- m_config_retriever->get_mgmHandlePtr()))
- ERROR_SET(fatal, ERR_INVALID_CONFIG, "Connection to mgmd terminated before setup was complete",
- "StopOnError missing");
}
/**
diff --git a/ndb/src/kernel/vm/Configuration.hpp b/ndb/src/kernel/vm/Configuration.hpp
index dd690665413..6ca6d9a1f17 100644
--- a/ndb/src/kernel/vm/Configuration.hpp
+++ b/ndb/src/kernel/vm/Configuration.hpp
@@ -17,6 +17,7 @@
#ifndef Configuration_H
#define Configuration_H
+#include <util/BaseString.hpp>
#include <mgmapi.h>
#include <ndb_types.h>
@@ -67,7 +68,7 @@ public:
const ndb_mgm_configuration_iterator * getOwnConfigIterator() const;
Uint32 get_mgmd_port() const {return m_mgmd_port;};
- char *get_mgmd_host() const {return m_mgmd_host;};
+ const char *get_mgmd_host() const {return m_mgmd_host.c_str();};
ConfigRetriever* get_config_retriever() { return m_config_retriever; };
class LogLevel * m_logLevel;
@@ -99,7 +100,7 @@ private:
bool _initialStart;
char * _connectString;
Uint32 m_mgmd_port;
- char *m_mgmd_host;
+ BaseString m_mgmd_host;
bool _daemonMode;
void calcSizeAlt(class ConfigValues * );