diff options
author | tomas@poseidon.ndb.mysql.com <> | 2004-11-18 20:35:19 +0000 |
---|---|---|
committer | tomas@poseidon.ndb.mysql.com <> | 2004-11-18 20:35:19 +0000 |
commit | f30ce1ecafb8bfecb6e3b0921e16fe9fbe48e0d5 (patch) | |
tree | a4ce4b48079b843086ad1ffed479284436e24032 /ndb/test | |
parent | b444c28e2aa25a6bfe63b0ffa738205ddd1c9e41 (diff) | |
download | mariadb-git-f30ce1ecafb8bfecb6e3b0921e16fe9fbe48e0d5.tar.gz |
adopted testprograms to changes in mgmapi
Diffstat (limited to 'ndb/test')
-rw-r--r-- | ndb/test/run-test/main.cpp | 22 | ||||
-rw-r--r-- | ndb/test/src/NdbBackup.cpp | 10 | ||||
-rw-r--r-- | ndb/test/src/NdbRestarter.cpp | 43 |
3 files changed, 27 insertions, 48 deletions
diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp index e5f73bc6a5c..ac7710d9546 100644 --- a/ndb/test/run-test/main.cpp +++ b/ndb/test/run-test/main.cpp @@ -538,15 +538,19 @@ connect_ndb_mgm(atrt_process & proc){ } BaseString tmp = proc.m_hostname; tmp.appfmt(":%d", proc.m_ndb_mgm_port); - time_t start = time(0); - const time_t max_connect_time = 30; - do { - if(ndb_mgm_connect(handle, tmp.c_str()) != -1){ - proc.m_ndb_mgm_handle = handle; - return true; - } - sleep(1); - } while(time(0) < (start + max_connect_time)); + + if (ndb_mgm_set_connectstring(handle,tmp.c_str())) + { + g_logger.critical("Unable to create parse connectstring"); + return false; + } + + if(ndb_mgm_connect(handle, 30, 1, 0) != -1) + { + proc.m_ndb_mgm_handle = handle; + return true; + } + g_logger.critical("Unable to connect to ndb mgm %s", tmp.c_str()); return false; } diff --git a/ndb/test/src/NdbBackup.cpp b/ndb/test/src/NdbBackup.cpp index 1ce48d495a5..398a7c32fc4 100644 --- a/ndb/test/src/NdbBackup.cpp +++ b/ndb/test/src/NdbBackup.cpp @@ -69,16 +69,14 @@ NdbBackup::getBackupDataDirForNode(int _node_id){ /** * Fetch configuration from management server */ - LocalConfig lc; - if (!lc.init(0,0)) { - abort(); - } - ConfigRetriever cr(lc, 0, NODE_TYPE_API); + ConfigRetriever cr(0, 0, NODE_TYPE_API); ndb_mgm_configuration * p = 0; BaseString tmp; tmp.assfmt("%s:%d", host.c_str(), port); NdbMgmHandle handle = ndb_mgm_create_handle(); - if(handle == 0 || ndb_mgm_connect(handle, tmp.c_str()) != 0 || + if(handle == 0 || + ndb_mgm_set_connectstring(handle,tmp.c_str()) != 0 || + ndb_mgm_connect(handle,0,0,0) != 0 || (p = ndb_mgm_get_configuration(handle, 0)) == 0){ const char * s = 0; diff --git a/ndb/test/src/NdbRestarter.cpp b/ndb/test/src/NdbRestarter.cpp index 4d6d3ddc001..e1802f36e82 100644 --- a/ndb/test/src/NdbRestarter.cpp +++ b/ndb/test/src/NdbRestarter.cpp @@ -18,7 +18,6 @@ #include <NdbOut.hpp> #include <NdbSleep.h> #include <NdbTick.h> -#include <LocalConfig.hpp> #include <mgmapi_debug.h> #include <NDBT_Output.hpp> #include <random.h> @@ -38,37 +37,7 @@ NdbRestarter::NdbRestarter(const char* _addr): m_config(0) { if (_addr == NULL){ - LocalConfig lcfg; - if(!lcfg.init()){ - lcfg.printError(); - lcfg.printUsage(); - g_err << "NdbRestarter - Error parsing local config file" << endl; - return; - } - - if (lcfg.ids.size() == 0){ - g_err << "NdbRestarter - No management servers configured in local config file" << endl; - return; - } - - for (int i = 0; i<lcfg.ids.size(); i++){ - MgmtSrvrId * m = &lcfg.ids[i]; - - switch(m->type){ - case MgmId_TCP: - char buf[255]; - snprintf(buf, 255, "%s:%d", m->name.c_str(), m->port); - addr.assign(buf); - host.assign(m->name.c_str()); - port = m->port; - return; - break; - case MgmId_File: - break; - default: - break; - } - } + addr.assign(""); } else { addr.assign(_addr); } @@ -397,7 +366,15 @@ NdbRestarter::connect(){ return -1; } g_info << "Connecting to mgmsrv at " << addr.c_str() << endl; - if (ndb_mgm_connect(handle, addr.c_str()) == -1) { + if (ndb_mgm_set_connectstring(handle,addr.c_str())) + { + MGMERR(handle); + g_err << "Connection to " << addr.c_str() << " failed" << endl; + return -1; + } + + if (ndb_mgm_connect(handle, 0, 0, 0) == -1) + { MGMERR(handle); g_err << "Connection to " << addr.c_str() << " failed" << endl; return -1; |