Commit 6f4e3d66 authored by unknown's avatar unknown

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


ndb/include/mgmapi/mgmapi.h:
  removed wrong comment
ndb/test/include/NdbRestarter.hpp:
  removed unused variables
ndb/test/src/NdbBackup.cpp:
  removed double implementation of connect code, use connect() in NdbRestarter
  removed extra "host=" in connectstring
ndb/test/src/NdbRestarter.cpp:
  removed unused variables
  assigned "localhost" as default connectstring
  added a disconnect() first in connect()
parent 525b7520
......@@ -356,8 +356,6 @@ extern "C" {
/**
* Create a handle to a management server
*
* @param connect_string Connect string to the management server,
*
* @return A management handle<br>
* or NULL if no management handle could be created.
*/
......
......@@ -87,8 +87,6 @@ protected:
bool connected;
BaseString addr;
BaseString host;
int port;
NdbMgmHandle handle;
ndb_mgm_configuration * m_config;
protected:
......
......@@ -69,26 +69,19 @@ NdbBackup::getBackupDataDirForNode(int _node_id){
/**
* Fetch configuration from management server
*/
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_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;
if(p == 0 && handle != 0){
s = ndb_mgm_get_latest_error_msg(handle);
if(s == 0)
s = "No error given!";
ndb_mgm_configuration *p;
if (connect())
return NULL;
if ((p = ndb_mgm_get_configuration(handle, 0)) == 0)
{
const char * s= ndb_mgm_get_latest_error_msg(handle);
if(s == 0)
s = "No error given!";
ndbout << "Could not fetch configuration" << endl;
ndbout << s << endl;
return NULL;
}
ndbout << "Could not fetch configuration" << endl;
ndbout << s << endl;
return NULL;
}
/**
......@@ -153,7 +146,7 @@ NdbBackup::execRestore(bool _restore_data,
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
"",
#else
......
......@@ -32,12 +32,11 @@
NdbRestarter::NdbRestarter(const char* _addr):
connected(false),
port(-1),
handle(NULL),
m_config(0)
{
if (_addr == NULL){
addr.assign("");
addr.assign("localhost");
} else {
addr.assign(_addr);
}
......@@ -360,6 +359,7 @@ NdbRestarter::isConnected(){
int
NdbRestarter::connect(){
disconnect();
handle = ndb_mgm_create_handle();
if (handle == NULL){
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