diff options
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/test/ndbapi/flexAsynch.cpp | 15 | ||||
-rw-r--r-- | ndb/test/ndbapi/flexHammer.cpp | 12 | ||||
-rw-r--r-- | ndb/test/ndbapi/flexTT.cpp | 13 | ||||
-rw-r--r-- | ndb/test/ndbapi/slow_select.cpp | 9 | ||||
-rw-r--r-- | ndb/test/ndbapi/testDeadlock.cpp | 14 | ||||
-rw-r--r-- | ndb/test/ndbapi/testLcp.cpp | 11 |
6 files changed, 62 insertions, 12 deletions
diff --git a/ndb/test/ndbapi/flexAsynch.cpp b/ndb/test/ndbapi/flexAsynch.cpp index 1953444d640..fc50cc99acf 100644 --- a/ndb/test/ndbapi/flexAsynch.cpp +++ b/ndb/test/ndbapi/flexAsynch.cpp @@ -143,6 +143,8 @@ tellThreads(StartType what) ThreadStart[i] = what; } +static Ndb_cluster_connection *g_cluster_connection= 0; + NDB_COMMAND(flexAsynch, "flexAsynch", "flexAsynch", "flexAsynch", 65535) { ndb_init(); @@ -200,7 +202,14 @@ NDB_COMMAND(flexAsynch, "flexAsynch", "flexAsynch", "flexAsynch", 65535) setAttrNames(); setTableNames(); - Ndb * pNdb = new Ndb("TEST_DB"); + Ndb_cluster_connection con; + if(con.connect(12, 5, 1) != 0) + { + return NDBT_ProgramExit(NDBT_FAILED); + } + g_cluster_connection= &con; + + Ndb * pNdb = new Ndb(g_cluster_connection, "TEST_DB"); pNdb->init(); tNodeId = pNdb->getNodeId(); @@ -225,7 +234,7 @@ NDB_COMMAND(flexAsynch, "flexAsynch", "flexAsynch", "flexAsynch", 65535) * Create NDB objects. * ****************************************************************/ resetThreads(); - for (int i = 0; i < tNoOfThreads ; i++) { + for (i = 0; i < tNoOfThreads ; i++) { pThreadData[i].ThreadNo = i ; threadLife[i] = NdbThread_Create(threadLoop, @@ -468,7 +477,7 @@ threadLoop(void* ThreadData) StartType tType; ThreadNdb* tabThread = (ThreadNdb*)ThreadData; int threadNo = tabThread->ThreadNo; - localNdb = new Ndb("TEST_DB"); + localNdb = new Ndb(g_cluster_connection, "TEST_DB"); localNdb->init(1024); localNdb->waitUntilReady(10000); unsigned int threadBase = (threadNo << 16) + tNodeId ; diff --git a/ndb/test/ndbapi/flexHammer.cpp b/ndb/test/ndbapi/flexHammer.cpp index 688e70d501a..aa783d00d20 100644 --- a/ndb/test/ndbapi/flexHammer.cpp +++ b/ndb/test/ndbapi/flexHammer.cpp @@ -174,6 +174,8 @@ tellThreads(ThreadNdb* threadArrayP, const StartType what) threadArrayP[i].threadStart = what; } // for } // tellThreads + +static Ndb_cluster_connection *g_cluster_connection= 0; NDB_COMMAND(flexHammer, "flexHammer", "flexHammer", "flexHammer", 65535) //main(int argc, const char** argv) @@ -213,7 +215,13 @@ NDB_COMMAND(flexHammer, "flexHammer", "flexHammer", "flexHammer", 65535) // NdbThread_SetConcurrencyLevel(tNoOfThreads + 2); // Create and init Ndb object - pMyNdb = new Ndb("TEST_DB"); + Ndb_cluster_connection con; + if(con.connect(12, 5, 1) != 0) + { + return NDBT_ProgramExit(NDBT_FAILED); + } + g_cluster_connection= &con; + pMyNdb = new Ndb(g_cluster_connection, "TEST_DB"); pMyNdb->init(); // Wait for Ndb to become ready @@ -345,7 +353,7 @@ flexHammerThread(void* pArg) for (i = 0; i < MAXATTRSIZE; i++) attrValue[i] = 0; // Ndb object for each thread - pMyNdb = new Ndb( "TEST_DB" ); + pMyNdb = new Ndb(g_cluster_connection, "TEST_DB" ); pMyNdb->init(); if (pMyNdb->waitUntilReady(10000) != 0) { // Error, NDB is not ready diff --git a/ndb/test/ndbapi/flexTT.cpp b/ndb/test/ndbapi/flexTT.cpp index 3b976f9f87e..2ad9ef19ddf 100644 --- a/ndb/test/ndbapi/flexTT.cpp +++ b/ndb/test/ndbapi/flexTT.cpp @@ -169,6 +169,8 @@ tellThreads(StartType what) ThreadStart[i] = what; } +static Ndb_cluster_connection *g_cluster_connection= 0; + NDB_COMMAND(flexTT, "flexTT", "flexTT", "flexTT", 65535) { ndb_init(); @@ -226,7 +228,14 @@ NDB_COMMAND(flexTT, "flexTT", "flexTT", "flexTT", 65535) setAttrNames(); setTableNames(); - Ndb * pNdb = new Ndb("TEST_DB"); + Ndb_cluster_connection con; + if(con.connect(12, 5, 1) != 0) + { + return NDBT_ProgramExit(NDBT_FAILED); + } + g_cluster_connection= &con; + + Ndb * pNdb = new Ndb(g_cluster_connection, "TEST_DB"); pNdb->init(); tNodeId = pNdb->getNodeId(); @@ -334,7 +343,7 @@ threadLoop(void* ThreadData) void * mem = malloc(sizeof(TransNdb)*tNoOfParallelTrans); TransNdb* pTransData = (TransNdb*)mem; - localNdb = new Ndb("TEST_DB"); + localNdb = new Ndb(g_cluster_connection, "TEST_DB"); localNdb->init(1024); localNdb->waitUntilReady(); diff --git a/ndb/test/ndbapi/slow_select.cpp b/ndb/test/ndbapi/slow_select.cpp index 5f0383325a6..3febae2c8eb 100644 --- a/ndb/test/ndbapi/slow_select.cpp +++ b/ndb/test/ndbapi/slow_select.cpp @@ -36,7 +36,14 @@ static void lookup(); int main(void){ ndb_init(); - Ndb g_ndb("test"); + + Ndb_cluster_connection con; + if(con.connect(12, 5, 1) != 0) + { + return 1; + } + + Ndb g_ndb(&con, "test"); g_ndb.init(1024); require(g_ndb.waitUntilReady() == 0); diff --git a/ndb/test/ndbapi/testDeadlock.cpp b/ndb/test/ndbapi/testDeadlock.cpp index f9e15f46716..0070a7ecc83 100644 --- a/ndb/test/ndbapi/testDeadlock.cpp +++ b/ndb/test/ndbapi/testDeadlock.cpp @@ -49,7 +49,7 @@ printusage() static Opt g_opt; static NdbMutex *ndbout_mutex= NULL; - +static Ndb_cluster_connection *g_cluster_connection= 0; #define DBG(x) \ do { \ if (! g_opt.m_dbg) break; \ @@ -217,7 +217,7 @@ Thr::exit() static int runstep_connect(Thr& thr) { - Ndb* ndb = thr.m_ndb = new Ndb("TEST_DB"); + Ndb* ndb = thr.m_ndb = new Ndb(g_cluster_connection, "TEST_DB"); CHN(ndb, ndb->init() == 0); CHN(ndb, ndb->waitUntilReady() == 0); DBG(thr << " connected"); @@ -503,10 +503,18 @@ NDB_COMMAND(testOdbcDriver, "testDeadlock", "testDeadlock", "testDeadlock", 6553 printusage(); return NDBT_ProgramExit(NDBT_WRONGARGS); } + + Ndb_cluster_connection con; + if(con.connect(12, 5, 1) != 0) + { + return NDBT_ProgramExit(NDBT_FAILED); + } + g_cluster_connection= &con; + if ( strchr(g_opt.m_scan, 't') != 0 && wl1822_main('t') == -1 || strchr(g_opt.m_scan, 'x') != 0 && wl1822_main('x') == -1 - ) { + ) { return NDBT_ProgramExit(NDBT_FAILED); } return NDBT_ProgramExit(NDBT_OK); diff --git a/ndb/test/ndbapi/testLcp.cpp b/ndb/test/ndbapi/testLcp.cpp index 4304d51596a..8bfc7ccf9b9 100644 --- a/ndb/test/ndbapi/testLcp.cpp +++ b/ndb/test/ndbapi/testLcp.cpp @@ -30,6 +30,7 @@ static CASE g_ops[] = const size_t OP_COUNT = (sizeof(g_ops)/sizeof(g_ops[0])); static Ndb* g_ndb = 0; +static Ndb_cluster_connection *g_cluster_connection= 0; static CASE* g_cases; static HugoOperations* g_hugo_ops; @@ -133,7 +134,13 @@ static int parse_args(int argc, char** argv) static int connect_ndb() { - g_ndb = new Ndb("TEST_DB"); + g_cluster_connection = new Ndb_cluster_connection(); + if(g_cluster_connection->connect(12, 5, 1) != 0) + { + return 1; + } + + g_ndb = new Ndb(g_cluster_connection, "TEST_DB"); g_ndb->init(); if(g_ndb->waitUntilReady(30) == 0){ int args[] = { DumpStateOrd::DihMaxTimeBetweenLCP }; @@ -145,8 +152,10 @@ static int connect_ndb() static int disconnect_ndb() { delete g_ndb; + delete g_cluster_connection; g_ndb = 0; g_table = 0; + g_cluster_connection= 0; return 0; } |