Commit c1408638 authored by unknown's avatar unknown

ndb - more removal of old constructor usage in test prgs


ndb/test/ndbapi/flexAsynch.cpp:
  new constructor
ndb/test/ndbapi/flexHammer.cpp:
  new constructor
ndb/test/ndbapi/flexTT.cpp:
  new constructor
ndb/test/ndbapi/slow_select.cpp:
  new constructor
ndb/test/ndbapi/testDeadlock.cpp:
  new constructor
ndb/test/ndbapi/testLcp.cpp:
  new constructor
parent 8395a8ec
......@@ -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 ;
......
......@@ -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
......
......@@ -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();
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
}
......
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