removed unused variables

    assigned "localhost" as default connectstring
    added a disconnect() first in connect()
    removed double implementation of connect code, use connect() in NdbRestarter
    removed extra "host=" in connectstring
parent 41222efa
...@@ -356,8 +356,6 @@ extern "C" { ...@@ -356,8 +356,6 @@ extern "C" {
/** /**
* Create a handle to a management server * Create a handle to a management server
* *
* @param connect_string Connect string to the management server,
*
* @return A management handle<br> * @return A management handle<br>
* or NULL if no management handle could be created. * or NULL if no management handle could be created.
*/ */
......
...@@ -87,8 +87,6 @@ protected: ...@@ -87,8 +87,6 @@ protected:
bool connected; bool connected;
BaseString addr; BaseString addr;
BaseString host;
int port;
NdbMgmHandle handle; NdbMgmHandle handle;
ndb_mgm_configuration * m_config; ndb_mgm_configuration * m_config;
protected: protected:
......
...@@ -69,26 +69,19 @@ NdbBackup::getBackupDataDirForNode(int _node_id){ ...@@ -69,26 +69,19 @@ NdbBackup::getBackupDataDirForNode(int _node_id){
/** /**
* Fetch configuration from management server * Fetch configuration from management server
*/ */
ConfigRetriever cr(0, 0, NODE_TYPE_API); ndb_mgm_configuration *p;
ndb_mgm_configuration * p = 0; if (connect())
return NULL;
BaseString tmp; tmp.assfmt("%s:%d", host.c_str(), port);
NdbMgmHandle handle = ndb_mgm_create_handle(); if ((p = ndb_mgm_get_configuration(handle, 0)) == 0)
if(handle == 0 || {
ndb_mgm_set_connectstring(handle,tmp.c_str()) != 0 || const char * s= ndb_mgm_get_latest_error_msg(handle);
ndb_mgm_connect(handle,0,0,0) != 0 || if(s == 0)
(p = ndb_mgm_get_configuration(handle, 0)) == 0){ s = "No error given!";
const char * s = 0;
if(p == 0 && handle != 0){
s = ndb_mgm_get_latest_error_msg(handle);
if(s == 0)
s = "No error given!";
ndbout << "Could not fetch configuration" << endl; ndbout << "Could not fetch configuration" << endl;
ndbout << s << endl; ndbout << s << endl;
return NULL; return NULL;
}
} }
/** /**
...@@ -153,7 +146,7 @@ NdbBackup::execRestore(bool _restore_data, ...@@ -153,7 +146,7 @@ NdbBackup::execRestore(bool _restore_data,
ndbout << "scp res: " << res << endl; ndbout << "scp res: " << res << endl;
BaseString::snprintf(buf, 255, "%sndb_restore -c \"host=%s\" -n %d -b %d %s %s .", BaseString::snprintf(buf, 255, "%sndb_restore -c \"%s\" -n %d -b %d %s %s .",
#if 1 #if 1
"", "",
#else #else
......
...@@ -32,12 +32,11 @@ ...@@ -32,12 +32,11 @@
NdbRestarter::NdbRestarter(const char* _addr): NdbRestarter::NdbRestarter(const char* _addr):
connected(false), connected(false),
port(-1),
handle(NULL), handle(NULL),
m_config(0) m_config(0)
{ {
if (_addr == NULL){ if (_addr == NULL){
addr.assign(""); addr.assign("localhost");
} else { } else {
addr.assign(_addr); addr.assign(_addr);
} }
...@@ -360,6 +359,7 @@ NdbRestarter::isConnected(){ ...@@ -360,6 +359,7 @@ NdbRestarter::isConnected(){
int int
NdbRestarter::connect(){ NdbRestarter::connect(){
disconnect();
handle = ndb_mgm_create_handle(); handle = ndb_mgm_create_handle();
if (handle == NULL){ if (handle == NULL){
g_err << "handle == NULL" << endl; g_err << "handle == NULL" << endl;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment