1
1
/*
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.
3
3
4
4
This program is free software; you can redistribute it and/or modify
5
5
it under the terms of the GNU General Public License as published by
@@ -83,7 +83,7 @@ NdbPool * global_ndb_pool;
83
83
<< __LINE__ << " : " << e.getNdbError () << endl; return NDBT_FAILED; }
84
84
85
85
86
- int runSetup (NDBT_Context* ctx, NDBT_Step* step, int waitGroupSize ){
86
+ int runSetup (NDBT_Context* ctx, NDBT_Step* step){
87
87
88
88
int records = ctx->getNumRecords ();
89
89
int batchSize = ctx->getProperty (" BatchSize" , 1 );
@@ -98,6 +98,8 @@ int runSetup(NDBT_Context* ctx, NDBT_Step* step, int waitGroupSize){
98
98
}
99
99
100
100
Ndb_cluster_connection* conn = &pNdb->get_ndb_cluster_connection ();
101
+ global_ndb_pool = new NdbPool (conn);
102
+ int waitGroupSize = 7 ;
101
103
102
104
/* The first call to create_multi_ndb_wait_group() should succeed ... */
103
105
global_poll_group = conn->create_ndb_wait_group (waitGroupSize);
@@ -113,23 +115,6 @@ int runSetup(NDBT_Context* ctx, NDBT_Step* step, int waitGroupSize){
113
115
return NDBT_OK;
114
116
}
115
117
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
-
133
118
int runCleanup (NDBT_Context* ctx, NDBT_Step* step){
134
119
int records = ctx->getNumRecords ();
135
120
int batchSize = ctx->getProperty (" BatchSize" , 1 );
@@ -161,7 +146,6 @@ int runPkReadMultiBasic(NDBT_Context* ctx, NDBT_Step* step){
161
146
162
147
Ndb* ndbObjs[ MAX_NDBS ];
163
148
NdbTransaction* transArray[ MAX_NDBS ];
164
- Ndb ** ready_ndbs;
165
149
166
150
for (int j=0 ; j < MAX_NDBS; j++)
167
151
{
@@ -209,7 +193,7 @@ int runPkReadMultiBasic(NDBT_Context* ctx, NDBT_Step* step){
209
193
ndb->sendPreparedTransactions ();
210
194
211
195
transArray[ndbcnt] = trans;
212
- global_poll_group->addNdb (ndb);
196
+ global_poll_group->push (ndb);
213
197
214
198
ndbcnt++;
215
199
pollcnt++;
@@ -222,13 +206,13 @@ int runPkReadMultiBasic(NDBT_Context* ctx, NDBT_Step* step){
222
206
{
223
207
/* Occasionally check with no timeout */
224
208
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);
226
210
227
211
if (count > 0 )
228
212
{
229
213
for (int y=0 ; y < count; y++)
230
214
{
231
- Ndb *ndb = ready_ndbs[y] ;
215
+ Ndb *ndb = global_poll_group-> pop () ;
232
216
check (ndb->pollNdb (0 , 1 ) != 0 , (*ndb));
233
217
}
234
218
pollcnt -= count;
@@ -319,14 +303,13 @@ int runPkReadMultiWakeupT2(NDBT_Context* ctx, NDBT_Step* step)
319
303
NdbOperation::AbortOnError) == 0 ,
320
304
hugoOps);
321
305
322
- global_poll_group->addNdb (ndb);
323
- Ndb ** ready_ndbs;
306
+ global_poll_group->push (ndb);
324
307
int wait_rc = 0 ;
325
308
int acknowledged = 0 ;
326
309
do
327
310
{
328
311
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 );
330
313
ndbout << " Result : " << wait_rc << endl;
331
314
if (wait_rc == 0 )
332
315
{
@@ -497,21 +480,21 @@ int sleepAndStop(NDBT_Context* ctx, NDBT_Step* step){
497
480
NDBT_TESTSUITE (testAsynchMultiwait);
498
481
TESTCASE (" AsynchMultiwaitPkRead" ,
499
482
" Verify NdbWaitGroup API (1 thread)" ) {
500
- INITIALIZER (runSetup_v1 );
483
+ INITIALIZER (runSetup );
501
484
STEP (runPkReadMultiBasic);
502
485
FINALIZER (runCleanup);
503
486
}
504
487
TESTCASE (" AsynchMultiwaitWakeup" ,
505
488
" Verify wait-multi-ndb wakeup Api code" ) {
506
- INITIALIZER (runSetup_v1 );
489
+ INITIALIZER (runSetup );
507
490
TC_PROPERTY (" PHASE" , Uint32 (0 ));
508
491
STEP (runPkReadMultiWakeupT1);
509
492
STEP (runPkReadMultiWakeupT2);
510
493
FINALIZER (runCleanup);
511
494
}
512
495
TESTCASE (" AsynchMultiwait_Version2" ,
513
496
" Verify NdbWaitGroup API version 2" ) {
514
- INITIALIZER (runSetup_v2 );
497
+ INITIALIZER (runSetup );
515
498
TC_PROPERTY (" LOOP" , Uint32 (0 ));
516
499
STEP (runV2MultiWait_Push_Thd0);
517
500
STEP (runV2MultiWait_Push_Thd1);
@@ -520,7 +503,7 @@ TESTCASE("AsynchMultiwait_Version2",
520
503
FINALIZER (runCleanup);
521
504
}
522
505
TESTCASE (" JustMisc" , " Just run the Scan test" ) {
523
- INITIALIZER (runSetup_v2 );
506
+ INITIALIZER (runSetup );
524
507
STEP (runMiscUntilStopped);
525
508
STEP (sleepAndStop);
526
509
FINALIZER (runCleanup);
0 commit comments