-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtestBackup.cpp
More file actions
808 lines (672 loc) · 19.9 KB
/
Copy pathtestBackup.cpp
File metadata and controls
808 lines (672 loc) · 19.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
/*
Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <NDBT.hpp>
#include <NDBT_Test.hpp>
#include <HugoTransactions.hpp>
#include <UtilTransactions.hpp>
#include <NdbBackup.hpp>
int runDropTable(NDBT_Context* ctx, NDBT_Step* step);
#define CHECK(b) if (!(b)) { \
g_err << "ERR: "<< step->getName() \
<< " failed on line " << __LINE__ << endl; \
result = NDBT_FAILED; \
continue; }
char tabname[1000];
int
clearOldBackups(NDBT_Context* ctx, NDBT_Step* step)
{
strcpy(tabname, ctx->getTab()->getName());
NdbBackup backup(GETNDB(step)->getNodeId());
backup.clearOldBackups();
return NDBT_OK;
}
int runLoadTable(NDBT_Context* ctx, NDBT_Step* step){
int records = ctx->getNumRecords();
HugoTransactions hugoTrans(*ctx->getTab());
if (hugoTrans.loadTable(GETNDB(step), records) != 0){
return NDBT_FAILED;
}
return NDBT_OK;
}
bool testMaster = true;
bool testSlave = false;
int setMaster(NDBT_Context* ctx, NDBT_Step* step){
testMaster = true;
testSlave = false;
return NDBT_OK;
}
int setMasterAsSlave(NDBT_Context* ctx, NDBT_Step* step){
testMaster = true;
testSlave = true;
return NDBT_OK;
}
int setSlave(NDBT_Context* ctx, NDBT_Step* step){
testMaster = false;
testSlave = true;
return NDBT_OK;
}
int runAbort(NDBT_Context* ctx, NDBT_Step* step){
NdbBackup backup(GETNDB(step)->getNodeId()+1);
NdbRestarter restarter;
if (restarter.getNumDbNodes() < 2){
ctx->stopTest();
return NDBT_OK;
}
if(restarter.waitClusterStarted(60) != 0){
g_err << "Cluster failed to start" << endl;
return NDBT_FAILED;
}
if (testMaster) {
if (testSlave) {
if (backup.NFMasterAsSlave(restarter) != NDBT_OK){
return NDBT_FAILED;
}
} else {
if (backup.NFMaster(restarter) != NDBT_OK){
return NDBT_FAILED;
}
}
} else {
if (backup.NFSlave(restarter) != NDBT_OK){
return NDBT_FAILED;
}
}
return NDBT_OK;
}
int runFail(NDBT_Context* ctx, NDBT_Step* step){
NdbBackup backup(GETNDB(step)->getNodeId()+1);
NdbRestarter restarter;
if (restarter.getNumDbNodes() < 2){
ctx->stopTest();
return NDBT_OK;
}
if(restarter.waitClusterStarted(60) != 0){
g_err << "Cluster failed to start" << endl;
return NDBT_FAILED;
}
if (testMaster) {
if (testSlave) {
if (backup.FailMasterAsSlave(restarter) != NDBT_OK){
return NDBT_FAILED;
}
} else {
if (backup.FailMaster(restarter) != NDBT_OK){
return NDBT_FAILED;
}
}
} else {
if (backup.FailSlave(restarter) != NDBT_OK){
return NDBT_FAILED;
}
}
return NDBT_OK;
}
int runBackupOne(NDBT_Context* ctx, NDBT_Step* step){
NdbBackup backup(GETNDB(step)->getNodeId()+1);
unsigned backupId = 0;
if (backup.start(backupId) == -1){
return NDBT_FAILED;
}
ndbout << "Started backup " << backupId << endl;
ctx->setProperty("BackupId", backupId);
return NDBT_OK;
}
int runBackupRandom(NDBT_Context* ctx, NDBT_Step* step){
NdbBackup backup(GETNDB(step)->getNodeId()+1);
unsigned backupId = rand() % (MAX_BACKUPS);
if (backup.start(backupId) == -1){
return NDBT_FAILED;
}
ndbout << "Started backup " << backupId << endl;
ctx->setProperty("BackupId", backupId);
return NDBT_OK;
}
int
runBackupLoop(NDBT_Context* ctx, NDBT_Step* step){
NdbBackup backup(GETNDB(step)->getNodeId()+1);
int loops = ctx->getNumLoops();
while(!ctx->isTestStopped() && loops--)
{
if (backup.start() == -1)
{
sleep(1);
loops++;
}
else
{
sleep(3);
}
}
ctx->stopTest();
return NDBT_OK;
}
int
runDDL(NDBT_Context* ctx, NDBT_Step* step){
Ndb* pNdb= GETNDB(step);
NdbDictionary::Dictionary* pDict = pNdb->getDictionary();
const int tables = NDBT_Tables::getNumTables();
while(!ctx->isTestStopped())
{
const int tab_no = rand() % (tables);
NdbDictionary::Table tab = *NDBT_Tables::getTable(tab_no);
BaseString name= tab.getName();
name.appfmt("-%d", step->getStepNo());
tab.setName(name.c_str());
if(pDict->createTable(tab) == 0)
{
HugoTransactions hugoTrans(* pDict->getTable(name.c_str()));
if (hugoTrans.loadTable(pNdb, 10000) != 0){
return NDBT_FAILED;
}
while(pDict->dropTable(tab.getName()) != 0 &&
pDict->getNdbError().code != 4009)
g_err << pDict->getNdbError() << endl;
sleep(1);
}
}
return NDBT_OK;
}
int runDropTablesRestart(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter;
if (runDropTable(ctx, step) != 0)
return NDBT_FAILED;
if (restarter.restartAll(false) != 0)
return NDBT_FAILED;
if (restarter.waitClusterStarted() != 0)
return NDBT_FAILED;
return NDBT_OK;
}
int runRestoreOne(NDBT_Context* ctx, NDBT_Step* step){
NdbBackup backup(GETNDB(step)->getNodeId()+1);
unsigned backupId = ctx->getProperty("BackupId");
ndbout << "Restoring backup " << backupId << endl;
if (backup.restore(backupId) == -1){
return NDBT_FAILED;
}
Ndb* pNdb = GETNDB(step);
pNdb->getDictionary()->invalidateTable(tabname);
const NdbDictionary::Table* tab = pNdb->getDictionary()->getTable(tabname);
if (tab)
{
ctx->setTab(tab);
return NDBT_OK;
}
return NDBT_FAILED;
}
int runVerifyOne(NDBT_Context* ctx, NDBT_Step* step){
int records = ctx->getNumRecords();
Ndb* pNdb = GETNDB(step);
int result = NDBT_OK;
int count = 0;
const NdbDictionary::Table* tab = ctx->getTab();
if(tab == 0)
return NDBT_FAILED;
UtilTransactions utilTrans(* tab);
HugoTransactions hugoTrans(* tab);
do{
// Check that there are as many records as we expected
CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
g_err << "count = " << count;
g_err << " records = " << records;
g_err << endl;
CHECK(count == records);
// Read and verify every record
CHECK(hugoTrans.pkReadRecords(pNdb, records) == 0);
} while (false);
return result;
}
int runClearTable(NDBT_Context* ctx, NDBT_Step* step){
int records = ctx->getNumRecords();
UtilTransactions utilTrans(*ctx->getTab());
if (utilTrans.clearTable2(GETNDB(step), records) != 0){
return NDBT_FAILED;
}
return NDBT_OK;
}
int runDropTable(NDBT_Context* ctx, NDBT_Step* step)
{
const NdbDictionary::Table *tab = ctx->getTab();
GETNDB(step)->getDictionary()->dropTable(tab->getName());
return NDBT_OK;
}
#include "bank/Bank.hpp"
int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){
Bank bank(ctx->m_cluster_connection);
bool overWriteExisting = true;
if (bank.createAndLoadBank(overWriteExisting) != NDBT_OK)
return NDBT_FAILED;
return NDBT_OK;
}
int runBankTimer(NDBT_Context* ctx, NDBT_Step* step){
Bank bank(ctx->m_cluster_connection);
int wait = 30; // Max seconds between each "day"
int yield = 1; // Loops before bank returns
while (ctx->isTestStopped() == false) {
bank.performIncreaseTime(wait, yield);
}
return NDBT_OK;
}
int runBankTransactions(NDBT_Context* ctx, NDBT_Step* step){
Bank bank(ctx->m_cluster_connection);
int wait = 10; // Max ms between each transaction
int yield = 100; // Loops before bank returns
while (ctx->isTestStopped() == false) {
bank.performTransactions(wait, yield);
}
return NDBT_OK;
}
int runBankGL(NDBT_Context* ctx, NDBT_Step* step){
Bank bank(ctx->m_cluster_connection);
int yield = 20; // Loops before bank returns
int result = NDBT_OK;
while (ctx->isTestStopped() == false) {
if (bank.performMakeGLs(yield) != NDBT_OK){
ndbout << "bank.performMakeGLs FAILED" << endl;
result = NDBT_FAILED;
}
}
return NDBT_OK;
}
int runBankSum(NDBT_Context* ctx, NDBT_Step* step){
Bank bank(ctx->m_cluster_connection);
int wait = 2000; // Max ms between each sum of accounts
int yield = 1; // Loops before bank returns
int result = NDBT_OK;
while (ctx->isTestStopped() == false) {
if (bank.performSumAccounts(wait, yield) != NDBT_OK){
ndbout << "bank.performSumAccounts FAILED" << endl;
result = NDBT_FAILED;
}
}
return result ;
}
int runDropBank(NDBT_Context* ctx, NDBT_Step* step){
Bank bank(ctx->m_cluster_connection);
if (bank.dropBank() != NDBT_OK)
return NDBT_FAILED;
return NDBT_OK;
}
int runBackupBank(NDBT_Context* ctx, NDBT_Step* step){
int loops = ctx->getNumLoops();
int l = 0;
int maxSleep = 30; // Max seconds between each backup
Ndb* pNdb = GETNDB(step);
NdbBackup backup(GETNDB(step)->getNodeId()+1);
unsigned minBackupId = ~0;
unsigned maxBackupId = 0;
unsigned backupId = 0;
int result = NDBT_OK;
while (l < loops && result != NDBT_FAILED){
if (pNdb->waitUntilReady() != 0){
result = NDBT_FAILED;
continue;
}
// Sleep for a while
NdbSleep_SecSleep(maxSleep);
// Perform backup
if (backup.start(backupId) != 0){
ndbout << "backup.start failed" << endl;
result = NDBT_FAILED;
continue;
}
ndbout << "Started backup " << backupId << endl;
// Remember min and max backupid
if (backupId < minBackupId)
minBackupId = backupId;
if (backupId > maxBackupId)
maxBackupId = backupId;
ndbout << " maxBackupId = " << maxBackupId
<< ", minBackupId = " << minBackupId << endl;
ctx->setProperty("MinBackupId", minBackupId);
ctx->setProperty("MaxBackupId", maxBackupId);
l++;
}
ctx->stopTest();
return result;
}
int runRestoreBankAndVerify(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter;
NdbBackup backup(GETNDB(step)->getNodeId()+1);
unsigned minBackupId = ctx->getProperty("MinBackupId");
unsigned maxBackupId = ctx->getProperty("MaxBackupId");
unsigned backupId = minBackupId;
int result = NDBT_OK;
int errSumAccounts = 0;
int errValidateGL = 0;
ndbout << " maxBackupId = " << maxBackupId << endl;
ndbout << " minBackupId = " << minBackupId << endl;
while (backupId <= maxBackupId){
// TEMPORARY FIX
// To erase all tables from cache(s)
// To be removed, maybe replaced by ndb.invalidate();
{
Bank bank(ctx->m_cluster_connection);
if (bank.dropBank() != NDBT_OK){
result = NDBT_FAILED;
break;
}
}
// END TEMPORARY FIX
ndbout << "Performing restart" << endl;
if (restarter.restartAll(false) != 0)
return NDBT_FAILED;
if (restarter.waitClusterStarted() != 0)
return NDBT_FAILED;
ndbout << "Dropping " << tabname << endl;
NdbDictionary::Dictionary* pDict = GETNDB(step)->getDictionary();
pDict->dropTable(tabname);
ndbout << "Restoring backup " << backupId << endl;
if (backup.restore(backupId) == -1){
return NDBT_FAILED;
}
ndbout << "Backup " << backupId << " restored" << endl;
// Let bank verify
Bank bank(ctx->m_cluster_connection);
int wait = 0;
int yield = 1;
if (bank.performSumAccounts(wait, yield) != 0){
ndbout << "bank.performSumAccounts FAILED" << endl;
ndbout << " backupId = " << backupId << endl << endl;
result = NDBT_FAILED;
errSumAccounts++;
}
if (bank.performValidateAllGLs() != 0){
ndbout << "bank.performValidateAllGLs FAILED" << endl;
ndbout << " backupId = " << backupId << endl << endl;
result = NDBT_FAILED;
errValidateGL++;
}
backupId++;
}
if (result != NDBT_OK){
ndbout << "Verification of backup failed" << endl
<< " errValidateGL="<<errValidateGL<<endl
<< " errSumAccounts="<<errSumAccounts<<endl << endl;
}
return result;
}
int runBackupUndoWaitStarted(NDBT_Context* ctx, NDBT_Step* step){
NdbBackup backup(GETNDB(step)->getNodeId()+1);
unsigned backupId = 0;
int undoError = 10041;
NdbRestarter restarter;
if(restarter.waitClusterStarted(60)){
g_err << "waitClusterStarted failed"<< endl;
return NDBT_FAILED;
}
if (restarter.insertErrorInAllNodes(undoError) != 0) {
g_err << "Error insert failed" << endl;
return NDBT_FAILED;
}
// start backup wait started
if (backup.start(backupId, 1, 0, 1) == -1){
return NDBT_FAILED;
}
ndbout << "Started backup " << backupId << endl;
ctx->setProperty("BackupId", backupId);
return NDBT_OK;
}
int runChangeUndoDataDuringBackup(NDBT_Context* ctx, NDBT_Step* step){
Ndb* pNdb= GETNDB(step);
int records = ctx->getNumRecords();
int num = 5;
if (records - 5 < 0)
num = 1;
HugoTransactions hugoTrans(*ctx->getTab());
//update all rows
if(hugoTrans.pkUpdateRecords(pNdb, records) != 0) {
g_err << "Can't update all the records" << endl;
return NDBT_FAILED;
}
//delete first 10 rows
if(hugoTrans.pkDelRecords(pNdb, num*2) != 0) {
g_err << "Can't delete first 5 rows" << endl;
return NDBT_FAILED;
}
//add 5 new rows at the first(0 ~ 4)
NdbTransaction *pTransaction= pNdb->startTransaction();
if (pTransaction == NULL) {
g_err << "Can't get transaction pointer" << endl;
return NDBT_FAILED;
}
if(hugoTrans.setTransaction(pTransaction) != 0) {
g_err << "Set transaction error" << endl;
pNdb->closeTransaction(pTransaction);
return NDBT_FAILED;
}
if(hugoTrans.pkInsertRecord(pNdb, 0, num, 2) != 0) {
g_err << "pkInsertRecord error" << endl;
pNdb->closeTransaction(pTransaction);
return NDBT_FAILED;
}
if(pTransaction->execute(Commit ) != 0) {
g_err << "Can't commit transaction delete" << endl;
return NDBT_FAILED;
}
hugoTrans.closeTransaction(pNdb);
// make sure backup have finish
NdbBackup backup(GETNDB(step)->getNodeId()+1);
// start log event
if(backup.startLogEvent() != 0) {
g_err << "Can't create log event" << endl;
return NDBT_FAILED;
}
NdbSleep_SecSleep(15);
int i = 0;
while (1) {
if (backup.checkBackupStatus() == 2) //complete
break;
else if (i == 15) {
g_err << "Backup timeout" << endl;
return NDBT_FAILED;
} else
NdbSleep_SecSleep(2);
i++;
}
return NDBT_OK;
}
int runVerifyUndoData(NDBT_Context* ctx, NDBT_Step* step){
int records = ctx->getNumRecords();
Ndb* pNdb = GETNDB(step);
int count = 0;
int num = 5;
if (records - 5 < 0)
num = 1;
const NdbDictionary::Table* tab =
GETNDB(step)->getDictionary()->getTable(ctx->getTab()->getName());
if(tab == 0) {
g_err << " Can't find table" << endl;
return NDBT_FAILED;
}
UtilTransactions utilTrans(* tab);
HugoTransactions hugoTrans(* tab);
// Check that there are as many records as we expected
if(utilTrans.selectCount(pNdb, 64, &count) != 0) {
g_err << "Can't get records count" << endl;
return NDBT_FAILED;
}
g_err << "count = " << count;
g_err << " records = " << records;
g_err << endl;
if (count != records) {
g_err << "The records count is not correct" << endl;
return NDBT_FAILED;
}
// make sure all the update data is there
NdbTransaction *pTransaction= pNdb->startTransaction();
if (pTransaction == NULL) {
g_err << "Can't get transaction pointer" << endl;
return NDBT_FAILED;
}
if(hugoTrans.setTransaction(pTransaction) != 0) {
g_err << "Set transaction error" << endl;
pNdb->closeTransaction(pTransaction);
return NDBT_FAILED;
}
if(hugoTrans.pkReadRecord(pNdb, 0, records, NdbOperation::LM_Read) != 0) {
g_err << "Can't read record" << endl;
return NDBT_FAILED;
}
if(hugoTrans.verifyUpdatesValue(0, records) != 0) {
g_err << "The records restored with undo log is not correct" << endl;
return NDBT_FAILED;
}
hugoTrans.closeTransaction(pNdb);
return NDBT_OK;
}
int
runBug57650(NDBT_Context* ctx, NDBT_Step* step)
{
NdbBackup backup(GETNDB(step)->getNodeId()+1);
NdbRestarter res;
int node0 = res.getNode(NdbRestarter::NS_RANDOM);
res.insertErrorInNode(node0, 5057);
unsigned backupId = 0;
if (backup.start(backupId) == -1)
return NDBT_FAILED;
return NDBT_OK;
}
NDBT_TESTSUITE(testBackup);
TESTCASE("BackupOne",
"Test that backup and restore works on one table \n"
"1. Load table\n"
"2. Backup\n"
"3. Drop tables and restart \n"
"4. Restore\n"
"5. Verify count and content of table\n"){
INITIALIZER(clearOldBackups);
INITIALIZER(runLoadTable);
INITIALIZER(runBackupOne);
INITIALIZER(runDropTablesRestart);
INITIALIZER(runRestoreOne);
VERIFIER(runVerifyOne);
FINALIZER(runClearTable);
}
TESTCASE("BackupRandom",
"Test that backup n and restore works on one table \n"
"1. Load table\n"
"2. Backup\n"
"3. Drop tables and restart \n"
"4. Restore\n"
"5. Verify count and content of table\n"){
INITIALIZER(clearOldBackups);
INITIALIZER(runLoadTable);
INITIALIZER(runBackupRandom);
INITIALIZER(runDropTablesRestart);
INITIALIZER(runRestoreOne);
VERIFIER(runVerifyOne);
FINALIZER(runClearTable);
}
TESTCASE("BackupDDL",
"Test that backup and restore works on with DDL ongoing\n"
"1. Backups and DDL (create,drop,table.index)"){
INITIALIZER(clearOldBackups);
INITIALIZER(runLoadTable);
STEP(runBackupLoop);
STEP(runDDL);
STEP(runDDL);
FINALIZER(runClearTable);
}
TESTCASE("BackupBank",
"Test that backup and restore works during transaction load\n"
" by backing up the bank"
"1. Create bank\n"
"2a. Start bank and let it run\n"
"2b. Perform loop number of backups of the bank\n"
" when backups are finished tell bank to close\n"
"3. Restart ndb -i and reload each backup\n"
" let bank verify that the backup is consistent\n"
"4. Drop bank\n"){
INITIALIZER(clearOldBackups);
INITIALIZER(runCreateBank);
STEP(runBankTimer);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankGL);
// TODO STEP(runBankSum);
STEP(runBackupBank);
VERIFIER(runRestoreBankAndVerify);
FINALIZER(runDropBank);
}
TESTCASE("BackupUndoLog",
"Test for backup happen at start time\n"
"1. Load table\n"
"2. Start backup with wait started\n"
"3. Insert, delete, update data during backup\n"
"4. Drop tables and restart \n"
"5. Restore\n"
"6. Verify records of table\n"
"7. Clear tables\n"){
INITIALIZER(runLoadTable);
INITIALIZER(runBackupUndoWaitStarted);
INITIALIZER(runChangeUndoDataDuringBackup);
INITIALIZER(runDropTablesRestart);
INITIALIZER(runRestoreOne);
VERIFIER(runVerifyUndoData);
FINALIZER(runClearTable);
}
TESTCASE("NFMaster",
"Test that backup behaves during node failiure\n"){
INITIALIZER(clearOldBackups);
INITIALIZER(setMaster);
STEP(runAbort);
}
TESTCASE("NFMasterAsSlave",
"Test that backup behaves during node failiure\n"){
INITIALIZER(clearOldBackups);
INITIALIZER(setMasterAsSlave);
STEP(runAbort);
}
TESTCASE("NFSlave",
"Test that backup behaves during node failiure\n"){
INITIALIZER(clearOldBackups);
INITIALIZER(setSlave);
STEP(runAbort);
}
TESTCASE("FailMaster",
"Test that backup behaves during node failiure\n"){
INITIALIZER(clearOldBackups);
INITIALIZER(setMaster);
STEP(runFail);
}
TESTCASE("FailMasterAsSlave",
"Test that backup behaves during node failiure\n"){
INITIALIZER(clearOldBackups);
INITIALIZER(setMasterAsSlave);
STEP(runFail);
}
TESTCASE("FailSlave",
"Test that backup behaves during node failiure\n"){
INITIALIZER(clearOldBackups);
INITIALIZER(setSlave);
STEP(runFail);
}
TESTCASE("Bug57650", "")
{
INITIALIZER(runBug57650);
}
NDBT_TESTSUITE_END(testBackup);
int main(int argc, const char** argv){
ndb_init();
NDBT_TESTSUITE_INSTANCE(testBackup);
return testBackup.execute(argc, argv);
}