Skip to content

Commit 410aeed

Browse files
committed
Remove version 1 multiwait API use from NDB Autotest
1 parent f31a7a4 commit 410aeed

File tree

1 file changed

+13
-30
lines changed

1 file changed

+13
-30
lines changed

storage/ndb/test/ndbapi/testAsynchMultiwait.cpp

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -83,7 +83,7 @@ NdbPool * global_ndb_pool;
8383
<< __LINE__ << ": " << e.getNdbError() << endl; return NDBT_FAILED; }
8484

8585

86-
int runSetup(NDBT_Context* ctx, NDBT_Step* step, int waitGroupSize){
86+
int runSetup(NDBT_Context* ctx, NDBT_Step* step){
8787

8888
int records = ctx->getNumRecords();
8989
int batchSize = ctx->getProperty("BatchSize", 1);
@@ -98,6 +98,8 @@ int runSetup(NDBT_Context* ctx, NDBT_Step* step, int waitGroupSize){
9898
}
9999

100100
Ndb_cluster_connection* conn = &pNdb->get_ndb_cluster_connection();
101+
global_ndb_pool = new NdbPool(conn);
102+
int waitGroupSize = 7;
101103

102104
/* The first call to create_multi_ndb_wait_group() should succeed ... */
103105
global_poll_group = conn->create_ndb_wait_group(waitGroupSize);
@@ -113,23 +115,6 @@ int runSetup(NDBT_Context* ctx, NDBT_Step* step, int waitGroupSize){
113115
return NDBT_OK;
114116
}
115117

116-
/* NdbWaitGroup version 1 API uses a fixed-size wait group.
117-
It cannot grow. We size it at 1000 Ndbs.
118-
*/
119-
int runSetup_v1(NDBT_Context* ctx, NDBT_Step* step) {
120-
return runSetup(ctx, step, 1000);
121-
}
122-
123-
/* Version 2 of the API will allow the wait group to grow on
124-
demand, so we start small.
125-
*/
126-
int runSetup_v2(NDBT_Context* ctx, NDBT_Step* step) {
127-
Ndb* pNdb = GETNDB(step);
128-
Ndb_cluster_connection* conn = &pNdb->get_ndb_cluster_connection();
129-
global_ndb_pool = new NdbPool(conn);
130-
return runSetup(ctx, step, 7);
131-
}
132-
133118
int runCleanup(NDBT_Context* ctx, NDBT_Step* step){
134119
int records = ctx->getNumRecords();
135120
int batchSize = ctx->getProperty("BatchSize", 1);
@@ -161,7 +146,6 @@ int runPkReadMultiBasic(NDBT_Context* ctx, NDBT_Step* step){
161146

162147
Ndb* ndbObjs[ MAX_NDBS ];
163148
NdbTransaction* transArray[ MAX_NDBS ];
164-
Ndb ** ready_ndbs;
165149

166150
for (int j=0; j < MAX_NDBS; j++)
167151
{
@@ -209,7 +193,7 @@ int runPkReadMultiBasic(NDBT_Context* ctx, NDBT_Step* step){
209193
ndb->sendPreparedTransactions();
210194

211195
transArray[ndbcnt] = trans;
212-
global_poll_group->addNdb(ndb);
196+
global_poll_group->push(ndb);
213197

214198
ndbcnt++;
215199
pollcnt++;
@@ -222,13 +206,13 @@ int runPkReadMultiBasic(NDBT_Context* ctx, NDBT_Step* step){
222206
{
223207
/* Occasionally check with no timeout */
224208
Uint32 timeout_millis = myRandom48(2)?10000:0;
225-
int count = global_poll_group->wait(ready_ndbs, timeout_millis);
209+
int count = global_poll_group->wait(timeout_millis);
226210

227211
if (count > 0)
228212
{
229213
for (int y=0; y < count; y++)
230214
{
231-
Ndb *ndb = ready_ndbs[y];
215+
Ndb *ndb = global_poll_group->pop();
232216
check(ndb->pollNdb(0, 1) != 0, (*ndb));
233217
}
234218
pollcnt -= count;
@@ -319,14 +303,13 @@ int runPkReadMultiWakeupT2(NDBT_Context* ctx, NDBT_Step* step)
319303
NdbOperation::AbortOnError) == 0,
320304
hugoOps);
321305

322-
global_poll_group->addNdb(ndb);
323-
Ndb ** ready_ndbs;
306+
global_poll_group->push(ndb);
324307
int wait_rc = 0;
325308
int acknowledged = 0;
326309
do
327310
{
328311
ndbout << "Thread 2 : Calling NdbWaitGroup::wait()" << endl;
329-
wait_rc = global_poll_group->wait(ready_ndbs, 10000);
312+
wait_rc = global_poll_group->wait(10000);
330313
ndbout << " Result : " << wait_rc << endl;
331314
if (wait_rc == 0)
332315
{
@@ -497,21 +480,21 @@ int sleepAndStop(NDBT_Context* ctx, NDBT_Step* step){
497480
NDBT_TESTSUITE(testAsynchMultiwait);
498481
TESTCASE("AsynchMultiwaitPkRead",
499482
"Verify NdbWaitGroup API (1 thread)") {
500-
INITIALIZER(runSetup_v1);
483+
INITIALIZER(runSetup);
501484
STEP(runPkReadMultiBasic);
502485
FINALIZER(runCleanup);
503486
}
504487
TESTCASE("AsynchMultiwaitWakeup",
505488
"Verify wait-multi-ndb wakeup Api code") {
506-
INITIALIZER(runSetup_v1);
489+
INITIALIZER(runSetup);
507490
TC_PROPERTY("PHASE", Uint32(0));
508491
STEP(runPkReadMultiWakeupT1);
509492
STEP(runPkReadMultiWakeupT2);
510493
FINALIZER(runCleanup);
511494
}
512495
TESTCASE("AsynchMultiwait_Version2",
513496
"Verify NdbWaitGroup API version 2") {
514-
INITIALIZER(runSetup_v2);
497+
INITIALIZER(runSetup);
515498
TC_PROPERTY("LOOP", Uint32(0));
516499
STEP(runV2MultiWait_Push_Thd0);
517500
STEP(runV2MultiWait_Push_Thd1);
@@ -520,7 +503,7 @@ TESTCASE("AsynchMultiwait_Version2",
520503
FINALIZER(runCleanup);
521504
}
522505
TESTCASE("JustMisc", "Just run the Scan test") {
523-
INITIALIZER(runSetup_v2);
506+
INITIALIZER(runSetup);
524507
STEP(runMiscUntilStopped);
525508
STEP(sleepAndStop);
526509
FINALIZER(runCleanup);

0 commit comments

Comments
 (0)