diff options
author | unknown <joreland@mysql.com> | 2005-01-01 19:25:31 +0100 |
---|---|---|
committer | unknown <joreland@mysql.com> | 2005-01-01 19:25:31 +0100 |
commit | 11a2a3562396ca59b67193056ac2ba4740b8ed0c (patch) | |
tree | 9e2e7fef2c5322221973630ba079cb3b47386946 | |
parent | a61ef10262a327ce0c622f6c9b6e99e902e885a6 (diff) | |
download | mariadb-git-11a2a3562396ca59b67193056ac2ba4740b8ed0c.tar.gz |
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
-rw-r--r-- | ndb/include/ndbapi/Ndb.hpp | 10 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbPool.cpp | 6 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbPoolImpl.cpp | 13 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbPoolImpl.hpp | 8 | ||||
-rw-r--r-- | ndb/src/ndbapi/Ndbinit.cpp | 59 | ||||
-rw-r--r-- | ndb/tools/delete_all.cpp | 9 | ||||
-rw-r--r-- | ndb/tools/desc.cpp | 9 | ||||
-rw-r--r-- | ndb/tools/drop_index.cpp | 10 | ||||
-rw-r--r-- | ndb/tools/drop_tab.cpp | 9 | ||||
-rw-r--r-- | ndb/tools/restore/consumer_restore.cpp | 15 | ||||
-rw-r--r-- | ndb/tools/restore/consumer_restore.hpp | 2 | ||||
-rw-r--r-- | ndb/tools/restore/restore_main.cpp | 4 | ||||
-rw-r--r-- | ndb/tools/select_all.cpp | 9 | ||||
-rw-r--r-- | ndb/tools/select_count.cpp | 9 |
14 files changed, 75 insertions, 97 deletions
diff --git a/ndb/include/ndbapi/Ndb.hpp b/ndb/include/ndbapi/Ndb.hpp index 30be935b0a2..c2371eba2cf 100644 --- a/ndb/include/ndbapi/Ndb.hpp +++ b/ndb/include/ndbapi/Ndb.hpp @@ -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(); /** diff --git a/ndb/src/ndbapi/NdbPool.cpp b/ndb/src/ndbapi/NdbPool.cpp index ba58520c1dc..a8263f564f1 100644 --- a/ndb/src/ndbapi/NdbPool.cpp +++ b/ndb/src/ndbapi/NdbPool.cpp @@ -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) { diff --git a/ndb/src/ndbapi/NdbPoolImpl.cpp b/ndb/src/ndbapi/NdbPoolImpl.cpp index 131edc74246..32e0a6f1410 100644 --- a/ndb/src/ndbapi/NdbPoolImpl.cpp +++ b/ndb/src/ndbapi/NdbPoolImpl.cpp @@ -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; diff --git a/ndb/src/ndbapi/NdbPoolImpl.hpp b/ndb/src/ndbapi/NdbPoolImpl.hpp index af6cf4708cf..cd36f30e90b 100644 --- a/ndb/src/ndbapi/NdbPoolImpl.hpp +++ b/ndb/src/ndbapi/NdbPoolImpl.hpp @@ -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 diff --git a/ndb/src/ndbapi/Ndbinit.cpp b/ndb/src/ndbapi/Ndbinit.cpp index 1e57207f92b..4db9d05b59c 100644 --- a/ndb/src/ndbapi/Ndbinit.cpp +++ b/ndb/src/ndbapi/Ndbinit.cpp @@ -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 diff --git a/ndb/tools/delete_all.cpp b/ndb/tools/delete_all.cpp index eee76981eda..664fa616412 100644 --- a/ndb/tools/delete_all.cpp +++ b/ndb/tools/delete_all.cpp @@ -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()); diff --git a/ndb/tools/desc.cpp b/ndb/tools/desc.cpp index fd7b243be2a..8c84802ef51 100644 --- a/ndb/tools/desc.cpp +++ b/ndb/tools/desc.cpp @@ -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..."; diff --git a/ndb/tools/drop_index.cpp b/ndb/tools/drop_index.cpp index 2b7f8c1bce9..cc0dd9a8be6 100644 --- a/ndb/tools/drop_index.cpp +++ b/ndb/tools/drop_index.cpp @@ -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); diff --git a/ndb/tools/drop_tab.cpp b/ndb/tools/drop_tab.cpp index 2b0b6908449..81131c9060a 100644 --- a/ndb/tools/drop_tab.cpp +++ b/ndb/tools/drop_tab.cpp @@ -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); diff --git a/ndb/tools/restore/consumer_restore.cpp b/ndb/tools/restore/consumer_restore.cpp index 18049fd363f..dce03ad38bf 100644 --- a/ndb/tools/restore/consumer_restore.cpp +++ b/ndb/tools/restore/consumer_restore.cpp @@ -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() diff --git a/ndb/tools/restore/consumer_restore.hpp b/ndb/tools/restore/consumer_restore.hpp index f0fea54437a..1bf6d89a912 100644 --- a/ndb/tools/restore/consumer_restore.hpp +++ b/ndb/tools/restore/consumer_restore.hpp @@ -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; diff --git a/ndb/tools/restore/restore_main.cpp b/ndb/tools/restore/restore_main.cpp index c24ed620b71..528a9634658 100644 --- a/ndb/tools/restore/restore_main.cpp +++ b/ndb/tools/restore/restore_main.cpp @@ -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 diff --git a/ndb/tools/select_all.cpp b/ndb/tools/select_all.cpp index 9c79d68fad3..1d8442335dd 100644 --- a/ndb/tools/select_all.cpp +++ b/ndb/tools/select_all.cpp @@ -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()); diff --git a/ndb/tools/select_count.cpp b/ndb/tools/select_count.cpp index 6975070e14d..156d31f70fd 100644 --- a/ndb/tools/select_count.cpp +++ b/ndb/tools/select_count.cpp @@ -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()); |