1
/* Copyright (C) 2003 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; either version 2 of the License, or
6
(at your option) any later version.
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License
14
along with this program; if not, write to the Free Software
15
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
18
#include <NDBT_Test.hpp>
19
#include <HugoTransactions.hpp>
20
#include <UtilTransactions.hpp>
21
#include <NdbRestarter.hpp>
22
#include <NdbRestarts.hpp>
24
#include <signaldata/DumpStateOrd.hpp>
26
#define CHECK(b) if (!(b)) { \
27
g_err << "ERR: "<< step->getName() \
28
<< " failed on line " << __LINE__ << endl; \
29
result = NDBT_FAILED; break;\
46
for(size_t i = 0; i < attriblist.size(); i++){
50
void buildAttribList(const NdbDictionary::Table* pTab);
51
Vector<Attrib*> attriblist;
54
void AttribList::buildAttribList(const NdbDictionary::Table* pTab){
58
// Build attrib definitions that describes which attributes to build index
59
// Try to build strange combinations, not just "all" or all PK's
63
for(i = 1; i <= pTab->getNoOfColumns(); i++){
66
for(int a = 0; a<i; a++)
68
attriblist.push_back(attr);
71
for(i = pTab->getNoOfColumns()-1; i > 0; i--){
75
for(int a = 0; a<i; a++)
76
attr->attribs[a] = a+b;
77
attriblist.push_back(attr);
79
for(i = pTab->getNoOfColumns(); i > 0; i--){
81
attr->numAttribs = pTab->getNoOfColumns() - i;
82
for(int a = 0; a<pTab->getNoOfColumns() - i; a++)
83
attr->attribs[a] = pTab->getNoOfColumns()-a-1;
84
attriblist.push_back(attr);
86
for(i = 1; i < pTab->getNoOfColumns(); i++){
88
attr->numAttribs = pTab->getNoOfColumns() - i;
89
for(int a = 0; a<pTab->getNoOfColumns() - i; a++)
90
attr->attribs[a] = pTab->getNoOfColumns()-a-1;
91
attriblist.push_back(attr);
93
for(i = 1; i < pTab->getNoOfColumns(); i++){
96
for(int a = 0; a<2; a++){
97
attr->attribs[a] = i%pTab->getNoOfColumns();
99
attriblist.push_back(attr);
104
attr->numAttribs = 1;
105
attr->attribs[0] = pTab->getNoOfColumns()-1;
106
attriblist.push_back(attr);
110
attr->numAttribs = 2;
111
attr->attribs[0] = pTab->getNoOfColumns()-1;
112
attr->attribs[1] = 0;
113
attriblist.push_back(attr);
117
attr->numAttribs = 2;
118
attr->attribs[0] = 0;
119
attr->attribs[1] = pTab->getNoOfColumns()-1;
120
attriblist.push_back(attr);
123
for(size_t i = 0; i < attriblist.size(); i++){
125
ndbout << attriblist[i]->numAttribs << ": " ;
126
for(int a = 0; a < attriblist[i]->numAttribs; a++)
127
ndbout << attriblist[i]->attribs[a] << ", ";
137
static const int SKIP_INDEX = 99;
139
int create_index(NDBT_Context* ctx, int indxNum,
140
const NdbDictionary::Table* pTab,
141
Ndb* pNdb, Attrib* attr, bool logged){
142
bool orderedIndex = ctx->getProperty("OrderedIndex", (unsigned)0);
143
int result = NDBT_OK;
145
HugoCalculator calc(*pTab);
147
if (attr->numAttribs == 1 &&
148
calc.isUpdateCol(attr->attribs[0]) == true){
149
// Don't create index for the Hugo update column
150
// since it's not unique
155
BaseString::snprintf(idxName, 255, "IDC%d", indxNum);
157
ndbout << "Creating " << ((logged)?"logged ": "temporary ") << "ordered index "<<idxName << " (";
159
ndbout << "Creating " << ((logged)?"logged ": "temporary ") << "unique index "<<idxName << " (";
161
NdbDictionary::Index pIdx(idxName);
162
pIdx.setTable(pTab->getName());
164
pIdx.setType(NdbDictionary::Index::OrderedIndex);
166
pIdx.setType(NdbDictionary::Index::UniqueHashIndex);
167
for (int c = 0; c< attr->numAttribs; c++){
168
int attrNo = attr->attribs[c];
169
pIdx.addIndexColumn(pTab->getColumn(attrNo)->getName());
170
ndbout << pTab->getColumn(attrNo)->getName()<<" ";
173
pIdx.setStoredIndex(logged);
175
if (pNdb->getDictionary()->createIndex(pIdx) != 0){
176
attr->indexCreated = false;
177
ndbout << "FAILED!" << endl;
178
const NdbError err = pNdb->getDictionary()->getNdbError();
180
if(err.classification == NdbError::ApplicationError)
185
ndbout << "OK!" << endl;
186
attr->indexCreated = true;
192
int drop_index(int indxNum, Ndb* pNdb,
193
const NdbDictionary::Table* pTab, Attrib* attr){
194
int result = NDBT_OK;
196
if (attr->indexCreated == false)
199
BaseString::snprintf(idxName, 255, "IDC%d", indxNum);
202
ndbout << "Dropping index "<<idxName<<"(" << pTab->getName() << ") ";
203
if (pNdb->getDictionary()->dropIndex(idxName, pTab->getName()) != 0){
204
ndbout << "FAILED!" << endl;
205
ERR(pNdb->getDictionary()->getNdbError());
206
result = NDBT_FAILED;
208
ndbout << "OK!" << endl;
213
int runCreateIndexes(NDBT_Context* ctx, NDBT_Step* step){
214
int loops = ctx->getNumLoops();
216
const NdbDictionary::Table* pTab = ctx->getTab();
217
Ndb* pNdb = GETNDB(step);
218
int result = NDBT_OK;
219
// NOTE If we need to test creating both logged and non logged indexes
220
// this should be divided into two testcases
221
// The paramater logged should then be specified
222
// as a TC_PROPERTY. ex TC_PROPERTY("LoggedIndexes", 1);
223
// and read into the test step like
224
bool logged = ctx->getProperty("LoggedIndexes", 1);
227
attrList.buildAttribList(pTab);
230
while (l < loops && result == NDBT_OK){
232
for (i = 0; i < attrList.attriblist.size(); i++){
234
// Try to create index
235
if (create_index(ctx, i, pTab, pNdb, attrList.attriblist[i], logged) == NDBT_FAILED)
236
result = NDBT_FAILED;
239
// Now drop all indexes that where created
240
for (i = 0; i < attrList.attriblist.size(); i++){
243
if (drop_index(i, pNdb, pTab, attrList.attriblist[i]) != NDBT_OK)
244
result = NDBT_FAILED;
253
int createRandomIndex(NDBT_Context* ctx, NDBT_Step* step){
254
const NdbDictionary::Table* pTab = ctx->getTab();
255
Ndb* pNdb = GETNDB(step);
256
bool logged = ctx->getProperty("LoggedIndexes", 1);
259
attrList.buildAttribList(pTab);
263
const Uint32 i = rand() % attrList.attriblist.size();
264
int res = create_index(ctx, i, pTab, pNdb, attrList.attriblist[i],
266
if (res == SKIP_INDEX){
271
if (res == NDBT_FAILED){
275
ctx->setProperty("createRandomIndex", i);
276
// Now drop all indexes that where created
284
int createRandomIndex_Drop(NDBT_Context* ctx, NDBT_Step* step){
285
Ndb* pNdb = GETNDB(step);
287
Uint32 i = ctx->getProperty("createRandomIndex");
289
BaseString::snprintf(idxName, 255, "IDC%d", i);
292
ndbout << "Dropping index " << idxName << " ";
293
if (pNdb->getDictionary()->dropIndex(idxName,
294
ctx->getTab()->getName()) != 0){
295
ndbout << "FAILED!" << endl;
296
ERR(pNdb->getDictionary()->getNdbError());
299
ndbout << "OK!" << endl;
305
int createPkIndex(NDBT_Context* ctx, NDBT_Step* step){
306
bool orderedIndex = ctx->getProperty("OrderedIndex", (unsigned)0);
308
const NdbDictionary::Table* pTab = ctx->getTab();
309
Ndb* pNdb = GETNDB(step);
311
bool logged = ctx->getProperty("LoggedIndexes", 1);
314
BaseString::snprintf(pkIdxName, 255, "IDC_PK_%s", pTab->getName());
316
ndbout << "Creating " << ((logged)?"logged ": "temporary ") << "ordered index "
317
<< pkIdxName << " (";
319
ndbout << "Creating " << ((logged)?"logged ": "temporary ") << "unique index "
320
<< pkIdxName << " (";
322
NdbDictionary::Index pIdx(pkIdxName);
323
pIdx.setTable(pTab->getName());
325
pIdx.setType(NdbDictionary::Index::OrderedIndex);
327
pIdx.setType(NdbDictionary::Index::UniqueHashIndex);
328
for (int c = 0; c< pTab->getNoOfColumns(); c++){
329
const NdbDictionary::Column * col = pTab->getColumn(c);
330
if(col->getPrimaryKey()){
331
pIdx.addIndexColumn(col->getName());
332
ndbout << col->getName() <<" ";
336
pIdx.setStoredIndex(logged);
338
if (pNdb->getDictionary()->createIndex(pIdx) != 0){
339
ndbout << "FAILED!" << endl;
340
const NdbError err = pNdb->getDictionary()->getNdbError();
345
ndbout << "OK!" << endl;
349
int createPkIndex_Drop(NDBT_Context* ctx, NDBT_Step* step){
350
const NdbDictionary::Table* pTab = ctx->getTab();
351
Ndb* pNdb = GETNDB(step);
354
ndbout << "Dropping index " << pkIdxName << " ";
355
if (pNdb->getDictionary()->dropIndex(pkIdxName,
356
pTab->getName()) != 0){
357
ndbout << "FAILED!" << endl;
358
ERR(pNdb->getDictionary()->getNdbError());
361
ndbout << "OK!" << endl;
368
runVerifyIndex(NDBT_Context* ctx, NDBT_Step* step){
369
// Verify that data in index match
371
Ndb* pNdb = GETNDB(step);
372
UtilTransactions utilTrans(*ctx->getTab());
373
const int batchSize = ctx->getProperty("BatchSize", 16);
374
const int parallelism = batchSize > 240 ? 240 : batchSize;
377
if (utilTrans.verifyIndex(pNdb, idxName, parallelism, true) != 0){
378
g_err << "Inconsistent index" << endl;
381
} while(ctx->isTestStopped() == false);
386
runTransactions1(NDBT_Context* ctx, NDBT_Step* step){
387
// Verify that data in index match
389
Ndb* pNdb = GETNDB(step);
390
HugoTransactions hugoTrans(*ctx->getTab());
391
const int batchSize = ctx->getProperty("BatchSize", 50);
393
int rows = ctx->getNumRecords();
394
while (ctx->isTestStopped() == false) {
395
if (hugoTrans.pkUpdateRecords(pNdb, rows, batchSize) != 0){
396
g_err << "Updated table failed" << endl;
400
ctx->sync_down("PauseThreads");
401
if(ctx->isTestStopped())
404
if (hugoTrans.scanUpdateRecords(pNdb, rows, batchSize) != 0){
405
g_err << "Updated table failed" << endl;
409
ctx->sync_down("PauseThreads");
415
runTransactions2(NDBT_Context* ctx, NDBT_Step* step){
416
// Verify that data in index match
418
Ndb* pNdb = GETNDB(step);
419
HugoTransactions hugoTrans(*ctx->getTab());
420
const int batchSize = ctx->getProperty("BatchSize", 50);
422
int rows = ctx->getNumRecords();
423
while (ctx->isTestStopped() == false) {
425
if (hugoTrans.indexReadRecords(pNdb, pkIdxName, rows, batchSize) != 0){
426
g_err << "Index read failed" << endl;
430
ctx->sync_down("PauseThreads");
431
if(ctx->isTestStopped())
434
if (hugoTrans.indexUpdateRecords(pNdb, pkIdxName, rows, batchSize) != 0){
435
g_err << "Index update failed" << endl;
439
ctx->sync_down("PauseThreads");
445
runTransactions3(NDBT_Context* ctx, NDBT_Step* step){
446
// Verify that data in index match
448
Ndb* pNdb = GETNDB(step);
449
HugoTransactions hugoTrans(*ctx->getTab());
450
UtilTransactions utilTrans(*ctx->getTab());
451
const int batchSize = ctx->getProperty("BatchSize", 32);
452
const int parallel = batchSize > 240 ? 240 : batchSize;
454
int rows = ctx->getNumRecords();
455
while (ctx->isTestStopped() == false) {
456
if(hugoTrans.loadTable(pNdb, rows, batchSize, false) != 0){
457
g_err << "Load table failed" << endl;
460
ctx->sync_down("PauseThreads");
461
if(ctx->isTestStopped())
464
if (hugoTrans.pkUpdateRecords(pNdb, rows, batchSize) != 0){
465
g_err << "Updated table failed" << endl;
469
ctx->sync_down("PauseThreads");
470
if(ctx->isTestStopped())
473
if (hugoTrans.indexReadRecords(pNdb, pkIdxName, rows, batchSize) != 0){
474
g_err << "Index read failed" << endl;
478
ctx->sync_down("PauseThreads");
479
if(ctx->isTestStopped())
482
if (hugoTrans.indexUpdateRecords(pNdb, pkIdxName, rows, batchSize) != 0){
483
g_err << "Index update failed" << endl;
487
ctx->sync_down("PauseThreads");
488
if(ctx->isTestStopped())
491
if (hugoTrans.scanUpdateRecords(pNdb, rows, 5, parallel) != 0){
492
g_err << "Scan updated table failed" << endl;
496
ctx->sync_down("PauseThreads");
497
if(ctx->isTestStopped())
500
if(utilTrans.clearTable(pNdb, rows, parallel) != 0){
501
g_err << "Clear table failed" << endl;
505
ctx->sync_down("PauseThreads");
506
if(ctx->isTestStopped())
510
if(utilTrans.selectCount(pNdb, 64, &count) != 0 || count != 0)
512
ctx->sync_down("PauseThreads");
517
int runRestarts(NDBT_Context* ctx, NDBT_Step* step){
518
int result = NDBT_OK;
519
int loops = ctx->getNumLoops();
520
NDBT_TestCase* pCase = ctx->getCase();
521
NdbRestarts restarts;
524
int sync_threads = ctx->getProperty("Threads", (unsigned)0);
526
while(i<loops && result != NDBT_FAILED && !ctx->isTestStopped()){
527
if(restarts.executeRestart("RestartRandomNodeAbort", timeout) != 0){
528
g_err << "Failed to executeRestart(" <<pCase->getName() <<")" << endl;
529
result = NDBT_FAILED;
532
ctx->sync_up_and_wait("PauseThreads", sync_threads);
539
int runCreateLoadDropIndex(NDBT_Context* ctx, NDBT_Step* step){
540
int loops = ctx->getNumLoops();
541
int records = ctx->getNumRecords();
543
const NdbDictionary::Table* pTab = ctx->getTab();
544
Ndb* pNdb = GETNDB(step);
545
int result = NDBT_OK;
546
int batchSize = ctx->getProperty("BatchSize", 1);
547
int parallelism = batchSize > 240? 240: batchSize;
548
ndbout << "batchSize="<<batchSize<<endl;
549
bool logged = ctx->getProperty("LoggedIndexes", 1);
551
HugoTransactions hugoTrans(*pTab);
552
UtilTransactions utilTrans(*pTab);
554
attrList.buildAttribList(pTab);
556
for (unsigned int i = 0; i < attrList.attriblist.size(); i++){
558
while (l < loops && result == NDBT_OK){
561
// Create index first and then load
563
// Try to create index
564
if (create_index(ctx, i, pTab, pNdb, attrList.attriblist[i], logged) == NDBT_FAILED){
565
result = NDBT_FAILED;
568
// Load the table with data
569
ndbout << "Loading data after" << endl;
570
CHECK(hugoTrans.loadTable(pNdb, records, batchSize) == 0);
574
// Load table then create index
576
// Load the table with data
577
ndbout << "Loading data before" << endl;
578
CHECK(hugoTrans.loadTable(pNdb, records, batchSize) == 0);
580
// Try to create index
581
if (create_index(ctx, i, pTab, pNdb, attrList.attriblist[i], logged) == NDBT_FAILED)
582
result = NDBT_FAILED;
586
// Verify that data in index match
588
CHECK(utilTrans.verifyIndex(pNdb, idxName, parallelism) == 0);
591
ndbout <<"Doing it all"<<endl;
593
ndbout << " pkUpdateRecords" << endl;
594
CHECK(hugoTrans.pkUpdateRecords(pNdb, records, batchSize) == 0);
595
CHECK(utilTrans.verifyIndex(pNdb, idxName, parallelism) == 0);
596
CHECK(hugoTrans.pkUpdateRecords(pNdb, records, batchSize) == 0);
597
CHECK(utilTrans.verifyIndex(pNdb, idxName, parallelism) == 0);
598
ndbout << " pkDelRecords half" << endl;
599
CHECK(hugoTrans.pkDelRecords(pNdb, records/2, batchSize) == 0);
600
CHECK(utilTrans.verifyIndex(pNdb, idxName, parallelism) == 0);
601
ndbout << " scanUpdateRecords" << endl;
602
CHECK(hugoTrans.scanUpdateRecords(pNdb, records/2, parallelism) == 0);
603
CHECK(utilTrans.verifyIndex(pNdb, idxName, parallelism) == 0);
604
ndbout << " clearTable" << endl;
605
CHECK(utilTrans.clearTable(pNdb, records/2, parallelism) == 0);
606
CHECK(utilTrans.verifyIndex(pNdb, idxName, parallelism) == 0);
607
CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
609
ndbout << " loadTable" << endl;
610
CHECK(hugoTrans.loadTable(pNdb, records, batchSize) == 0);
611
CHECK(utilTrans.verifyIndex(pNdb, idxName, parallelism) == 0);
612
ndbout << " loadTable again" << endl;
613
CHECK(hugoTrans.loadTable(pNdb, records, batchSize) == 0);
614
CHECK(utilTrans.verifyIndex(pNdb, idxName, parallelism) == 0);
615
CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
616
CHECK(count == records);
620
// Drop index first and then clear
622
// Try to create index
623
if (drop_index(i, pNdb, pTab, attrList.attriblist[i]) != NDBT_OK){
624
result = NDBT_FAILED;
628
ndbout << "Clearing table after" << endl;
629
CHECK(hugoTrans.clearTable(pNdb, records, parallelism) == 0);
633
// Clear table then drop index
636
ndbout << "Clearing table before" << endl;
637
CHECK(hugoTrans.clearTable(pNdb, records, parallelism) == 0);
640
if (drop_index(i, pNdb, pTab, attrList.attriblist[i]) != NDBT_OK)
641
result = NDBT_FAILED;
644
ndbout << " Done!" << endl;
648
// Make sure index is dropped
649
drop_index(i, pNdb, pTab, attrList.attriblist[i]);
656
int runInsertDelete(NDBT_Context* ctx, NDBT_Step* step){
657
int loops = ctx->getNumLoops();
658
int records = ctx->getNumRecords();
659
const NdbDictionary::Table* pTab = ctx->getTab();
660
Ndb* pNdb = GETNDB(step);
661
int result = NDBT_OK;
662
int batchSize = ctx->getProperty("BatchSize", 1);
663
int parallelism = batchSize > 240? 240: batchSize;
664
ndbout << "batchSize="<<batchSize<<endl;
665
bool logged = ctx->getProperty("LoggedIndexes", 1);
667
HugoTransactions hugoTrans(*pTab);
668
UtilTransactions utilTrans(*pTab);
671
attrList.buildAttribList(pTab);
673
for (unsigned int i = 0; i < attrList.attriblist.size(); i++){
675
Attrib* attr = attrList.attriblist[i];
677
if (create_index(ctx, i, pTab, pNdb, attr, logged) == NDBT_OK){
679
while (l <= loops && result == NDBT_OK){
681
CHECK(hugoTrans.loadTable(pNdb, records, batchSize) == 0);
682
CHECK(utilTrans.verifyIndex(pNdb, idxName, parallelism) == 0);
683
CHECK(utilTrans.clearTable(pNdb, records, parallelism) == 0);
684
CHECK(utilTrans.verifyIndex(pNdb, idxName, parallelism) == 0);
689
if (drop_index(i, pNdb, pTab, attr) != NDBT_OK)
690
result = NDBT_FAILED;
696
int runLoadTable(NDBT_Context* ctx, NDBT_Step* step){
697
int records = ctx->getNumRecords();
699
HugoTransactions hugoTrans(*ctx->getTab());
700
int batchSize = ctx->getProperty("BatchSize", 1);
701
if(hugoTrans.loadTable(GETNDB(step), records, batchSize) != 0){
708
int runClearTable(NDBT_Context* ctx, NDBT_Step* step){
709
int records = ctx->getNumRecords();
711
UtilTransactions utilTrans(*ctx->getTab());
712
if (utilTrans.clearTable(GETNDB(step), records) != 0){
718
int runSystemRestart1(NDBT_Context* ctx, NDBT_Step* step){
719
Ndb* pNdb = GETNDB(step);
720
int result = NDBT_OK;
722
Uint32 loops = ctx->getNumLoops();
723
int records = ctx->getNumRecords();
725
NdbRestarter restarter;
728
UtilTransactions utilTrans(*ctx->getTab());
729
HugoTransactions hugoTrans(*ctx->getTab());
730
const char * name = ctx->getTab()->getName();
731
while(i<=loops && result != NDBT_FAILED){
733
ndbout << "Loop " << i << "/"<< loops <<" started" << endl;
736
2. Restart cluster and verify records
738
4. Restart cluster and verify records
739
5. Delete half of the records
740
6. Restart cluster and verify records
741
7. Delete all records
742
8. Restart cluster and verify records
743
9. Insert, update, delete records
744
10. Restart cluster and verify records
745
11. Insert, update, delete records
746
12. Restart cluster with error insert 5020 and verify records
748
ndbout << "Loading records..." << endl;
749
CHECK(hugoTrans.loadTable(pNdb, records, 1) == 0);
750
CHECK(utilTrans.verifyIndex(pNdb, idxName, 16, false) == 0);
752
ndbout << "Restarting cluster" << endl;
753
CHECK(restarter.restartAll() == 0);
754
CHECK(restarter.waitClusterStarted(timeout) == 0);
755
CHECK(pNdb->waitUntilReady(timeout) == 0);
757
ndbout << "Verifying records..." << endl;
758
CHECK(hugoTrans.pkReadRecords(pNdb, records) == 0);
759
CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
760
CHECK(count == records);
761
CHECK(utilTrans.verifyIndex(pNdb, idxName, 16, false) == 0);
763
ndbout << "Updating records..." << endl;
764
CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
765
CHECK(utilTrans.verifyIndex(pNdb, idxName, 16, false) == 0);
767
ndbout << "Restarting cluster..." << endl;
768
CHECK(restarter.restartAll() == 0);
769
CHECK(restarter.waitClusterStarted(timeout) == 0);
770
CHECK(pNdb->waitUntilReady(timeout) == 0);
772
ndbout << "Verifying records..." << endl;
773
CHECK(hugoTrans.pkReadRecords(pNdb, records) == 0);
774
CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
775
CHECK(count == records);
776
CHECK(utilTrans.verifyIndex(pNdb, idxName, 16, false) == 0);
778
ndbout << "Deleting 50% of records..." << endl;
779
CHECK(hugoTrans.pkDelRecords(pNdb, records/2) == 0);
780
CHECK(utilTrans.verifyIndex(pNdb, idxName, 16, false) == 0);
782
ndbout << "Restarting cluster..." << endl;
783
CHECK(restarter.restartAll() == 0);
784
CHECK(restarter.waitClusterStarted(timeout) == 0);
785
CHECK(pNdb->waitUntilReady(timeout) == 0);
787
ndbout << "Verifying records..." << endl;
788
CHECK(hugoTrans.scanReadRecords(pNdb, records/2, 0, 64) == 0);
789
CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
790
CHECK(count == (records/2));
791
CHECK(utilTrans.verifyIndex(pNdb, idxName, 16, false) == 0);
793
ndbout << "Deleting all records..." << endl;
794
CHECK(utilTrans.clearTable(pNdb, records/2) == 0);
795
CHECK(utilTrans.verifyIndex(pNdb, idxName, 16, false) == 0);
797
ndbout << "Restarting cluster..." << endl;
798
CHECK(restarter.restartAll() == 0);
799
CHECK(restarter.waitClusterStarted(timeout) == 0);
800
CHECK(pNdb->waitUntilReady(timeout) == 0);
802
ndbout << "Verifying records..." << endl;
803
CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
805
CHECK(utilTrans.verifyIndex(pNdb, idxName, 16, false) == 0);
807
ndbout << "Doing it all..." << endl;
808
CHECK(hugoTrans.loadTable(pNdb, records, 1) == 0);
809
CHECK(utilTrans.verifyIndex(pNdb, idxName, 16, false) == 0);
810
CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
811
CHECK(utilTrans.verifyIndex(pNdb, idxName, 16, false) == 0);
812
CHECK(hugoTrans.pkDelRecords(pNdb, records/2) == 0);
813
CHECK(hugoTrans.scanUpdateRecords(pNdb, records) == 0);
814
CHECK(utilTrans.verifyIndex(pNdb, idxName, 16, false) == 0);
815
CHECK(utilTrans.clearTable(pNdb, records) == 0);
816
CHECK(hugoTrans.loadTable(pNdb, records, 1) == 0);
817
CHECK(utilTrans.clearTable(pNdb, records) == 0);
818
CHECK(hugoTrans.loadTable(pNdb, records, 1) == 0);
819
CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
820
CHECK(utilTrans.clearTable(pNdb, records) == 0);
822
ndbout << "Restarting cluster..." << endl;
823
CHECK(restarter.restartAll() == 0);
824
CHECK(restarter.waitClusterStarted(timeout) == 0);
825
CHECK(pNdb->waitUntilReady(timeout) == 0);
827
ndbout << "Verifying records..." << endl;
828
CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
831
ndbout << "Doing it all..." << endl;
832
CHECK(hugoTrans.loadTable(pNdb, records, 1) == 0);
833
CHECK(utilTrans.verifyIndex(pNdb, idxName, 16, false) == 0);
834
CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
835
CHECK(utilTrans.verifyIndex(pNdb, idxName, 16, false) == 0);
836
CHECK(hugoTrans.pkDelRecords(pNdb, records/2) == 0);
837
CHECK(utilTrans.verifyIndex(pNdb, idxName, 16, false) == 0);
838
CHECK(hugoTrans.scanUpdateRecords(pNdb, records) == 0);
839
CHECK(utilTrans.verifyIndex(pNdb, idxName, 16, false) == 0);
840
CHECK(utilTrans.clearTable(pNdb, records) == 0);
841
CHECK(hugoTrans.loadTable(pNdb, records, 1) == 0);
842
CHECK(utilTrans.clearTable(pNdb, records) == 0);
844
ndbout << "Restarting cluster with error insert 5020..." << endl;
845
CHECK(restarter.restartAll(false, true) == 0);
846
CHECK(restarter.waitClusterNoStart(timeout) == 0);
847
CHECK(restarter.insertErrorInAllNodes(5020) == 0);
848
CHECK(restarter.startAll() == 0);
849
CHECK(restarter.waitClusterStarted(timeout) == 0);
850
CHECK(pNdb->waitUntilReady(timeout) == 0);
856
ndbout << "runSystemRestart1 finished" << endl;
861
#define CHECK2(b, t) if(!b){ g_err << __LINE__ << ": " << t << endl; break;}
864
runMixed1(NDBT_Context* ctx, NDBT_Step* step){
865
// Verify that data in index match
867
Ndb* pNdb = GETNDB(step);
868
HugoOperations hugoOps(*ctx->getTab());
873
g_err << "pkRead, indexRead, Commit" << endl;
874
CHECK2(hugoOps.startTransaction(pNdb) == 0, "startTransaction");
875
CHECK2(hugoOps.indexReadRecords(pNdb, pkIdxName, 0) == 0, "indexReadRecords");
876
CHECK2(hugoOps.pkReadRecord(pNdb, 0) == 0, "pkReadRecord");
877
CHECK2(hugoOps.execute_Commit(pNdb) == 0, "executeCommit");
878
CHECK2(hugoOps.closeTransaction(pNdb) == 0, "closeTransaction");
881
g_err << "pkRead, indexRead, Commit" << endl;
882
CHECK2(hugoOps.startTransaction(pNdb) == 0, "startTransaction");
883
CHECK2(hugoOps.pkReadRecord(pNdb, 0) == 0, "pkReadRecord");
884
CHECK2(hugoOps.indexReadRecords(pNdb, pkIdxName, 0) == 0, "indexReadRecords");
885
CHECK2(hugoOps.execute_Commit(pNdb) == 0, "executeCommit");
886
CHECK2(hugoOps.closeTransaction(pNdb) == 0, "closeTransaction");
890
g_err << "pkRead, indexRead, NoCommit, Commit" << endl;
891
CHECK2(hugoOps.startTransaction(pNdb) == 0, "startTransaction");
892
CHECK2(hugoOps.pkReadRecord(pNdb, 0) == 0, "pkReadRecord");
893
CHECK2(hugoOps.indexReadRecords(pNdb, pkIdxName, 0) == 0,
895
CHECK2(hugoOps.execute_NoCommit(pNdb) == 0, "executeNoCommit");
896
CHECK2(hugoOps.execute_Commit(pNdb) == 0, "executeCommit");
897
CHECK2(hugoOps.closeTransaction(pNdb) == 0, "closeTransaction");
900
g_err << "pkRead, pkRead, Commit" << endl;
901
CHECK2(hugoOps.startTransaction(pNdb) == 0, "startTransaction ");
902
CHECK2(hugoOps.pkReadRecord(pNdb, 0) == 0, "pkReadRecords ");
903
CHECK2(hugoOps.pkReadRecord(pNdb, 0) == 0, "pkReadRecords ");
904
CHECK2(hugoOps.execute_Commit(pNdb) == 0, "executeCommit");
905
CHECK2(hugoOps.closeTransaction(pNdb) == 0, "closeTransaction ");
908
g_err << "indexRead, indexRead, Commit" << endl;
910
CHECK2(hugoOps.startTransaction(pNdb) == 0, "startTransaction ");
911
CHECK2(hugoOps.indexReadRecords(pNdb, pkIdxName, 0) == 0, "indexReadRecords");
912
CHECK2(hugoOps.indexReadRecords(pNdb, pkIdxName, 0) == 0, "indexReadRecords");
913
CHECK2(hugoOps.execute_Commit(pNdb) == 0, "executeCommit");
915
CHECK2(hugoOps.closeTransaction(pNdb) == 0, "closeTransaction ");
921
hugoOps.closeTransaction(pNdb);
926
runBuildDuring(NDBT_Context* ctx, NDBT_Step* step){
927
// Verify that data in index match
929
const int Threads = ctx->getProperty("Threads", (Uint32)0);
930
const int loops = ctx->getNumLoops();
932
for(int i = 0; i<loops; i++){
934
if(createPkIndex(ctx, step) != NDBT_OK){
935
g_err << "Failed to create index" << endl;
940
if(ctx->isTestStopped())
944
if(createRandomIndex(ctx, step) != NDBT_OK){
945
g_err << "Failed to create index" << endl;
950
if(ctx->isTestStopped())
953
ctx->setProperty("pause", 1);
955
for(int j = 0; count < Threads && !ctx->isTestStopped();
956
j = (j+1) % Threads){
958
sprintf(buf, "Thread%d_paused", j);
959
int tmp = ctx->getProperty(buf, (Uint32)0);
963
if(ctx->isTestStopped())
967
if(createPkIndex_Drop(ctx, step) != NDBT_OK){
968
g_err << "Failed to drop index" << endl;
973
if(ctx->isTestStopped())
977
if(createRandomIndex_Drop(ctx, step) != NDBT_OK){
978
g_err << "Failed to drop index" << endl;
983
ctx->setProperty("pause", (Uint32)0);
984
NdbSleep_SecSleep(2);
991
static NdbLockable g_lock;
992
static int threadCounter = 0;
995
wait_paused(NDBT_Context* ctx, int id){
996
if(ctx->getProperty("pause", (Uint32)0) == 1){
998
sprintf(buf, "Thread%d_paused", id);
999
ctx->setProperty(buf, 1);
1000
while(!ctx->isTestStopped() && ctx->getProperty("pause", (Uint32)0) == 1){
1001
NdbSleep_MilliSleep(250);
1003
ctx->setProperty(buf, (Uint32)0);
1008
runTransactions4(NDBT_Context* ctx, NDBT_Step* step){
1011
const int ThreadId = threadCounter++;
1014
// Verify that data in index match
1016
Ndb* pNdb = GETNDB(step);
1017
HugoTransactions hugoTrans(*ctx->getTab());
1018
UtilTransactions utilTrans(*ctx->getTab());
1019
const int batchSize = ctx->getProperty("BatchSize", 32);
1020
const int parallel = batchSize > 240 ? 240 : batchSize;
1022
int rows = ctx->getNumRecords();
1023
while (ctx->isTestStopped() == false) {
1024
if(hugoTrans.loadTable(pNdb, rows, batchSize, false) != 0){
1025
g_err << "Load table failed" << endl;
1029
wait_paused(ctx, ThreadId);
1031
if(ctx->isTestStopped())
1034
if (hugoTrans.pkUpdateRecords(pNdb, rows, batchSize) != 0){
1035
g_err << "Updated table failed" << endl;
1039
wait_paused(ctx, ThreadId);
1041
if(ctx->isTestStopped())
1044
if (hugoTrans.scanUpdateRecords(pNdb, rows, 5, parallel) != 0){
1045
g_err << "Scan updated table failed" << endl;
1049
wait_paused(ctx, ThreadId);
1051
if(ctx->isTestStopped())
1054
if(utilTrans.clearTable(pNdb, rows, parallel) != 0){
1055
g_err << "Clear table failed" << endl;
1063
runUniqueNullTransactions(NDBT_Context* ctx, NDBT_Step* step){
1064
Ndb* pNdb = GETNDB(step);
1066
bool logged = ctx->getProperty("LoggedIndexes", 1);
1067
bool orderedIndex = ctx->getProperty("OrderedIndex", (unsigned)0);
1068
NdbConnection * pTrans = 0;
1070
const NdbDictionary::Table* pTab = ctx->getTab();
1072
char nullIndex[255];
1073
BaseString::snprintf(nullIndex, 255, "IDC_PK_%s_NULL", pTab->getName());
1075
ndbout << "Creating " << ((logged)?"logged ": "temporary ") << "ordered index "
1076
<< pkIdxName << " (";
1078
ndbout << "Creating " << ((logged)?"logged ": "temporary ") << "unique index "
1079
<< pkIdxName << " (";
1081
NdbDictionary::Index pIdx(pkIdxName);
1082
pIdx.setTable(pTab->getName());
1084
pIdx.setType(NdbDictionary::Index::OrderedIndex);
1086
pIdx.setType(NdbDictionary::Index::UniqueHashIndex);
1087
pIdx.setStoredIndex(logged);
1089
for (c = 0; c< pTab->getNoOfColumns(); c++){
1090
const NdbDictionary::Column * col = pTab->getColumn(c);
1091
if(col->getPrimaryKey()){
1092
pIdx.addIndexColumn(col->getName());
1093
ndbout << col->getName() <<" ";
1098
for (c = 0; c< pTab->getNoOfColumns(); c++){
1099
const NdbDictionary::Column * col = pTab->getColumn(c);
1100
if(col->getNullable()){
1101
pIdx.addIndexColumn(col->getName());
1102
ndbout << col->getName() <<" ";
1110
ndbout << endl << "No nullable column found -> NDBT_FAILED" << endl;
1114
if (pNdb->getDictionary()->createIndex(pIdx) != 0){
1115
ndbout << "FAILED!" << endl;
1116
const NdbError err = pNdb->getDictionary()->getNdbError();
1121
int result = NDBT_OK;
1123
HugoTransactions hugoTrans(*ctx->getTab());
1124
const int batchSize = ctx->getProperty("BatchSize", 50);
1125
int loops = ctx->getNumLoops();
1126
int rows = ctx->getNumRecords();
1127
while (loops-- > 0 && ctx->isTestStopped() == false) {
1128
if (hugoTrans.pkUpdateRecords(pNdb, rows, batchSize) != 0){
1129
g_err << "Updated table failed" << endl;
1130
result = NDBT_FAILED;
1135
if(ctx->isTestStopped()){
1140
while(ctx->getNoOfRunningSteps() > 1){
1141
NdbSleep_MilliSleep(100);
1144
result = NDBT_FAILED;
1145
pTrans = pNdb->startTransaction();
1146
NdbScanOperation * sOp;
1149
if(!pTrans) goto done;
1150
sOp = pTrans->getNdbScanOperation(pTab->getName());
1152
if(sOp->readTuples(NdbScanOperation::LM_Exclusive)) goto done;
1153
if(pTrans->execute(NoCommit) == -1) goto done;
1154
while((eof = sOp->nextResult(true)) == 0){
1156
NdbOperation * uOp = sOp->updateCurrentTuple();
1157
if(uOp == 0) goto done;
1158
uOp->setValue(colId, 0);
1159
} while((eof = sOp->nextResult(false)) == 0);
1160
eof = pTrans->execute(Commit);
1161
if(eof == -1) goto done;
1165
if(pTrans) pNdb->closeTransaction(pTrans);
1166
pNdb->getDictionary()->dropIndex(nullIndex, pTab->getName());
1170
int runLQHKEYREF(NDBT_Context* ctx, NDBT_Step* step){
1171
int result = NDBT_OK;
1172
int loops = ctx->getNumLoops() * 100;
1173
NdbRestarter restarter;
1175
myRandom48Init(NdbTick_CurrentMillisecond());
1178
int val = DumpStateOrd::DihMinTimeBetweenLCP;
1179
if(restarter.dumpStateAllNodes(&val, 1) != 0){
1180
g_err << "Failed to dump DihMinTimeBetweenLCP" << endl;
1185
for(int i = 0; i<loops && !ctx->isTestStopped(); i++){
1186
int randomId = myRandom48(restarter.getNumDbNodes());
1187
int nodeId = restarter.getDbNodeId(randomId);
1189
const Uint32 error = 5031 + (i % 3);
1191
if(restarter.insertErrorInNode(nodeId, error) != 0){
1192
g_err << "Failed to error insert( " << error << ") in node "
1203
runBug21384(NDBT_Context* ctx, NDBT_Step* step)
1205
Ndb* pNdb = GETNDB(step);
1206
HugoTransactions hugoTrans(*ctx->getTab());
1207
NdbRestarter restarter;
1209
int loops = ctx->getNumLoops();
1210
const int rows = ctx->getNumRecords();
1211
const int batchsize = ctx->getProperty("BatchSize", 50);
1215
if(restarter.insertErrorInAllNodes(8037) != 0)
1217
g_err << "Failed to error insert(8037)" << endl;
1221
if (hugoTrans.indexReadRecords(pNdb, pkIdxName, rows, batchsize) == 0)
1223
g_err << "Index succeded (it should have failed" << endl;
1227
if(restarter.insertErrorInAllNodes(0) != 0)
1229
g_err << "Failed to error insert(0)" << endl;
1233
if (hugoTrans.indexReadRecords(pNdb, pkIdxName, rows, batchsize) != 0){
1234
g_err << "Index read failed" << endl;
1244
NDBT_TESTSUITE(testIndex);
1245
TESTCASE("CreateAll",
1246
"Test that we can create all various indexes on each table\n"
1247
"Then drop the indexes\n"){
1248
INITIALIZER(runCreateIndexes);
1250
TESTCASE("CreateAll_O",
1251
"Test that we can create all various indexes on each table\n"
1252
"Then drop the indexes\n"){
1253
TC_PROPERTY("OrderedIndex", 1);
1254
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1255
INITIALIZER(runCreateIndexes);
1257
TESTCASE("InsertDeleteGentle",
1258
"Create one index, then perform insert and delete in the table\n"
1259
"loop number of times. Use batch size 1."){
1260
TC_PROPERTY("BatchSize", 1);
1261
INITIALIZER(runInsertDelete);
1262
FINALIZER(runClearTable);
1264
TESTCASE("InsertDeleteGentle_O",
1265
"Create one index, then perform insert and delete in the table\n"
1266
"loop number of times. Use batch size 1."){
1267
TC_PROPERTY("OrderedIndex", 1);
1268
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1269
TC_PROPERTY("BatchSize", 1);
1270
INITIALIZER(runInsertDelete);
1271
FINALIZER(runClearTable);
1273
TESTCASE("InsertDelete",
1274
"Create one index, then perform insert and delete in the table\n"
1275
"loop number of times. Use batchsize 512 to stress db more"){
1276
TC_PROPERTY("BatchSize", 512);
1277
INITIALIZER(runInsertDelete);
1278
FINALIZER(runClearTable);
1281
TESTCASE("InsertDelete_O",
1282
"Create one index, then perform insert and delete in the table\n"
1283
"loop number of times. Use batchsize 512 to stress db more"){
1284
TC_PROPERTY("OrderedIndex", 1);
1285
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1286
TC_PROPERTY("BatchSize", 512);
1287
INITIALIZER(runInsertDelete);
1288
FINALIZER(runClearTable);
1291
TESTCASE("CreateLoadDropGentle",
1292
"Try to create, drop and load various indexes \n"
1293
"on table loop number of times.Usa batch size 1.\n"){
1294
TC_PROPERTY("BatchSize", 1);
1295
INITIALIZER(runCreateLoadDropIndex);
1297
TESTCASE("CreateLoadDropGentle_O",
1298
"Try to create, drop and load various indexes \n"
1299
"on table loop number of times.Usa batch size 1.\n"){
1300
TC_PROPERTY("OrderedIndex", 1);
1301
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1302
TC_PROPERTY("BatchSize", 1);
1303
INITIALIZER(runCreateLoadDropIndex);
1305
TESTCASE("CreateLoadDrop",
1306
"Try to create, drop and load various indexes \n"
1307
"on table loop number of times. Use batchsize 512 to stress db more\n"){
1308
TC_PROPERTY("BatchSize", 512);
1309
INITIALIZER(runCreateLoadDropIndex);
1311
TESTCASE("CreateLoadDrop_O",
1312
"Try to create, drop and load various indexes \n"
1313
"on table loop number of times. Use batchsize 512 to stress db more\n"){
1314
TC_PROPERTY("OrderedIndex", 1);
1315
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1316
TC_PROPERTY("BatchSize", 512);
1317
INITIALIZER(runCreateLoadDropIndex);
1320
"Test that indexes are correctly maintained during node fail and node restart"){
1321
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1322
TC_PROPERTY("PauseThreads", 2);
1323
INITIALIZER(runClearTable);
1324
INITIALIZER(createRandomIndex);
1325
INITIALIZER(runLoadTable);
1327
STEP(runTransactions1);
1328
STEP(runTransactions1);
1329
FINALIZER(runVerifyIndex);
1330
FINALIZER(createRandomIndex_Drop);
1331
FINALIZER(runClearTable);
1334
"Test that indexes are correctly maintained during node fail and node restart"){
1335
TC_PROPERTY("OrderedIndex", 1);
1336
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1337
TC_PROPERTY("PauseThreads", 2);
1338
INITIALIZER(runClearTable);
1339
INITIALIZER(createRandomIndex);
1340
INITIALIZER(runLoadTable);
1342
STEP(runTransactions1);
1343
STEP(runTransactions1);
1344
FINALIZER(runVerifyIndex);
1345
FINALIZER(createRandomIndex_Drop);
1346
FINALIZER(runClearTable);
1349
"Test that indexes are correctly maintained during node fail and node restart"){
1350
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1351
TC_PROPERTY("PauseThreads", 2);
1352
INITIALIZER(runClearTable);
1353
INITIALIZER(createRandomIndex);
1354
INITIALIZER(createPkIndex);
1355
INITIALIZER(runLoadTable);
1357
STEP(runTransactions2);
1358
STEP(runTransactions2);
1359
FINALIZER(runVerifyIndex);
1360
FINALIZER(createRandomIndex_Drop);
1361
FINALIZER(createPkIndex_Drop);
1362
FINALIZER(runClearTable);
1365
"Test that indexes are correctly maintained during node fail and node restart"){
1366
TC_PROPERTY("OrderedIndex", 1);
1367
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1368
TC_PROPERTY("PauseThreads", 1);
1369
INITIALIZER(runClearTable);
1370
INITIALIZER(createRandomIndex);
1371
INITIALIZER(createPkIndex);
1372
INITIALIZER(runLoadTable);
1374
STEP(runTransactions2);
1375
//STEP(runTransactions2);
1376
FINALIZER(runVerifyIndex);
1377
FINALIZER(createRandomIndex_Drop);
1378
FINALIZER(createPkIndex_Drop);
1379
FINALIZER(runClearTable);
1382
"Test that indexes are correctly maintained during node fail and node restart"){
1383
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1384
TC_PROPERTY("PauseThreads", 2);
1385
INITIALIZER(runClearTable);
1386
INITIALIZER(createRandomIndex);
1387
INITIALIZER(createPkIndex);
1389
STEP(runTransactions3);
1390
STEP(runVerifyIndex);
1391
FINALIZER(runVerifyIndex);
1392
FINALIZER(createPkIndex_Drop);
1393
FINALIZER(createRandomIndex_Drop);
1394
FINALIZER(runClearTable);
1397
"Test that indexes are correctly maintained during node fail and node restart"){
1398
TC_PROPERTY("OrderedIndex", 1);
1399
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1400
TC_PROPERTY("PauseThreads", 2);
1401
INITIALIZER(runClearTable);
1402
INITIALIZER(createRandomIndex);
1403
INITIALIZER(createPkIndex);
1405
STEP(runTransactions3);
1406
STEP(runVerifyIndex);
1407
FINALIZER(runVerifyIndex);
1408
FINALIZER(createPkIndex_Drop);
1409
FINALIZER(createRandomIndex_Drop);
1410
FINALIZER(runClearTable);
1413
"Test that indexes are correctly maintained during node fail and node restart"){
1414
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1415
TC_PROPERTY("PauseThreads", 4);
1416
INITIALIZER(runClearTable);
1417
INITIALIZER(createRandomIndex);
1418
INITIALIZER(createPkIndex);
1419
INITIALIZER(runLoadTable);
1421
STEP(runTransactions1);
1422
STEP(runTransactions1);
1423
STEP(runTransactions2);
1424
STEP(runTransactions2);
1425
FINALIZER(runVerifyIndex);
1426
FINALIZER(createRandomIndex_Drop);
1427
FINALIZER(createPkIndex_Drop);
1428
FINALIZER(runClearTable);
1431
"Test that indexes are correctly maintained during node fail and node restart"){
1432
TC_PROPERTY("OrderedIndex", 1);
1433
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1434
TC_PROPERTY("PauseThreads", 4);
1435
INITIALIZER(runClearTable);
1436
INITIALIZER(createRandomIndex);
1437
INITIALIZER(createPkIndex);
1438
INITIALIZER(runLoadTable);
1440
STEP(runTransactions1);
1441
STEP(runTransactions1);
1442
STEP(runTransactions2);
1443
STEP(runTransactions2);
1444
FINALIZER(runVerifyIndex);
1445
FINALIZER(createRandomIndex_Drop);
1446
FINALIZER(createPkIndex_Drop);
1447
FINALIZER(runClearTable);
1450
"Test that indexes are correctly maintained during node fail and node restart"){
1451
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1452
TC_PROPERTY("BatchSize", (unsigned)1);
1453
INITIALIZER(runClearTable);
1454
INITIALIZER(createRandomIndex);
1455
INITIALIZER(createPkIndex);
1456
INITIALIZER(runLoadTable);
1458
STEP(runTransactions1);
1459
STEP(runTransactions1);
1460
STEP(runTransactions2);
1461
STEP(runTransactions2);
1462
FINALIZER(runVerifyIndex);
1463
FINALIZER(createRandomIndex_Drop);
1464
FINALIZER(createPkIndex_Drop);
1465
FINALIZER(runClearTable);
1468
"Test that indexes are correctly maintained during node fail and node restart"){
1469
TC_PROPERTY("OrderedIndex", 1);
1470
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1471
TC_PROPERTY("BatchSize", (unsigned)1);
1472
INITIALIZER(runClearTable);
1473
INITIALIZER(createRandomIndex);
1474
INITIALIZER(createPkIndex);
1475
INITIALIZER(runLoadTable);
1477
STEP(runTransactions1);
1478
STEP(runTransactions1);
1479
STEP(runTransactions2);
1480
STEP(runTransactions2);
1481
FINALIZER(runVerifyIndex);
1482
FINALIZER(createRandomIndex_Drop);
1483
FINALIZER(createPkIndex_Drop);
1484
FINALIZER(runClearTable);
1487
"Test that indexes are correctly maintained during SR"){
1488
INITIALIZER(runClearTable);
1489
INITIALIZER(createRandomIndex);
1490
INITIALIZER(createPkIndex);
1491
STEP(runSystemRestart1);
1492
FINALIZER(runVerifyIndex);
1493
FINALIZER(createPkIndex_Drop);
1494
FINALIZER(createRandomIndex_Drop);
1495
FINALIZER(runClearTable);
1497
TESTCASE("MixedTransaction",
1498
"Test mixing of index and normal operations"){
1499
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1500
INITIALIZER(runClearTable);
1501
INITIALIZER(createPkIndex);
1502
INITIALIZER(runLoadTable);
1504
FINALIZER(createPkIndex_Drop);
1505
FINALIZER(runClearTable);
1508
"Test that indexes are correctly maintained during SR"){
1509
TC_PROPERTY("OrderedIndex", 1);
1510
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1511
INITIALIZER(runClearTable);
1512
INITIALIZER(createRandomIndex);
1513
INITIALIZER(createPkIndex);
1514
STEP(runSystemRestart1);
1515
FINALIZER(runVerifyIndex);
1516
FINALIZER(createPkIndex_Drop);
1517
FINALIZER(createRandomIndex_Drop);
1518
FINALIZER(runClearTable);
1520
TESTCASE("BuildDuring",
1521
"Test that index build when running transactions work"){
1522
TC_PROPERTY("OrderedIndex", (unsigned)0);
1523
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1524
TC_PROPERTY("Threads", 1); // # runTransactions4
1525
INITIALIZER(runClearTable);
1526
STEP(runBuildDuring);
1527
STEP(runTransactions4);
1528
//STEP(runTransactions4);
1529
FINALIZER(runClearTable);
1531
TESTCASE("BuildDuring_O",
1532
"Test that index build when running transactions work"){
1533
TC_PROPERTY("OrderedIndex", (unsigned)1);
1534
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1535
TC_PROPERTY("Threads", 1); // # runTransactions4
1536
INITIALIZER(runClearTable);
1537
STEP(runBuildDuring);
1538
STEP(runTransactions4);
1539
//STEP(runTransactions4);
1540
FINALIZER(runClearTable);
1542
TESTCASE("UniqueNull",
1543
"Test that unique indexes and nulls"){
1544
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1545
INITIALIZER(runClearTable);
1546
INITIALIZER(createRandomIndex);
1547
INITIALIZER(createPkIndex);
1548
INITIALIZER(runLoadTable);
1549
STEP(runTransactions1);
1550
STEP(runTransactions2);
1551
STEP(runUniqueNullTransactions);
1552
FINALIZER(runVerifyIndex);
1553
FINALIZER(createRandomIndex_Drop);
1554
FINALIZER(createPkIndex_Drop);
1555
FINALIZER(runClearTable);
1557
TESTCASE("Bug21384",
1558
"Test that unique indexes and nulls"){
1559
TC_PROPERTY("LoggedIndexes", (unsigned)0);
1560
INITIALIZER(runClearTable);
1561
INITIALIZER(createPkIndex);
1562
INITIALIZER(runLoadTable);
1564
FINALIZER(createPkIndex_Drop);
1565
FINALIZER(runClearTable);
1567
NDBT_TESTSUITE_END(testIndex);
1569
int main(int argc, const char** argv){
1571
return testIndex.execute(argc, argv);
1574
template class Vector<Attrib*>;