Commit 5e5fc1c6 authored by unknown's avatar unknown

ndb - removed deprecated Ndb constructor


ndb/include/ndbapi/Ndb.hpp:
  removed deprecated methods
ndb/src/ndbapi/NdbPool.cpp:
  removed deprecated methods
ndb/src/ndbapi/NdbPoolImpl.cpp:
  removed deprecated methods
ndb/src/ndbapi/NdbPoolImpl.hpp:
  removed deprecated methods
ndb/src/ndbapi/Ndbinit.cpp:
  removed deprecated methods
ndb/tools/delete_all.cpp:
  removed deprecated methods
ndb/tools/desc.cpp:
  removed deprecated methods
ndb/tools/drop_index.cpp:
  removed deprecated methods
ndb/tools/drop_tab.cpp:
  removed deprecated methods
ndb/tools/restore/consumer_restore.cpp:
  removed deprecated methods
ndb/tools/restore/consumer_restore.hpp:
  removed deprecated methods
ndb/tools/restore/restore_main.cpp:
  removed deprecated methods
ndb/tools/select_all.cpp:
  removed deprecated methods
ndb/tools/select_count.cpp:
  removed deprecated methods
parent 1ea4d2a4
......@@ -1038,9 +1038,6 @@ public:
Ndb(Ndb_cluster_connection *ndb_cluster_connection,
const char* aCatalogName = "", const char* aSchemaName = "def");
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
Ndb(const char* aCatalogName = "", const char* aSchemaName = "def");
#endif
~Ndb();
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
......@@ -1349,13 +1346,6 @@ public:
*/
int getNodeId();
/**
* setConnectString
*
* @param connectString - see MySQL ref manual for format
*/
static void setConnectString(const char * connectString);
bool usingFullyQualifiedNames();
/**
......
......@@ -21,14 +21,16 @@
static NdbPool* m_pool = 0;
bool
create_instance(Uint32 max_ndb_objects,
create_instance(Ndb_cluster_connection* cc,
Uint32 max_ndb_objects,
Uint32 no_conn_obj,
Uint32 init_no_ndb_objects)
{
if (m_pool != NULL) {
return false;
}
m_pool = NdbPool::create_instance(max_ndb_objects,
m_pool = NdbPool::create_instance(cc,
max_ndb_objects,
no_conn_obj,
init_no_ndb_objects);
if (m_pool == NULL) {
......
......@@ -20,7 +20,8 @@ NdbMutex *NdbPool::pool_mutex = NULL;
NdbPool *the_pool = NULL;
NdbPool*
NdbPool::create_instance(Uint32 max_ndb_obj,
NdbPool::create_instance(Ndb_cluster_connection* cc,
Uint32 max_ndb_obj,
Uint32 no_conn_obj,
Uint32 init_no_ndb_objects)
{
......@@ -32,7 +33,7 @@ NdbPool::create_instance(Uint32 max_ndb_obj,
if (the_pool != NULL) {
a_pool = NULL;
} else {
the_pool = new NdbPool(max_ndb_obj, no_conn_obj);
the_pool = new NdbPool(cc, max_ndb_obj, no_conn_obj);
if (!the_pool->init(init_no_ndb_objects)) {
delete the_pool;
the_pool = NULL;
......@@ -76,7 +77,8 @@ NdbPool::initPoolMutex()
return ret_result;
}
NdbPool::NdbPool(Uint32 max_no_objects,
NdbPool::NdbPool(Ndb_cluster_connection* cc,
Uint32 max_no_objects,
Uint32 no_conn_objects)
{
if (no_conn_objects > 1024) {
......@@ -101,6 +103,7 @@ NdbPool::NdbPool(Uint32 max_no_objects,
m_output_queue = 0;
m_input_queue = 0;
m_signal_count = 0;
m_cluster_connection = cc;
}
NdbPool::~NdbPool()
......@@ -294,9 +297,9 @@ NdbPool::allocate_ndb(Uint32 &id,
return false;
}
if (a_schema_name) {
a_ndb = new Ndb(a_schema_name, a_catalog_name);
a_ndb = new Ndb(m_cluster_connection, a_schema_name, a_catalog_name);
} else {
a_ndb = new Ndb("");
a_ndb = new Ndb(m_cluster_connection, "");
}
if (a_ndb == NULL) {
return false;
......
......@@ -92,7 +92,8 @@ class NdbPool {
Uint16 prev_db_object;
};
public:
static NdbPool* create_instance(Uint32 max_ndb_objects = 240,
static NdbPool* create_instance(Ndb_cluster_connection*,
Uint32 max_ndb_objects = 240,
Uint32 no_conn_obj = 4,
Uint32 init_no_ndb_objects = 8);
static void drop_instance();
......@@ -104,7 +105,8 @@ class NdbPool {
bool init(Uint32 initial_no_of_ndb_objects = 8);
void release_all();
static bool initPoolMutex();
NdbPool(Uint32 max_no_of_ndb_objects, Uint32 no_conn_objects);
NdbPool(Ndb_cluster_connection*,
Uint32 max_no_of_ndb_objects, Uint32 no_conn_objects);
~NdbPool();
/*
We have three lists:
......@@ -158,5 +160,7 @@ class NdbPool {
Uint16 m_input_queue;
Uint16 m_output_queue;
Uint16 m_signal_count;
Ndb_cluster_connection * m_cluster_connection;
};
#endif
......@@ -34,48 +34,12 @@ class NdbGlobalEventBufferHandle;
NdbGlobalEventBufferHandle *NdbGlobalEventBuffer_init(int);
void NdbGlobalEventBuffer_drop(NdbGlobalEventBufferHandle *);
/**
* Static object for NDB
*/
// only needed for backwards compatability, before ndb_cluster_connection
static char *ndbConnectString = 0;
static int theNoOfNdbObjects = 0;
static Ndb_cluster_connection *global_ndb_cluster_connection= 0;
/***************************************************************************
Ndb(const char* aDataBase);
Parameters: aDataBase : Name of the database.
Remark: Connect to the database.
***************************************************************************/
Ndb::Ndb( const char* aDataBase , const char* aSchema)
: theImpl(NULL)
{
DBUG_ENTER("Ndb::Ndb()");
DBUG_PRINT("enter",("(old)Ndb::Ndb this=0x%x", this));
if (theNoOfNdbObjects < 0)
abort(); // old and new Ndb constructor used mixed
theNoOfNdbObjects++;
if (global_ndb_cluster_connection == 0) {
global_ndb_cluster_connection= new Ndb_cluster_connection(ndbConnectString);
global_ndb_cluster_connection->connect(12,5,1);
}
setup(global_ndb_cluster_connection, aDataBase, aSchema);
DBUG_VOID_RETURN;
}
Ndb::Ndb( Ndb_cluster_connection *ndb_cluster_connection,
const char* aDataBase , const char* aSchema)
: theImpl(NULL)
{
DBUG_ENTER("Ndb::Ndb()");
DBUG_PRINT("enter",("Ndb::Ndb this=0x%x", this));
if (global_ndb_cluster_connection != 0 &&
global_ndb_cluster_connection != ndb_cluster_connection)
abort(); // old and new Ndb constructor used mixed
theNoOfNdbObjects= -1;
setup(ndb_cluster_connection, aDataBase, aSchema);
DBUG_VOID_RETURN;
}
......@@ -177,16 +141,6 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
}
void Ndb::setConnectString(const char * connectString)
{
if (ndbConnectString != 0) {
free(ndbConnectString);
ndbConnectString = 0;
}
if (connectString)
ndbConnectString = strdup(connectString);
}
/*****************************************************************************
* ~Ndb();
*
......@@ -241,19 +195,6 @@ Ndb::~Ndb()
delete theImpl;
/**
* This needs to be put after delete theImpl
* as TransporterFacade::instance is delete by global_ndb_cluster_connection
* and used by theImpl
*/
if (global_ndb_cluster_connection != 0) {
theNoOfNdbObjects--;
if(theNoOfNdbObjects == 0){
delete global_ndb_cluster_connection;
global_ndb_cluster_connection= 0;
}
}//if
/**
* This sleep is to make sure that the transporter
* send thread will come in and send any
......
......@@ -77,9 +77,12 @@ int main(int argc, char** argv){
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
return NDBT_ProgramExit(NDBT_WRONGARGS);
Ndb::setConnectString(opt_connect_str);
// Connect to Ndb
Ndb MyNdb(_dbname);
Ndb_cluster_connection con(opt_connect_str);
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, _dbname );
if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError());
......
......@@ -77,10 +77,13 @@ int main(int argc, char** argv){
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
return NDBT_ProgramExit(NDBT_WRONGARGS);
Ndb::setConnectString(opt_connect_str);
Ndb_cluster_connection con(opt_connect_str);
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb* pMyNdb;
pMyNdb = new Ndb(_dbname);
Ndb* pMyNdb = new Ndb(&con, _dbname);
pMyNdb->init();
ndbout << "Waiting...";
......
......@@ -78,9 +78,13 @@ int main(int argc, char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
Ndb::setConnectString(opt_connect_str);
// Connect to Ndb
Ndb MyNdb(_dbname);
Ndb_cluster_connection con(opt_connect_str);
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, _dbname );
if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError());
return NDBT_ProgramExit(NDBT_FAILED);
......
......@@ -78,8 +78,13 @@ int main(int argc, char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
Ndb::setConnectString(opt_connect_str);
Ndb MyNdb(_dbname);
Ndb_cluster_connection con(opt_connect_str);
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, _dbname );
if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError());
return NDBT_ProgramExit(NDBT_FAILED);
......
......@@ -23,6 +23,7 @@ extern FilteredNdbOut debug;
static void callback(int, NdbConnection*, void*);
extern const char * g_connect_string;
bool
BackupRestore::init()
{
......@@ -31,7 +32,13 @@ BackupRestore::init()
if (!m_restore && !m_restore_meta)
return true;
m_ndb = new Ndb();
m_cluster_connection = new Ndb_cluster_connection(g_connect_string);
if(m_cluster_connection->connect(12, 5, 1) != 0)
{
return -1;
}
m_ndb = new Ndb(m_cluster_connection);
if (m_ndb == NULL)
return false;
......@@ -77,6 +84,12 @@ void BackupRestore::release()
delete [] m_callback;
m_callback= 0;
}
if (m_cluster_connection)
{
delete m_cluster_connection;
m_cluster_connection= 0;
}
}
BackupRestore::~BackupRestore()
......
......@@ -35,6 +35,7 @@ public:
BackupRestore(Uint32 parallelism=1)
{
m_ndb = 0;
m_cluster_connection = 0;
m_logCount = m_dataCount = 0;
m_restore = false;
m_restore_meta = false;
......@@ -62,6 +63,7 @@ public:
virtual bool finalize_table(const TableS &);
void connectToMysql();
Ndb * m_ndb;
Ndb_cluster_connection * m_cluster_connection;
bool m_restore;
bool m_restore_meta;
Uint32 m_logCount;
......
......@@ -240,6 +240,8 @@ free_data_callback()
g_consumers[i]->tuple_free();
}
const char * g_connect_string = 0;
int
main(int argc, char** argv)
{
......@@ -250,7 +252,7 @@ main(int argc, char** argv)
return -1;
}
Ndb::setConnectString(opt_connect_str);
g_connect_string = opt_connect_str;
/**
* we must always load meta data, even if we will only print it to stdout
......
......@@ -124,9 +124,12 @@ int main(int argc, char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
Ndb::setConnectString(opt_connect_str);
// Connect to Ndb
Ndb MyNdb(_dbname);
Ndb_cluster_connection con(opt_connect_str);
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, _dbname );
if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError());
......
......@@ -97,9 +97,12 @@ int main(int argc, char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
Ndb::setConnectString(opt_connect_str);
// Connect to Ndb
Ndb MyNdb(_dbname);
Ndb_cluster_connection con(opt_connect_str);
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb(&con, _dbname );
if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError());
......
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