19 #include <NDBT_Test.hpp>
20 #include <HugoTransactions.hpp>
21 #include <UtilTransactions.hpp>
22 #include <NdbRestarter.hpp>
23 #include <NdbRestarts.hpp>
25 #include <signaldata/DumpStateOrd.hpp>
26 #include <Bitmask.hpp>
27 #include <RefConvert.hpp>
32 int records = ctx->getNumRecords();
34 if (hugoTrans.loadTable(GETNDB(step), records) != 0){
43 if (hugoTrans.fillTable(GETNDB(step)) != 0){
51 int records = ctx->getNumRecords();
54 while (ctx->isTestStopped() ==
false) {
56 if (hugoTrans.loadTable(GETNDB(step), records) != 0){
65 int records = ctx->getNumRecords();
68 if (utilTrans.clearTable(GETNDB(step), records) != 0){
75 int records = ctx->getNumRecords();
79 while (ctx->isTestStopped() ==
false) {
81 if (utilTrans.clearTable(GETNDB(step), records) != 0){
91 int records = ctx->getNumRecords();
94 while (ctx->isTestStopped() ==
false) {
96 if (hugoTrans.scanReadRecords(GETNDB(step), records) != 0){
105 int result = NDBT_OK;
106 int records = ctx->getNumRecords();
112 while (ctx->isTestStopped() ==
false) {
114 int rows = (rand()%records)+1;
115 int batch = (rand()%rows)+1;
116 if (hugoTrans.pkReadRecords(GETNDB(step), rows, batch, lm) != 0){
125 int result = NDBT_OK;
126 int records = ctx->getNumRecords();
127 int multiop = ctx->getProperty(
"MULTI_OP", 1);
128 Ndb* pNdb = GETNDB(step);
132 while (ctx->isTestStopped() ==
false)
135 int batch = (rand()%records)+1;
136 int row = rand() % records;
141 if(row + batch > records)
142 batch = records - row;
144 if(hugoOps.startTransaction(pNdb) != 0)
147 if(hugoOps.pkUpdateRecord(pNdb, row, batch, rand()) != 0)
150 for (
int j = 1; j<multiop; j++)
152 if(hugoOps.execute_NoCommit(pNdb) != 0)
155 if(hugoOps.pkUpdateRecord(pNdb, row, batch, rand()) != 0)
159 if(hugoOps.execute_Commit(pNdb) != 0)
162 hugoOps.closeTransaction(pNdb);
171 hugoOps.closeTransaction(pNdb);
173 NdbSleep_MilliSleep(50);
185 int records = ctx->getNumRecords();
186 Ndb* pNdb = GETNDB(step);
189 while (ctx->isTestStopped() ==
false) {
190 g_info << i++ <<
": ";
191 int rows = (rand()%records)+1;
192 int batch = (rand()%rows)+1;
193 int row = (records - rows) ? rand() % (records - rows) : 0;
196 for(j = 0; j<rows; j += batch)
202 if(hugoOps.startTransaction(pNdb) != 0)
208 if(hugoOps.execute_NoCommit(pNdb) != 0)
211 if(hugoOps.pkUpdateRecord(pNdb, row+j, k, rand()) != 0)
214 if(hugoOps.execute_Commit(pNdb) != 0)
217 if(hugoOps.closeTransaction(pNdb) != 0)
227 hugoOps.closeTransaction(pNdb);
229 NdbSleep_MilliSleep(50);
239 int records = ctx->getNumRecords();
240 Ndb* pNdb = GETNDB(step);
243 while (ctx->isTestStopped() ==
false) {
244 g_info << i++ <<
": ";
245 int rows = (rand()%records)+1;
246 int batch = (rand()%rows)+1;
247 int row = (records - rows) ? rand() % (records - rows) : 0;
250 for(j = 0; j<rows; j += batch)
258 if(hugoOps.startTransaction(pNdb) != 0)
264 if(hugoOps.execute_NoCommit(pNdb) != 0)
267 if(hugoOps.pkUpdateRecord(pNdb, row+j, k, rand()) != 0)
270 if(hugoOps.execute_NoCommit(pNdb) != 0)
273 if(hugoOps.pkUnlockRecord(pNdb, lockHandles) != 0)
276 if(hugoOps.execute_Commit(pNdb) != 0)
279 if(hugoOps.closeTransaction(pNdb) != 0)
289 hugoOps.closeTransaction(pNdb);
291 NdbSleep_MilliSleep(50);
300 int result = NDBT_OK;
301 int records = ctx->getNumRecords();
305 while (ctx->isTestStopped() ==
false)
308 if (utilTrans.clearTable(GETNDB(step), records) != 0){
309 result = NDBT_FAILED;
312 if (hugoTrans.loadTable(GETNDB(step), records, 1) != 0){
313 result = NDBT_FAILED;
323 int result = NDBT_OK;
324 int records = ctx->getNumRecords();
325 int parallelism = ctx->getProperty(
"Parallelism", 1);
326 int abort = ctx->getProperty(
"AbortProb", (Uint32)0);
327 int check = ctx->getProperty(
"ScanUpdateNoRowCountCheck", (Uint32)0);
334 while (ctx->isTestStopped() ==
false) {
336 if (hugoTrans.scanUpdateRecords(GETNDB(step), records, abort,
337 parallelism) == NDBT_FAILED){
346 int records = ctx->getNumRecords();
349 if (hugoTrans.scanReadRecords(GETNDB(step), records, 0, 64) != 0){
356 int result = NDBT_OK;
357 int loops = ctx->getNumLoops();
358 int sync_threads = ctx->getProperty(
"SyncThreads", (
unsigned)0);
359 int sleep0 = ctx->getProperty(
"Sleep0", (
unsigned)0);
360 int sleep1 = ctx->getProperty(
"Sleep1", (
unsigned)0);
361 int randnode = ctx->getProperty(
"RandNode", (
unsigned)0);
366 if (restarter.getNumDbNodes() < 2){
371 if(restarter.waitClusterStarted() != 0){
372 g_err <<
"Cluster failed to start" << endl;
376 loops *= (restarter.getNumDbNodes() > 2 ? 2 : restarter.getNumDbNodes());
377 if (loops < restarter.getNumDbNodes())
378 loops = restarter.getNumDbNodes();
380 while(i<loops && result != NDBT_FAILED && !ctx->isTestStopped()){
382 int id = lastId % restarter.getNumDbNodes();
385 id = rand() % restarter.getNumDbNodes();
387 int nodeId = restarter.getDbNodeId(
id);
388 ndbout <<
"Restart node " << nodeId << endl;
389 if(restarter.restartOneDbNode(nodeId,
false,
true,
true) != 0){
390 g_err <<
"Failed to restartNextDbNode" << endl;
391 result = NDBT_FAILED;
395 if (restarter.waitNodesNoStart(&nodeId, 1))
397 g_err <<
"Failed to waitNodesNoStart" << endl;
398 result = NDBT_FAILED;
403 NdbSleep_MilliSleep(sleep1);
405 if (restarter.startNodes(&nodeId, 1))
407 g_err <<
"Failed to start node" << endl;
408 result = NDBT_FAILED;
412 if(restarter.waitClusterStarted() != 0){
413 g_err <<
"Cluster failed to start" << endl;
414 result = NDBT_FAILED;
419 NdbSleep_MilliSleep(sleep0);
421 ctx->sync_up_and_wait(
"PauseThreads", sync_threads);
435 if(restarter.waitClusterStarted(1) != 0){
436 g_err <<
"All nodes was not started " << endl;
446 int result = NDBT_OK;
447 int loops = ctx->getNumLoops();
453 while(i<loops && result != NDBT_FAILED && !ctx->isTestStopped()){
455 if(restarts.executeRestart(ctx, pCase->getName(), timeout) != 0){
456 g_err <<
"Failed to executeRestart(" <<pCase->getName() <<
")" << endl;
457 result = NDBT_FAILED;
467 int result = NDBT_OK;
468 int loops = ctx->getNumLoops();
469 int records = ctx->getNumRecords();
472 Ndb* pNdb = GETNDB(step);
475 while(i<loops && result != NDBT_FAILED && !ctx->isTestStopped()){
478 int id = i % restarter.getNumDbNodes();
479 int nodeId = restarter.getDbNodeId(
id);
480 ndbout <<
"Restart node " << nodeId << endl;
481 restarter.insertErrorInNode(nodeId, 5041);
482 restarter.insertErrorInAllNodes(8048 + (i & 1));
484 for(
int j = 0; j<records; j++){
485 if(hugoOps.startTransaction(pNdb) != 0)
492 if((res = hugoOps.execute_Commit(pNdb)) == 4119)
498 if(hugoOps.closeTransaction(pNdb) != 0)
502 if(hugoOps.closeTransaction(pNdb) != 0)
506 restarter.waitClusterStarted(60) ;
510 hugoOps.closeTransaction(pNdb);
516 int result = NDBT_OK;
517 int loops = ctx->getNumLoops();
520 Ndb* pNdb = GETNDB(step);
523 while(i<loops && result != NDBT_FAILED && !ctx->isTestStopped()){
526 if(hugoOps.startTransaction(pNdb) != 0)
529 if(hugoOps.pkUpdateRecord(pNdb, 1, 128) != 0)
532 if(hugoOps.execute_NoCommit(pNdb) != 0)
535 Uint32 transNode= hugoOps.getTransaction()->getConnectedNodeId();
536 int id = i % restarter.getNumDbNodes();
538 while((nodeId = restarter.getDbNodeId(
id)) == (
int)transNode)
539 id = (
id + 1) % restarter.getNumDbNodes();
541 ndbout <<
"Restart node " << nodeId << endl;
543 restarter.restartOneDbNode(nodeId,
false,
true,
true);
548 restarter.waitNodesNoStart(&nodeId, 1);
552 res= hugoOps.execute_Commit(pNdb);
554 res= hugoOps.execute_Rollback(pNdb);
556 ndbout_c(
"res= %d", res);
558 hugoOps.closeTransaction(pNdb);
560 restarter.startNodes(&nodeId, 1);
561 restarter.waitNodesStarted(&nodeId, 1);
584 int dump[2] = { DumpStateOrd::LqhErrorInsert5042, 0 };
587 int nodeId = restarter.getDbNodeId(1);
589 ndbout <<
"Restart node " << nodeId << endl;
591 if (restarter.restartOneDbNode(nodeId,
false,
true,
true))
597 if (restarter.waitNodesNoStart(&nodeId, 1))
600 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
602 if (restarter.dumpStateOneNode(nodeId, val2, 2))
605 if (restarter.dumpStateOneNode(nodeId, dump, 2))
608 if (restarter.startNodes(&nodeId, 1))
611 restarter.waitNodesStartPhase(&nodeId, 1, 3);
613 if (restarter.waitNodesNoStart(&nodeId, 1))
616 if (restarter.dumpStateOneNode(nodeId, val2, 1))
619 if (restarter.startNodes(&nodeId, 1))
622 if (restarter.waitNodesStarted(&nodeId, 1))
633 int nodeId = restarter.getDbNodeId(1);
635 ndbout <<
"Restart node " << nodeId << endl;
637 if (restarter.restartOneDbNode(nodeId,
false,
true,
true))
643 if (restarter.waitNodesNoStart(&nodeId, 1))
646 if (restarter.insertErrorInNode(nodeId, 7165))
649 if (restarter.startNodes(&nodeId, 1))
652 if (restarter.waitNodesStarted(&nodeId, 1))
655 if (restarter.restartOneDbNode(nodeId,
false,
true,
true))
661 if (restarter.waitNodesNoStart(&nodeId, 1))
664 if (restarter.insertErrorInNode(nodeId, 7171))
667 if (restarter.startNodes(&nodeId, 1))
670 if (restarter.waitNodesStarted(&nodeId, 1))
679 Ndb* pNdb = GETNDB(step);
684 if (hugoTrans.loadTable(GETNDB(step), 10) != 0){
688 if(hugoOps.startTransaction(pNdb) != 0)
691 if(hugoOps.pkUpdateRecord(pNdb, 0, 1, rand()) != 0)
694 if(hugoOps.execute_NoCommit(pNdb) != 0)
697 if (restarter.insertErrorInAllNodes(5100))
700 hugoOps.execute_Rollback(pNdb);
702 if (restarter.waitClusterStarted() != 0)
705 if (restarter.insertErrorInAllNodes(0))
720 if (restarter.getNumDbNodes() < 2)
726 int aliveNodeId = restarter.getRandomNotMasterNodeId(rand());
727 int deadNodeId = aliveNodeId;
728 while (deadNodeId == aliveNodeId)
729 deadNodeId = restarter.getDbNodeId(rand() % restarter.getNumDbNodes());
731 if (restarter.insertErrorInNode(aliveNodeId, 930))
734 if (restarter.restartOneDbNode(deadNodeId,
false,
true,
true))
740 if (restarter.waitNodesNoStart(&deadNodeId, 1))
743 if (restarter.startNodes(&deadNodeId, 1))
747 int ret = restarter.waitNodesStartPhase(&deadNodeId, 1, 3, 10);
751 int dump[] = { 7020, 323, 252, 0 };
752 dump[3] = deadNodeId;
753 if (restarter.dumpStateOneNode(aliveNodeId, dump, 4))
756 if (restarter.waitNodesStarted(&deadNodeId, 1))
759 return ret ? NDBT_OK : NDBT_FAILED;
766 if (restarter.getNumDbNodes() < 2)
772 Ndb* pNdb = GETNDB(step);
778 if(hugoOps.startTransaction(pNdb) != 0)
781 if(hugoOps.pkUpdateRecord(pNdb, 0, 128, rand()) != 0)
784 if(hugoOps.execute_NoCommit(pNdb) != 0)
788 int node2 = restarter.getRandomNodeSameNodeGroup(node1, rand());
790 if (node1 == -1 || node2 == -1)
795 if (restarter.insertErrorInNode(node1, 8080))
799 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
800 if (restarter.dumpStateOneNode(node2, val2, 2))
803 if (restarter.insertErrorInNode(node2, 5003))
805 hugoOps.execute_Rollback(pNdb);
808 if (restarter.waitNodesNoStart(&node2, 1) != 0)
811 if (restarter.insertErrorInAllNodes(0))
814 if (restarter.startNodes(&node2, 1) != 0)
817 if (restarter.waitClusterStarted() != 0)
820 if (hugoTrans.scanUpdateRecords(pNdb, 128) != 0)
823 hugoOps.closeTransaction(pNdb);
830 hugoOps.closeTransaction(pNdb);
839 if (restarter.getNumDbNodes() < 2)
845 Uint32 cnt = restarter.getNumDbNodes();
847 for(
int loop = 0; loop < ctx->getNumLoops(); loop++)
851 memset(partition0, 0,
sizeof(partition0));
852 memset(partition1, 0,
sizeof(partition1));
855 Uint32 node1 = restarter.getDbNodeId(rand()%cnt);
856 for (Uint32 i = 0; i<cnt/2; i++)
859 int tmp = restarter.getRandomNodeOtherNodeGroup(node1, rand());
866 }
while(nodesmask.
get(node1));
868 partition0[
i] = node1;
869 partition1[
i] = restarter.getRandomNodeSameNodeGroup(node1, rand());
871 ndbout_c(
"nodes %d %d", node1, partition1[i]);
873 assert(!nodesmask.
get(node1));
874 assert(!nodesmask.
get(partition1[i]));
875 nodesmask.
set(node1);
876 nodesmask.
set(partition1[i]);
882 dump[0] = DumpStateOrd::NdbcntrStopNodes;
883 memcpy(dump + 1, partition0,
sizeof(
int)*cnt/2);
885 Uint32 master = restarter.getMasterNodeId();
887 if (restarter.dumpStateOneNode(master, dump, 1+cnt/2))
890 if (restarter.waitNodesNoStart(partition0, cnt/2))
893 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
895 if (restarter.dumpStateAllNodes(val2, 2))
898 if (restarter.insertErrorInAllNodes(932))
902 memcpy(dump + 1, partition0,
sizeof(
int)*cnt/2);
903 for (Uint32 i = 0; i<cnt/2; i++)
904 if (restarter.dumpStateOneNode(partition1[i], dump, 1+cnt/2))
908 memcpy(dump + 1, partition1,
sizeof(
int)*cnt/2);
909 for (Uint32 i = 0; i<cnt/2; i++)
910 if (restarter.dumpStateOneNode(partition0[i], dump, 1+cnt/2))
913 if (restarter.startNodes(partition0, cnt/2))
916 if (restarter.waitNodesStartPhase(partition0, cnt/2, 2))
920 for (Uint32 i = 0; i<cnt/2; i++)
921 if (restarter.dumpStateAllNodes(dump, 2))
924 if (restarter.waitNodesNoStart(partition0, cnt/2))
927 for (Uint32 i = 0; i<cnt/2; i++)
928 if (restarter.restartOneDbNode(partition0[i],
true,
true,
true))
931 if (restarter.waitNodesNoStart(partition0, cnt/2))
934 if (restarter.startAll())
937 if (restarter.waitClusterStarted())
948 if (restarter.getNumDbNodes() < 2)
954 Uint32 cnt = restarter.getNumDbNodes();
956 for(
int loop = 0; loop < ctx->getNumLoops(); loop++)
960 memset(partition0, 0,
sizeof(partition0));
961 memset(partition1, 0,
sizeof(partition1));
964 Uint32 node1 = restarter.getDbNodeId(rand()%cnt);
965 for (Uint32 i = 0; i<cnt/2; i++)
968 int tmp = restarter.getRandomNodeOtherNodeGroup(node1, rand());
972 }
while(nodesmask.
get(node1));
974 partition0[
i] = node1;
975 partition1[
i] = restarter.getRandomNodeSameNodeGroup(node1, rand());
977 ndbout_c(
"nodes %d %d", node1, partition1[i]);
979 assert(!nodesmask.
get(node1));
980 assert(!nodesmask.
get(partition1[i]));
981 nodesmask.
set(node1);
982 nodesmask.
set(partition1[i]);
987 if (restarter.restartAll(
false,
true,
false))
992 memcpy(dump + 1, partition0,
sizeof(
int)*cnt/2);
993 for (Uint32 i = 0; i<cnt/2; i++)
994 if (restarter.dumpStateOneNode(partition1[i], dump, 1+cnt/2))
998 memcpy(dump + 1, partition1,
sizeof(
int)*cnt/2);
999 for (Uint32 i = 0; i<cnt/2; i++)
1000 if (restarter.dumpStateOneNode(partition0[i], dump, 1+cnt/2))
1003 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
1005 if (restarter.dumpStateAllNodes(val2, 2))
1008 if (restarter.insertErrorInAllNodes(932))
1011 if (restarter.startAll())
1014 if (restarter.waitClusterStartPhase(2))
1018 for (Uint32 i = 0; i<cnt/2; i++)
1019 if (restarter.dumpStateAllNodes(dump, 2))
1022 if (restarter.waitClusterNoStart(30))
1023 if (restarter.waitNodesNoStart(partition0, cnt/2, 10))
1024 if (restarter.waitNodesNoStart(partition1, cnt/2, 10))
1027 if (restarter.startAll())
1030 if (restarter.waitClusterStarted())
1040 Ndb* pNdb = GETNDB(step);
1042 const int masterNode = restarter.getMasterNodeId();
1044 int dump[] = { 7090, 20 } ;
1045 if (restarter.dumpStateAllNodes(dump, 2))
1048 NdbSleep_MilliSleep(3000);
1050 for (
int i = 0; i<restarter.getNumDbNodes(); i++)
1051 nodes.push_back(restarter.getDbNodeId(i));
1054 if(hugoOps.startTransaction(pNdb) != 0)
1057 if(hugoOps.pkUpdateRecord(pNdb, 1, 1) != 0)
1060 if (hugoOps.execute_NoCommit(pNdb) != 0)
1063 const int node = hugoOps.getTransaction()->getConnectedNodeId();
1064 if (node != masterNode)
1066 hugoOps.closeTransaction(pNdb);
1072 nodeId = restarter.getDbNodeId(rand() % restarter.getNumDbNodes());
1073 }
while (nodeId == node);
1075 ndbout_c(
"7031 to %d", nodeId);
1076 if (restarter.insertErrorInNode(nodeId, 7031))
1079 for (Uint32 i = 0; i<nodes.size(); i++)
1081 if (nodes[i] != nodeId)
1082 if (restarter.insertErrorInNode(nodes[i], 7030))
1086 NdbSleep_MilliSleep(500);
1088 if (hugoOps.execute_Commit(pNdb) == 0)
1091 NdbSleep_MilliSleep(3000);
1093 restarter.waitClusterStarted();
1095 if (restarter.dumpStateAllNodes(dump, 1))
1103 int loops = ctx->getNumLoops();
1105 Ndb* pNdb = GETNDB(step);
1109 int dump[] = { 9002, 0 } ;
1110 Uint32 ownNode = refToNode(pNdb->getReference());
1113 for (; loops; loops --)
1115 int nodeId = restarter.getRandomNotMasterNodeId(rand());
1116 restarter.restartOneDbNode(nodeId,
false,
true,
true);
1117 restarter.waitNodesNoStart(&nodeId, 1);
1119 if (restarter.dumpStateOneNode(nodeId, dump, 2))
1122 restarter.startNodes(&nodeId, 1);
1125 for (Uint32 i = 0; i < 100; i++)
1129 }
while (restarter.waitClusterStarted(5) != 0);
1138 int loops = ctx->getNumLoops();
1140 Ndb* pNdb = GETNDB(step);
1144 if (restarter.getNumDbNodes() < 4)
1147 int dump0[] = { 9000, 0 } ;
1148 int dump1[] = { 9001, 0 } ;
1149 Uint32 ownNode = refToNode(pNdb->getReference());
1152 for (; loops; loops --)
1154 int node0 = restarter.getDbNodeId(rand() % restarter.getNumDbNodes());
1155 int node1 = restarter.getRandomNodeOtherNodeGroup(node0, rand());
1157 restarter.restartOneDbNode(node0,
false,
true,
true);
1158 restarter.waitNodesNoStart(&node0, 1);
1159 restarter.startNodes(&node0, 1);
1160 restarter.waitClusterStarted();
1162 restarter.restartOneDbNode(node1,
false,
true,
true);
1163 restarter.waitNodesNoStart(&node1, 1);
1164 if (restarter.dumpStateOneNode(node1, dump0, 2))
1167 restarter.startNodes(&node1, 1);
1171 for (Uint32 i = 0; i < 100; i++)
1175 }
while (restarter.waitClusterStarted(5) != 0);
1177 if (restarter.dumpStateOneNode(node1, dump1, 1))
1187 int loops = ctx->getNumLoops();
1189 if (restarter.getNumDbNodes() < 4)
1192 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
1194 for (; loops; loops --)
1196 int master = restarter.getMasterNodeId();
1197 int victim = restarter.getRandomNodeOtherNodeGroup(master, rand());
1198 int second = restarter.getRandomNodeSameNodeGroup(victim, rand());
1200 int dump[] = { 935, victim } ;
1201 if (restarter.dumpStateOneNode(master, dump, 2))
1204 if (restarter.dumpStateOneNode(master, val2, 2))
1207 if (restarter.restartOneDbNode(second,
false,
true,
true))
1210 int nodes[2] = { master, second };
1211 if (restarter.waitNodesNoStart(nodes, 2))
1214 restarter.startNodes(nodes, 2);
1216 if (restarter.waitNodesStarted(nodes, 2))
1229 const int masterNode = restarter.getMasterNodeId();
1230 const int nodeId = restarter.getRandomNodeSameNodeGroup(masterNode, rand());
1232 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
1233 if (restarter.dumpStateOneNode(nodeId, val2, 2))
1236 Uint32 tableId = ctx->getTab()->
getTableId();
1237 int dump[] = { DumpStateOrd::LqhErrorInsert5042, 0, 5044 };
1240 if (restarter.dumpStateOneNode(nodeId, dump, 3))
1243 restarter.waitNodesNoStart(&nodeId, 1);
1246 restarter.startNodes(&nodeId, 1);
1248 if (restarter.waitClusterStarted() != 0)
1259 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
1260 if (restarter.dumpStateAllNodes(val2, 2))
1264 nodes[0] = restarter.getMasterNodeId();
1265 restarter.insertErrorInNode(nodes[0], 934);
1267 nodes[1] = restarter.getRandomNodeOtherNodeGroup(nodes[0], rand());
1270 nodes[1] = restarter.getRandomNodeSameNodeGroup(nodes[0], rand());
1273 restarter.restartOneDbNode(nodes[1],
false,
true,
true);
1274 if (restarter.waitNodesNoStart(nodes, 2))
1277 restarter.startNodes(nodes, 2);
1278 if (restarter.waitNodesStarted(nodes, 2))
1287 int loops = ctx->getNumLoops();
1290 for (
int i = 0; i<loops; i++)
1292 int master = restarter.getMasterNodeId();
1297 node2 = restarter.getRandomNodeSameNodeGroup(master, rand());
1300 node1 = restarter.getRandomNodeSameNodeGroup(master, rand());
1306 node1 = restarter.getRandomNodeOtherNodeGroup(master, rand());
1309 node2 = restarter.getRandomNodeSameNodeGroup(node1, rand());
1313 ndbout_c(
"node1: %d node2: %d master: %d", node1, node2, master);
1315 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
1317 if (restarter.dumpStateOneNode(node2, val2, 2))
1320 if (restarter.insertErrorInNode(node1, 7178))
1324 if (restarter.dumpStateOneNode(master, &val1, 1))
1327 if (restarter.waitNodesNoStart(&node2, 1))
1330 if (restarter.startAll())
1333 if (restarter.waitClusterStarted())
1342 int loops = ctx->getNumLoops();
1345 if (restarter.getNumDbNodes() < 4)
1348 for (
int i = 0; i<loops; i++)
1350 int master = restarter.getMasterNodeId();
1351 int node1 = restarter.getRandomNodeOtherNodeGroup(master, rand());
1352 restarter.restartOneDbNode(node1,
false,
true,
true);
1354 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
1356 if (restarter.dumpStateOneNode(master, val2, 2))
1359 if (restarter.insertErrorInNode(master, 7141))
1362 if (restarter.waitNodesNoStart(&node1, 1))
1365 if (restarter.dumpStateOneNode(node1, val2, 2))
1368 if (restarter.insertErrorInNode(node1, 932))
1371 if (restarter.startNodes(&node1, 1))
1374 int nodes[] = { master, node1 };
1375 if (restarter.waitNodesNoStart(nodes, 2))
1378 if (restarter.startNodes(nodes, 2))
1381 if (restarter.waitClusterStarted())
1391 Ndb* pNdb = GETNDB(step);
1396 if (restarter.getNumDbNodes() < 2)
1401 if (restarter.restartAll(
true,
true,
true))
1404 if (restarter.waitClusterNoStart())
1407 if (restarter.startAll())
1410 if (restarter.waitClusterStarted())
1419 trans.loadTable(pNdb, ctx->getNumRecords());
1421 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
1422 int master = restarter.getMasterNodeId();
1423 int victim = restarter.getRandomNodeOtherNodeGroup(master, rand());
1425 victim = restarter.getRandomNodeSameNodeGroup(master, rand());
1427 restarter.restartOneDbNode(victim,
false,
true,
true);
1429 for (Uint32 i = 0; i<10; i++)
1431 ndbout_c(
"Loop: %d", i);
1432 if (restarter.waitNodesNoStart(&victim, 1))
1435 if (restarter.dumpStateOneNode(victim, val2, 2))
1438 if (restarter.insertErrorInNode(victim, 7191))
1441 trans.scanUpdateRecords(pNdb, ctx->getNumRecords());
1443 if (restarter.startNodes(&victim, 1))
1446 NdbSleep_SecSleep(3);
1449 if (restarter.waitNodesNoStart(&victim, 1))
1452 if (restarter.restartAll(
false,
false,
true))
1455 if (restarter.waitClusterStarted())
1458 trans.scanUpdateRecords(pNdb, ctx->getNumRecords());
1460 restarter.restartOneDbNode(victim,
false,
true,
true);
1461 for (Uint32 i = 0; i<1; i++)
1463 ndbout_c(
"Loop: %d", i);
1464 if (restarter.waitNodesNoStart(&victim, 1))
1467 if (restarter.dumpStateOneNode(victim, val2, 2))
1470 if (restarter.insertErrorInNode(victim, 7016))
1473 trans.scanUpdateRecords(pNdb, ctx->getNumRecords());
1475 if (restarter.startNodes(&victim, 1))
1478 NdbSleep_SecSleep(3);
1481 if (restarter.waitNodesNoStart(&victim, 1))
1484 if (restarter.startNodes(&victim, 1))
1487 if (restarter.waitClusterStarted())
1497 if (res.getNumDbNodes() < 4)
1500 int loops = ctx->getNumLoops();
1504 int master = res.getMasterNodeId();
1505 int next = res.getNextMasterNodeId(master);
1507 ndbout_c(
"master: %d next: %d", master, next);
1509 if (res.getNodeGroup(master) == res.getNodeGroup(next))
1511 res.restartOneDbNode(next,
false,
false,
true);
1512 if (res.waitClusterStarted())
1517 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 2 };
1519 if (res.dumpStateOneNode(next, val2, 2))
1522 if (res.insertErrorInNode(next, 7180))
1525 res.restartOneDbNode(master,
false,
false,
true);
1526 if (res.waitClusterStarted())
1538 int node = res.getRandomNotMasterNodeId(rand());
1539 ndbout_c(
"node: %d", node);
1540 if (res.restartOneDbNode(node,
true,
true,
true))
1543 if (res.waitNodesNoStart(&node, 1))
1546 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
1547 if (res.dumpStateOneNode(node, val2, 2))
1550 if (res.insertErrorInNode(node, 7018))
1553 if (res.startNodes(&node, 1))
1556 res.waitNodesStartPhase(&node, 1, 3);
1558 if (res.waitNodesNoStart(&node, 1))
1561 res.startNodes(&node, 1);
1563 if (res.waitClusterStarted())
1573 Ndb* pNdb = GETNDB(step);
1575 int node = res.getRandomNotMasterNodeId(rand());
1577 for (
int i = 0; i<res.getNumDbNodes(); i++)
1579 if (res.getDbNodeId(i) != node)
1580 nodes.push_back(res.getDbNodeId(i));
1583 if (res.restartAll())
1586 if (res.waitClusterStarted())
1589 ndbout_c(
"node: %d", node);
1590 if (res.restartOneDbNode(node,
false,
true,
true))
1593 if (res.waitNodesNoStart(&node, 1))
1596 if (runClearTable(ctx, step))
1599 for (
int i = 0; i < 2; i++)
1601 if (res.restartAll(
false,
true, i > 0))
1604 if (res.waitClusterNoStart())
1607 if (res.startNodes(nodes.getBase(), nodes.size()))
1610 if (res.waitNodesStarted(nodes.getBase(), nodes.size()))
1614 if (res.startNodes(&node, 1))
1617 if (res.waitNodesStarted(&node, 1))
1621 if (trans.selectCount(pNdb) != 0)
1630 int loops = ctx->getNumLoops();
1633 static const int errnos[] = { 4025, 4026, 4027, 4028, 0 };
1635 int node = res.getRandomNotMasterNodeId(rand());
1636 ndbout_c(
"node: %d", node);
1637 if (res.restartOneDbNode(node,
true,
true,
true))
1641 for (
int i = 0; i<loops; i++)
1643 while (errnos[pos] != 0)
1645 ndbout_c(
"Testing err: %d", errnos[pos]);
1647 if (res.waitNodesNoStart(&node, 1))
1650 if (res.insertErrorInNode(node, 1000))
1653 if (res.insertErrorInNode(node, errnos[pos]))
1656 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 3 };
1657 if (res.dumpStateOneNode(node, val2, 2))
1660 res.startNodes(&node, 1);
1661 NdbSleep_SecSleep(3);
1667 if (res.waitNodesNoStart(&node, 1))
1670 res.startNodes(&node, 1);
1671 if (res.waitClusterStarted())
1681 int loops = ctx->getNumLoops();
1684 if (res.getNumDbNodes() < 2)
1689 static const int errnos[] = { 7181, 7182, 0 };
1692 for (Uint32 i = 0; i<(Uint32)loops; i++)
1694 while (errnos[pos] != 0)
1696 int master = res.getMasterNodeId();
1697 int next = res.getNextMasterNodeId(master);
1701 ndbout_c(
"Testing err: %d", errnos[pos]);
1702 if (res.insertErrorInNode(next, errnos[pos]))
1705 NdbSleep_SecSleep(3);
1707 if (res.waitClusterStarted())
1721 int loops = ctx->getNumLoops();
1724 if (res.getNumDbNodes() < 2)
1729 for (Uint32 i = 0; i<(Uint32)loops; i++)
1731 int node1 = res.getDbNodeId(rand() % res.getNumDbNodes());
1733 while (node1 == node2)
1735 node2 = res.getDbNodeId(rand() % res.getNumDbNodes());
1738 ndbout_c(
"nodes %u %u", node1, node2);
1740 if (res.restartOneDbNode(node1,
false,
true,
true))
1743 if (res.waitNodesNoStart(&node1, 1))
1746 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
1747 if (res.dumpStateOneNode(node1, val2, 2))
1750 if (res.insertErrorInNode(node2, 8039))
1753 res.startNodes(&node1, 1);
1754 NdbSleep_SecSleep(3);
1755 if (res.waitNodesNoStart(&node1, 1))
1757 NdbSleep_SecSleep(5);
1759 res.startNodes(&node1, 1);
1760 if (res.waitClusterStarted())
1770 int loops = ctx->getNumLoops();
1771 int records = ctx->getNumRecords();
1772 Ndb* pNdb = GETNDB(step);
1775 if (res.getNumDbNodes() < 2)
1782 if (hugoTrans.loadTable(pNdb, records) != 0){
1786 if (hugoTrans.clearTable(pNdb, records) != 0)
1791 for (Uint32 i = 0; i<(Uint32)loops; i++)
1793 int node1 = res.getDbNodeId(rand() % res.getNumDbNodes());
1795 if (res.restartOneDbNode2(node1,
1796 NdbRestarter::NRRF_ABORT |
1797 NdbRestarter::NRRF_NOSTART))
1800 if (res.waitNodesNoStart(&node1, 1))
1803 if (hugoTrans.loadTable(pNdb, records) != 0){
1807 if (hugoTrans.clearTable(pNdb, records) != 0)
1812 res.startNodes(&node1, 1);
1813 if (res.waitClusterStarted())
1816 if (hugoTrans.loadTable(pNdb, records) != 0){
1820 if (hugoTrans.scanUpdateRecords(pNdb, records) != 0)
1823 if (hugoTrans.clearTable(pNdb, records) != 0)
1838 if (res.getNumDbNodes() < 4)
1843 int master = res.getMasterNodeId();
1844 int node0 = res.getRandomNodeOtherNodeGroup(master, rand());
1845 int node1 = res.getRandomNodeSameNodeGroup(node0, rand());
1847 ndbout_c(
"master: %d node0: %d node1: %d", master, node0, node1);
1849 if (res.restartOneDbNode(node0,
false,
true,
true))
1860 int dump[] = { DumpStateOrd::DihStartLcpImmediately };
1863 for (Uint32 i = 0; i<3; i++)
1865 res.dumpStateOneNode(master, dump, 1);
1873 if (res.waitNodesNoStart(&node0, 1))
1876 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
1878 if (res.dumpStateOneNode(node0, val2, 2))
1881 if (res.insertErrorInNode(node0, 5010))
1884 if (res.insertErrorInNode(node1, 1001))
1887 if (res.startNodes(&node0, 1))
1890 NdbSleep_SecSleep(3);
1892 if (res.insertErrorInNode(node1, 0))
1895 if (res.waitNodesNoStart(&node0, 1))
1898 if (res.startNodes(&node0, 1))
1901 if (res.waitClusterStarted())
1909 f_master_failure [] = {
1910 7000, 7001, 7002, 7003, 7004, 7186, 7187, 7188, 7189, 7190, 0
1915 f_participant_failure [] = {
1916 7005, 7006, 7007, 7008, 5000, 7228, 0
1922 for (Uint32 i = 0; errors[
i]; i++)
1924 int node = res.getNode(sel);
1926 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
1927 if (res.dumpStateOneNode(node, val2, 2))
1930 ndbout <<
"node " << node <<
" err: " << errors[
i]<< endl;
1931 if (res.insertErrorInNode(node, errors[i]))
1934 if (res.waitNodesNoStart(&node, 1) != 0)
1937 res.startNodes(&node, 1);
1939 if (res.waitClusterStarted() != 0)
1949 int loops = ctx->getNumLoops();
1951 if (res.getNumDbNodes() < 2)
1956 if (res.getNumDbNodes() < 4)
1962 for (i = 0; f_master_failure[
i] && f_master_failure[
i] != 7186; i++);
1963 f_master_failure[
i] = 0;
1966 while (loops >= 0 && !ctx->isTestStopped())
1971 if (runerrors(res, NdbRestarter::NS_NON_MASTER, f_participant_failure))
1976 if (runerrors(res, NdbRestarter::NS_MASTER, f_participant_failure))
1982 if (runerrors(res, NdbRestarter::NS_RANDOM, f_participant_failure))
1987 if (runerrors(res, NdbRestarter::NS_MASTER, f_master_failure))
1999 int loops = ctx->getNumLoops();
2000 int records = ctx->getNumRecords();
2002 Ndb* pNdb = GETNDB(step);
2006 if (restarter.getNumDbNodes() < 2)
2018 switch (trans_type) {
2023 g_info <<
"case 0\n";
2024 if (hugoTrans.loadTable(GETNDB(step), records - 1))
2033 g_info <<
"case 1\n";
2034 if (hugoTrans.loadTable(GETNDB(step), 1))
2043 g_info <<
"case 2\n";
2046 if (hugoOps.startTransaction(pNdb))
2048 if (hugoOps.pkInsertRecord(pNdb, records-1))
2050 if (hugoOps.execute_Commit(pNdb))
2052 if (hugoOps.closeTransaction(pNdb))
2062 if (hugoOps.startTransaction(pNdb))
2064 pCon= hugoOps.getTransaction();
2066 switch (trans_type) {
2073 for (
int i= 0; i < records; i++)
2075 if (hugoOps.pkInsertRecord(pNdb, i))
2084 for (
int i= 0; i < records; i++)
2086 if (hugoOps.pkInsertRecord(pNdb, i))
2099 if (restarter.insertErrorInNode(node, 8054))
2103 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
2104 if (restarter.dumpStateOneNode(node, val2, 2))
2109 g_info <<
" execute... hangs for 5 seconds\n";
2111 const NdbOperation *first= pCon->getFirstDefinedOperation();
2112 int check= pCon->
execute(Commit, AO_IgnoreError);
2118 g_info <<
" error " << err.
code << endl;
2122 int expected_commit_res[3]= { 630, 630, 630 };
2124 err.
code != expected_commit_res[trans_type])
2126 g_err <<
"check == " << check << endl;
2127 g_err <<
"got error: "
2130 << expected_commit_res[trans_type]
2136 g_info <<
" wait node nostart\n";
2137 if (restarter.waitNodesNoStart(&node, 1))
2139 g_err <<
" wait node nostart failed\n";
2144 if (hugoOps.closeTransaction(pNdb))
2148 g_info <<
" dump pool status\n";
2152 if (restarter.dumpStateAllNodes(dump, 1))
2157 g_info <<
" wait cluster started\n";
2158 if (restarter.startNodes(&node, 1) ||
2159 restarter.waitNodesStarted(&node, 1))
2161 g_err <<
"Cluster failed to start\n";
2166 g_info <<
" verifying\n";
2167 switch (trans_type) {
2175 if (hugoTrans.scanReadRecords(GETNDB(step), records, 0, 64) != 0){
2184 g_info <<
" cleaning\n";
2185 if (hugoTrans.clearTable(GETNDB(step), records))
2191 hugoOps.closeTransaction(pNdb);
2198 max_cnt(
int arr[],
int cnt)
2202 for (
int i = 0; i<cnt ; i++)
2215 int loops = ctx->getNumLoops();
2217 bool lcp = ctx->getProperty(
"LCP", (
unsigned)0);
2219 int nodegroups[MAX_NDB_NODES];
2220 bzero(nodegroups,
sizeof(nodegroups));
2222 for (
int i = 0; i<res.getNumDbNodes(); i++)
2224 int node = res.getDbNodeId(i);
2225 nodegroups[res.getNodeGroup(node)]++;
2228 for (
int i = 0; i<MAX_NDB_NODES; i++)
2230 if (nodegroups[i] && nodegroups[i] == 1)
2240 for (
int i = 0; i<loops && ctx->isTestStopped() ==
false; i++)
2244 int lcpdump = DumpStateOrd::DihMinTimeBetweenLCP;
2245 res.dumpStateAllNodes(&lcpdump, 1);
2248 int ng_copy[MAX_NDB_NODES];
2249 memcpy(ng_copy, nodegroups,
sizeof(ng_copy));
2252 printf(
"restarting ");
2253 while (max_cnt(ng_copy, MAX_NDB_NODES) > 1)
2255 int node = res.getNode(NdbRestarter::NS_RANDOM);
2256 int ng = res.getNodeGroup(node);
2257 if (ng_copy[ng] > 1)
2259 printf(
"%u ", node);
2260 nodes.push_back(node);
2266 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
2267 for (Uint32 j = 0; j<nodes.size(); j++)
2269 res.dumpStateOneNode(nodes[j], val2, 2);
2272 int kill[] = { 9999, 1000, 3000 };
2273 for (Uint32 j = 0; j<nodes.size(); j++)
2275 res.dumpStateOneNode(nodes[j], kill, 3);
2278 if (res.waitNodesNoStart(nodes.getBase(), nodes.size()))
2281 if (res.startNodes(nodes.getBase(), nodes.size()))
2284 if (res.waitClusterStarted())
2313 int bytes = tab.getRowSizeInBytes();
2314 int size = 50*1024*1024;
2315 int rows = size / bytes;
2320 ndbout_c(
"Loading %u rows into %s", rows, tmp.
c_str());
2321 Uint64 now = NdbTick_CurrentMillisecond();
2325 hugoTrans.loadTableStartFrom(GETNDB(step), cnt, 10000);
2327 }
while (cnt < rows && (NdbTick_CurrentMillisecond() - now) < 30000);
2328 ndbout_c(
"Loaded %u rows in %llums", cnt,
2329 NdbTick_CurrentMillisecond() - now);
2340 GETNDB(step)->getDictionary()->dropTable(tmp.
c_str());
2353 if (res.getNumDbNodes() < 2)
2359 nodes[0] = res.getMasterNodeId();
2360 nodes[1] = res.getNextMasterNodeId(nodes[0]);
2362 while (res.getNodeGroup(nodes[0]) != res.getNodeGroup(nodes[1]))
2364 ndbout_c(
"Restarting %u as it not in same node group as %u",
2365 nodes[1], nodes[0]);
2366 if (res.restartOneDbNode(nodes[1],
false,
true,
true))
2369 if (res.waitNodesNoStart(nodes+1, 1))
2372 if (res.startNodes(nodes+1, 1))
2375 if (res.waitClusterStarted())
2378 nodes[1] = res.getNextMasterNodeId(nodes[0]);
2381 ndbout_c(
"nodes[0]: %u nodes[1]: %u", nodes[0], nodes[1]);
2383 int val = DumpStateOrd::DihMinTimeBetweenLCP;
2384 if (res.dumpStateAllNodes(&val, 1))
2387 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
2388 if (res.dumpStateAllNodes(val2, 2))
2391 if (res.insertErrorInAllNodes(932))
2394 if (res.insertErrorInNode(nodes[1], 7192))
2397 if (res.insertErrorInNode(nodes[0], 7191))
2400 if (res.waitClusterNoStart())
2406 if (res.waitClusterStarted())
2409 if (res.restartOneDbNode(nodes[1],
false,
false,
true))
2412 if (res.waitClusterStarted())
2424 Ndb* pNdb = GETNDB(step);
2427 if (res.getNumDbNodes() < 2)
2434 if(hugoOps.startTransaction(pNdb) != 0)
2437 if(hugoOps.pkInsertRecord(pNdb, 1) != 0)
2440 if(hugoOps.execute_NoCommit(pNdb) != 0)
2444 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
2446 if (res.dumpStateOneNode(transNode, val2, 2))
2451 if (res.insertErrorInNode(transNode, 8055))
2456 hugoOps.execute_Commit(pNdb);
2458 if (res.waitNodesNoStart(&transNode, 1))
2461 if (res.startNodes(&transNode, 1))
2464 if (res.waitClusterStarted())
2479 if (res.getNumDbNodes() < 2)
2484 int master = res.getMasterNodeId();
2485 int next = res.getNextMasterNodeId(master);
2487 if (res.insertErrorInNode(next, 7194))
2492 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
2493 if (res.dumpStateOneNode(master, val2, 2))
2496 if (res.insertErrorInNode(master, 7193))
2499 int val3[] = { 7099 };
2500 if (res.dumpStateOneNode(master, val3, 1))
2503 if (res.waitNodesNoStart(&master, 1))
2506 if (res.startNodes(&master, 1))
2509 if (res.waitClusterStarted())
2519 int loops = ctx->getNumLoops();
2524 if (res.getNumDbNodes() < 2)
2531 int master = res.getMasterNodeId();
2534 for (Uint32 i = 0; i<(Uint32)res.getNumDbNodes(); i++)
2536 int node = res.getDbNodeId(i);
2537 if (node != master && node < victim)
2541 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
2542 if (res.dumpStateOneNode(victim, val2, 2))
2545 if (res.insertErrorInNode(master, 7200))
2548 if (res.waitNodesNoStart(&victim, 1))
2551 if (res.startNodes(&victim, 1))
2554 if (res.waitClusterStarted())
2564 int result = NDBT_OK;
2565 int loops = ctx->getNumLoops();
2570 int records = ctx->getNumRecords();
2571 Ndb* pNdb = GETNDB(step);
2573 if (restarter.getNumDbNodes() < 2)
2579 if(restarter.waitClusterStarted() != 0){
2580 g_err <<
"Cluster failed to start" << endl;
2585 const char * off = NdbEnv_GetEnv(
"NDB_ERR_OFFSET", buf,
sizeof(buf));
2586 int offset = off ? atoi(off) : 0;
2588 while(i<loops && result != NDBT_FAILED && !ctx->isTestStopped())
2590 int id = lastId % restarter.getNumDbNodes();
2591 int nodeId = restarter.getDbNodeId(
id);
2592 int err = 5048 + ((i+
offset) % 2);
2594 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
2596 if(hugoOps.startTransaction(pNdb) != 0)
2599 nodeId = hugoOps.getTransaction()->getConnectedNodeId();
2600 ndbout <<
"Restart node " << nodeId <<
" " << err <<endl;
2602 if (restarter.dumpStateOneNode(nodeId, val2, 2))
2605 if(restarter.insertErrorInNode(nodeId, err) != 0){
2606 g_err <<
"Failed to restartNextDbNode" << endl;
2607 result = NDBT_FAILED;
2611 if (restarter.insertErrorInNode(nodeId, 8057) != 0)
2613 g_err <<
"Failed to insert error 8057" << endl;
2614 result = NDBT_FAILED;
2623 int row = (records - rows) ? rand() % (records - rows) : 0;
2624 if (row + rows > records)
2625 row = records - row;
2631 for (
int r = row; r < row + rows; r++)
2633 if(hugoOps.pkUpdateRecord(pNdb, r, batch, rand()) != 0)
2636 for (
int l = 1; l<5; l++)
2638 if (hugoOps.execute_NoCommit(pNdb) != 0)
2641 if(hugoOps.pkUpdateRecord(pNdb, r, batch, rand()) != 0)
2646 hugoOps.execute_Commit(pNdb);
2647 hugoOps.closeTransaction(pNdb);
2649 if (restarter.waitNodesNoStart(&nodeId, 1))
2651 g_err <<
"Failed to waitNodesNoStart" << endl;
2652 result = NDBT_FAILED;
2656 if (restarter.startNodes(&nodeId, 1))
2658 g_err <<
"Failed to startNodes" << endl;
2659 result = NDBT_FAILED;
2663 if(restarter.waitClusterStarted() != 0){
2664 g_err <<
"Cluster failed to start" << endl;
2665 result = NDBT_FAILED;
2684 int result = NDBT_OK;
2685 int loops = ctx->getNumLoops();
2687 if (restarter.getNumDbNodes() < 2)
2693 if(restarter.waitClusterStarted() != 0){
2694 g_err <<
"Cluster failed to start" << endl;
2699 while(i<loops && result != NDBT_FAILED && !ctx->isTestStopped())
2701 int nodeId = restarter.getDbNodeId(rand() % restarter.getNumDbNodes());
2704 ndbout <<
"Restart node " << nodeId <<
" " << err <<endl;
2706 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
2707 if (restarter.dumpStateOneNode(nodeId, val2, 2))
2710 if(restarter.insertErrorInNode(nodeId, err) != 0){
2711 g_err <<
"Failed to restartNextDbNode" << endl;
2712 result = NDBT_FAILED;
2716 if (restarter.waitNodesNoStart(&nodeId, 1))
2718 g_err <<
"Failed to waitNodesNoStart" << endl;
2719 result = NDBT_FAILED;
2723 if (restarter.startNodes(&nodeId, 1))
2725 g_err <<
"Failed to startNodes" << endl;
2726 result = NDBT_FAILED;
2730 if(restarter.waitClusterStarted() != 0){
2731 g_err <<
"Cluster failed to start" << endl;
2732 result = NDBT_FAILED;
2748 int loops = ctx->getNumLoops();
2753 if (res.getNumDbNodes() < 2)
2760 int victim = res.getDbNodeId(rand()%res.getNumDbNodes());
2761 res.restartOneDbNode(victim,
true,
true,
true);
2766 if (res.waitNodesNoStart(&victim, 1))
2769 res.insertErrorInAllNodes(7204);
2770 res.insertErrorInNode(victim, 7203);
2772 res.startNodes(&victim, 1);
2774 if (res.waitClusterStarted())
2786 if (res.getNumDbNodes() < 2)
2796 for (
int i = 0; i<res.getNumDbNodes(); i++)
2798 int nodeId = res.getDbNodeId(i);
2799 int ng = res.getNodeGroup(nodeId);
2802 part1.push_back(nodeId);
2803 part1mask.
set(nodeId);
2808 part0.push_back(nodeId);
2809 part0mask.
set(nodeId);
2814 for (
size_t i = 0; i<part0.size(); i++)
2815 printf(
"%u ", part0[i]);
2819 for (
size_t i = 0; i<part1.size(); i++)
2820 printf(
"%u ", part1[i]);
2823 int loops = ctx->getNumLoops();
2824 while (loops-- && !ctx->isTestStopped())
2827 int master = res.getMasterNodeId();
2828 int nextMaster = res.getNextMasterNodeId(master);
2831 if (part0mask.
get(master) && part0mask.
get(nextMaster))
2835 nodes = part0.getBase();
2836 printf(
"restarting part0");
2838 else if(part1mask.
get(master) && part1mask.
get(nextMaster))
2842 nodes = part1.getBase();
2843 printf(
"restarting part1");
2851 nodes = part0.getBase();
2852 printf(
"restarting part0");
2857 nodes = part0.getBase();
2858 printf(
"restarting part0");
2862 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
2863 for (
int i = 0; i<cnt; i++)
2864 if (res.dumpStateOneNode(nodes[i], val2, 2))
2869 if (NdbEnv_GetEnv(
"MNF", buf,
sizeof(buf)))
2881 ndbout_c(
" type: %u (cmf: %u)", type, cmf);
2884 for (
int i = 0; i<cnt; i++)
2886 if (res.restartOneDbNode(nodes[i],
false,
true,
true))
2892 NdbSleep_MilliSleep(10);
2896 for (
int i = 0; i<cnt; i++)
2898 if (res.restartOneDbNode(nodes[i],
false,
true,
true))
2907 for (
int i = 0; i<cnt; i++)
2909 res.insertErrorInNode(nodes[i], 8058);
2911 res.restartOneDbNode(nodes[0],
false,
true,
true);
2917 for (
int i = 0; i<cnt; i++)
2919 res.insertErrorInNode(nodes[i], 8059);
2921 res.restartOneDbNode(nodes[0],
false,
true,
true);
2928 for (
int i = 0; i<cnt; i++)
2930 if (res.getNextMasterNodeId(master) == nodes[
i])
2931 res.insertErrorInNode(nodes[i], 7180);
2933 res.insertErrorInNode(nodes[i], 7205);
2937 res.insertErrorInNode(master, 7193);
2938 res.dumpStateOneNode(master, &lcp, 1);
2943 for (
int i = 0; i<cnt; i++)
2945 res.insertErrorInNode(nodes[i], 7206);
2949 res.insertErrorInNode(master, 7193);
2950 res.dumpStateOneNode(master, &lcp, 1);
2955 for (
int i = 0; i<cnt; i++)
2957 res.insertErrorInNode(nodes[i], 5008);
2961 res.insertErrorInNode(master, 7193);
2962 res.dumpStateOneNode(master, &lcp, 1);
2967 if (res.waitNodesNoStart(nodes, cnt))
2970 if (res.startNodes(nodes, cnt))
2973 if (res.waitClusterStarted())
2988 if (res.getNumDbNodes() < 4)
2991 int master = res.getMasterNodeId();
2992 int nextMaster = res.getNextMasterNodeId(master);
2993 int victim = res.getRandomNodeSameNodeGroup(nextMaster, rand());
2994 if (victim == master)
2996 victim = res.getRandomNodeOtherNodeGroup(nextMaster, rand());
2999 ndbout_c(
"master: %u next master: %u victim: %u",
3000 master, nextMaster, victim);
3002 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
3003 res.dumpStateOneNode(master, val2, 2);
3004 res.dumpStateOneNode(victim, val2, 2);
3006 res.insertErrorInNode(victim, 7205);
3007 res.insertErrorInNode(master, 7014);
3009 res.dumpStateOneNode(master, &lcp, 1);
3014 if (res.waitNodesNoStart(nodes, 2))
3019 if (res.startNodes(nodes, 2))
3024 if (res.waitClusterStarted())
3036 Ndb* pNdb = GETNDB(step);
3038 if (res.getNumDbNodes() < 4)
3044 int master = res.getMasterNodeId();
3045 int nextMaster = res.getNextMasterNodeId(master);
3048 if(hugoOps.startTransaction(pNdb) != 0)
3051 if(hugoOps.pkUpdateRecord(pNdb, 1, 1) != 0)
3054 if(hugoOps.execute_NoCommit(pNdb) != 0)
3057 int victim = hugoOps.getTransaction()->getConnectedNodeId();
3058 printf(
"master: %u nextMaster: %u victim: %u",
3059 master, nextMaster, victim);
3060 if (victim == master || victim == nextMaster ||
3061 res.getNodeGroup(victim) == res.getNodeGroup(master) ||
3062 res.getNodeGroup(victim) == res.getNodeGroup(nextMaster))
3064 hugoOps.execute_Rollback(pNdb);
3065 hugoOps.closeTransaction(pNdb);
3069 ndbout_c(
" -> restarting next master: %u", nextMaster);
3070 res.restartOneDbNode(nextMaster,
false,
true,
true);
3075 res.waitNodesNoStart(&nextMaster, 1);
3076 res.startNodes(&nextMaster, 1);
3077 if (res.waitClusterStarted())
3083 ndbout_c(
" -> loop");
3087 ndbout_c(
" -> go go gadget skates");
3089 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
3090 res.dumpStateOneNode(master, val2, 2);
3091 res.dumpStateOneNode(victim, val2, 2);
3093 res.insertErrorInNode(master, 8060);
3094 res.insertErrorInNode(victim, 9999);
3099 if (res.waitNodesNoStart(nodes, 2))
3104 if (res.startNodes(nodes, 2))
3109 if (res.waitClusterStarted())
3112 hugoOps.execute_Rollback(pNdb);
3113 hugoOps.closeTransaction(pNdb);
3124 Ndb* pNdb = GETNDB(step);
3126 if (res.getNumDbNodes() < 4)
3133 int master = res.getMasterNodeId();
3134 int nextMaster = res.getNextMasterNodeId(master);
3137 if(hugoOps.startTransaction(pNdb) != 0)
3140 if(hugoOps.pkUpdateRecord(pNdb, 1, 100) != 0)
3143 if(hugoOps.execute_NoCommit(pNdb) != 0)
3146 int victim = hugoOps.getTransaction()->getConnectedNodeId();
3147 printf(
"master: %u nextMaster: %u victim: %u",
3148 master, nextMaster, victim);
3149 if (victim == master || victim == nextMaster ||
3150 res.getNodeGroup(victim) == res.getNodeGroup(master) ||
3151 res.getNodeGroup(victim) == res.getNodeGroup(nextMaster))
3153 hugoOps.execute_Rollback(pNdb);
3154 hugoOps.closeTransaction(pNdb);
3158 ndbout_c(
" -> restarting next master: %u", nextMaster);
3159 res.restartOneDbNode(nextMaster,
false,
true,
true);
3164 res.waitNodesNoStart(&nextMaster, 1);
3165 res.startNodes(&nextMaster, 1);
3166 if (res.waitClusterStarted())
3172 ndbout_c(
" -> loop");
3176 ndbout_c(
" -> go go gadget skates");
3178 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
3179 res.dumpStateOneNode(master, val2, 2);
3180 res.dumpStateOneNode(victim, val2, 2);
3182 for (
int i = 0; i<res.getNumDbNodes(); i++)
3184 int nodeId = res.getDbNodeId(i);
3185 res.insertErrorInNode(nodeId, 5050);
3188 res.insertErrorInNode(victim, 9999);
3193 if (res.waitNodesNoStart(nodes, 2))
3198 if (res.startNodes(nodes, 2))
3203 if (res.waitClusterStarted())
3206 hugoOps.execute_Rollback(pNdb);
3207 hugoOps.closeTransaction(pNdb);
3220 if (res.getNumDbNodes() < 4)
3223 int master = res.getMasterNodeId();
3224 int nextMaster = res.getNextMasterNodeId(master);
3225 int victim = res.getRandomNodeSameNodeGroup(nextMaster, rand());
3226 if (victim == master)
3228 victim = res.getRandomNodeOtherNodeGroup(nextMaster, rand());
3231 ndbout_c(
"master: %u nextMaster: %u victim: %u",
3232 master, nextMaster, victim);
3234 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
3235 res.dumpStateOneNode(master, val2, 2);
3236 res.insertErrorInNode(victim, 7209);
3239 res.dumpStateOneNode(master, &lcp, 1);
3241 if (res.waitNodesNoStart(&master, 1))
3246 if (res.startNodes(&master, 1))
3251 if (res.waitClusterStarted())
3263 Ndb* pNdb = GETNDB(step);
3265 if (res.getNumDbNodes() < 4)
3272 int master = res.getMasterNodeId();
3273 int nextMaster = res.getNextMasterNodeId(master);
3275 printf(
"master: %u nextMaster: %u", master, nextMaster);
3276 if (res.getNodeGroup(master) == res.getNodeGroup(nextMaster))
3278 ndbout_c(
" -> restarting next master: %u", nextMaster);
3279 res.restartOneDbNode(nextMaster,
false,
true,
true);
3284 res.waitNodesNoStart(&nextMaster, 1);
3285 res.startNodes(&nextMaster, 1);
3286 if (res.waitClusterStarted())
3288 ndbout_c(
"cluster didnt restart!!");
3293 ndbout_c(
" -> go go gadget skates");
3295 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
3296 res.dumpStateOneNode(master, val2, 2);
3297 res.dumpStateOneNode(nextMaster, val2, 2);
3299 res.insertErrorInNode(master, 8063);
3300 res.insertErrorInNode(nextMaster, 936);
3306 if((err = hugoOps.startTransaction(pNdb)) != 0)
3308 ndbout_c(
"failed to start transaction: %u", err);
3312 int victim = hugoOps.getTransaction()->getConnectedNodeId();
3313 if (victim != master)
3315 ndbout_c(
"transnode: %u != master: %u -> loop",
3317 hugoOps.closeTransaction(pNdb);
3321 if((err = hugoOps.pkUpdateRecord(pNdb, 1)) != 0)
3323 ndbout_c(
"failed to update: %u", err);
3327 if((err = hugoOps.execute_Commit(pNdb)) != 4010)
3329 ndbout_c(
"incorrect error code: %u", err);
3332 hugoOps.closeTransaction(pNdb);
3336 nodes[1] = nextMaster;
3337 if (res.waitNodesNoStart(nodes, 2))
3342 if (res.startNodes(nodes, 2))
3347 if (res.waitClusterStarted())
3356 int records = ctx->getNumRecords();
3357 Ndb* pNdb = GETNDB(step);
3359 while (!ctx->isTestStopped())
3361 int r = rand() % records;
3362 if (hugoOps.startTransaction(pNdb) != 0)
3365 if ((rand() % 100) < 50)
3367 if (hugoOps.pkUpdateRecord(pNdb, r, 1, rand()) != 0)
3372 if (hugoOps.pkWriteRecord(pNdb, r, 1, rand()) != 0)
3376 if (hugoOps.execute_NoCommit(pNdb) != 0)
3379 if (hugoOps.pkDeleteRecord(pNdb, r, 1) != 0)
3382 if (hugoOps.execute_NoCommit(pNdb) != 0)
3385 if ((rand() % 100) < 50)
3387 if (hugoOps.pkInsertRecord(pNdb, r, 1, rand()) != 0)
3392 if (hugoOps.pkWriteRecord(pNdb, r, 1, rand()) != 0)
3396 if ((rand() % 100) < 90)
3398 hugoOps.execute_Commit(pNdb);
3403 hugoOps.execute_Rollback(pNdb);
3406 hugoOps.closeTransaction(pNdb);
3415 int records = ctx->getNumRecords();
3416 Ndb* pNdb = GETNDB(step);
3418 unsigned id = (unsigned)rand();
3419 while (!ctx->isTestStopped())
3421 if (ctx->getProperty(
"Pause", (Uint32)0))
3423 ndbout_c(
"thread %u stopped",
id);
3425 while (ctx->getProperty(
"Pause", (Uint32)0) && !ctx->isTestStopped())
3426 NdbSleep_MilliSleep(15);
3428 if (ctx->isTestStopped())
3430 ndbout_c(
"thread %u continue",
id);
3433 if ((res = hugoOps.startTransaction(pNdb)) != 0)
3440 for (
int i = 0; i < 10; i++)
3442 int r = rand() % records;
3443 if ((rand() % 100) < 50)
3445 if (hugoOps.pkUpdateRecord(pNdb, r, 1, rand()) != 0)
3450 if (hugoOps.pkWriteRecord(pNdb, r, 1, rand()) != 0)
3455 if ((rand() % 100) < 90)
3457 res = hugoOps.execute_Commit(pNdb);
3462 res = hugoOps.execute_Rollback(pNdb);
3465 hugoOps.closeTransaction(pNdb);
3480 if (res.getNumDbNodes() < 2)
3488 const int cases = 1;
3489 int loops = ctx->getNumLoops();
3493 for (
int i = 0; i<loops; i++)
3495 int master = res.getMasterNodeId();
3496 int next = res.getNextMasterNodeId(master);
3498 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
3499 if (res.dumpStateOneNode(next, val2, 2))
3502 ndbout_c(
"stopping %u, err 8073", next);
3503 res.insertErrorInNode(next, 8073);
3504 ndbout_c(
"waiting for %u", next);
3505 res.waitNodesNoStart(&next, 1);
3507 ndbout_c(
"pausing all threads");
3508 ctx->setProperty(
"Pause", 1);
3509 ctx->sync_up_and_wait(
"WaitThreads", ctx->getProperty(
"Threads", 1));
3510 ndbout_c(
"all threads paused");
3511 NdbSleep_MilliSleep(5000);
3512 res.dumpStateAllNodes(&leak, 1);
3513 NdbSleep_MilliSleep(1000);
3514 if (res.checkClusterAlive(&next, 1))
3518 ndbout_c(
"restarting threads");
3519 ctx->setProperty(
"Pause", (Uint32)0);
3521 ndbout_c(
"starting %u", next);
3522 res.startNodes(&next, 1);
3523 ndbout_c(
"waiting for cluster started");
3524 if (res.waitClusterStarted())
3529 ndbout_c(
"pausing all threads");
3530 ctx->setProperty(
"Pause", 1);
3531 ctx->sync_up_and_wait(
"WaitThreads", ctx->getProperty(
"Threads", 1));
3532 ndbout_c(
"all threads paused");
3533 NdbSleep_MilliSleep(5000);
3534 res.dumpStateAllNodes(&leak, 1);
3535 NdbSleep_MilliSleep(1000);
3536 ndbout_c(
"restarting threads");
3537 ctx->setProperty(
"Pause", (Uint32)0);
3549 if (res.getNumDbNodes() < 4)
3555 int loops = ctx->getNumLoops();
3557 int val0[] = { 7216, 0 };
3558 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
3559 for (
int i = 0; i<loops; i++)
3561 int master = res.getMasterNodeId();
3562 int next = res.getNextMasterNodeId(master);
3564 if (res.dumpStateOneNode(master, val2, 2))
3567 ndbout_c(
"stopping %u, err 7216 (next: %u)", master, next);
3569 if (res.dumpStateOneNode(master, val0, 2))
3572 res.waitNodesNoStart(&master, 1);
3573 res.startNodes(&master, 1);
3574 ndbout_c(
"waiting for cluster started");
3575 if (res.waitClusterStarted())
3589 if (res.getNumDbNodes() < 4)
3595 int loops = ctx->getNumLoops();
3596 while (--loops >= 0)
3598 int master = res.getMasterNodeId();
3599 ndbout_c(
"master: %u", master);
3600 int nodeId = res.getRandomNodeSameNodeGroup(master, rand());
3601 ndbout_c(
"target: %u", nodeId);
3602 int node2 = res.getRandomNodeOtherNodeGroup(nodeId, rand());
3603 ndbout_c(
"node 2: %u", node2);
3605 res.restartOneDbNode(nodeId,
false,
true,
true);
3610 res.waitNodesNoStart(&nodeId, 1);
3612 int dump[] = { 9000, 0 };
3615 if (res.dumpStateOneNode(nodeId, dump, 2))
3618 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
3619 if (res.dumpStateOneNode(nodeId, val2, 2))
3622 res.insertErrorInNode(nodeId, 937);
3623 ndbout_c(
"%u : starting %u", __LINE__, nodeId);
3624 res.startNodes(&nodeId, 1);
3625 NdbSleep_SecSleep(3);
3626 ndbout_c(
"%u : waiting for %u to not get not-started", __LINE__, nodeId);
3627 res.waitNodesNoStart(&nodeId, 1);
3629 ndbout_c(
"%u : starting %u", __LINE__, nodeId);
3630 res.startNodes(&nodeId, 1);
3632 ndbout_c(
"%u : waiting for cluster started", __LINE__);
3633 if (res.waitClusterStarted())
3648 if (res.getNumDbNodes() < 2)
3654 int loops = ctx->getNumLoops();
3655 while (--loops >= 0)
3657 int nodeId = res.getNode(NdbRestarter::NS_RANDOM);
3658 res.restartOneDbNode(nodeId,
false,
true,
true);
3663 res.waitNodesNoStart(&nodeId, 1);
3665 NdbSleep_SecSleep(10);
3667 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
3668 if (res.dumpStateOneNode(nodeId, val2, 2))
3671 res.insertErrorInNode(nodeId, 9994);
3672 res.startNodes(&nodeId, 1);
3673 NdbSleep_SecSleep(3);
3674 ndbout_c(
"%u : waiting for %u to not get not-started", __LINE__, nodeId);
3675 res.waitNodesNoStart(&nodeId, 1);
3677 if (res.dumpStateOneNode(nodeId, val2, 2))
3680 res.insertErrorInNode(nodeId, 9994);
3681 res.startNodes(&nodeId, 1);
3682 NdbSleep_SecSleep(3);
3683 ndbout_c(
"%u : waiting for %u to not get not-started", __LINE__, nodeId);
3684 res.waitNodesNoStart(&nodeId, 1);
3686 NdbSleep_SecSleep(20);
3688 ndbout_c(
"%u : starting %u", __LINE__, nodeId);
3689 res.startNodes(&nodeId, 1);
3691 ndbout_c(
"%u : waiting for cluster started", __LINE__);
3692 if (res.waitClusterStarted())
3707 if (res.getNumDbNodes() < 2)
3713 int loops = ctx->getNumLoops();
3714 while (--loops >= 0)
3716 int master = res.getMasterNodeId();
3717 ndbout_c(
"master: %u", master);
3718 int nodeId = master;
3720 nodeId = res.getNode(NdbRestarter::NS_RANDOM);
3721 }
while (nodeId == master);
3723 ndbout_c(
"target: %u", nodeId);
3725 res.restartOneDbNode(nodeId,
false,
true,
true);
3730 res.waitNodesNoStart(&nodeId, 1);
3732 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
3733 if (res.dumpStateOneNode(nodeId, val2, 2))
3736 res.insertErrorInNode(master, 7217);
3737 res.startNodes(&nodeId, 1);
3738 NdbSleep_SecSleep(3);
3739 ndbout_c(
"%u : waiting for %u to not get not-started", __LINE__, nodeId);
3740 res.waitNodesNoStart(&nodeId, 1);
3742 ndbout_c(
"%u : starting %u", __LINE__, nodeId);
3743 res.startNodes(&nodeId, 1);
3745 ndbout_c(
"%u : waiting for cluster started", __LINE__);
3746 if (res.waitClusterStarted())
3756 #define CHECK(b, m) { int _xx = b; if (!(_xx)) { \
3757 ndbout << "ERR: "<< m \
3758 << " " << "File: " << __FILE__ \
3759 << " (Line: " << __LINE__ << ")" << "- " << _xx << endl; \
3760 return NDBT_FAILED; } }
3768 const int codes [] = {
3775 int loops = ctx->getNumLoops();
3776 const int val[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 } ;
3777 for (
int l = 0; l < loops; l++)
3779 int randomId = myRandom48(res.getNumDbNodes());
3780 int nodeId = res.getDbNodeId(randomId);
3782 ndbout_c(
"killing node %u error 5051 loop %u/%u", nodeId, l+1, loops);
3783 CHECK(res.dumpStateOneNode(nodeId, val, 2) == 0,
3784 "failed to set RestartOnErrorInsert");
3786 CHECK(res.insertErrorInNode(nodeId, 5051) == 0,
3787 "failed to insert error 5051");
3789 while (res.waitNodesNoStart(&nodeId, 1, 1 ) != 0)
3794 ndbout_c(
"killing node %u during restart error 5052", nodeId);
3795 for (
int j = 0; j < 3; j++)
3797 ndbout_c(
"loop: %d - killing node %u during restart error 5052",
3799 int val[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 } ;
3800 CHECK(res.dumpStateOneNode(nodeId, val, 2) == 0,
3801 "failed to set RestartOnErrorInsert");
3803 CHECK(res.insertErrorInNode(nodeId, 5052) == 0,
3804 "failed to set error insert");
3806 NdbSleep_SecSleep(3);
3808 CHECK(res.startNodes(&nodeId, 1) == 0,
3809 "failed to start node");
3811 NdbSleep_SecSleep(3);
3813 CHECK(res.waitNodesNoStart(&nodeId, 1) == 0,
3814 "waitNodesNoStart failed");
3817 CHECK(res.startNodes(&nodeId, 1) == 0,
3818 "failed to start node");
3820 CHECK(res.waitNodesStarted(&nodeId, 1) == 0,
3821 "waitNodesStarted failed");
3858 tables.push_back(tmp);
3864 if (hugoTrans.loadTable(GETNDB(step), 1000) != 0)
3874 for (Uint32 i = 0; i<tables.size(); i++)
3890 Ndb* pNdb = GETNDB(step);
3893 int nodeId = res.getNode(NdbRestarter::NS_RANDOM);
3894 ndbout_c(
"restarting %d", nodeId);
3895 res.restartOneDbNode(nodeId,
false,
true,
true);
3896 res.waitNodesNoStart(&nodeId, 1);
3898 int minlcp[] = { 7017, 1 };
3899 res.dumpStateAllNodes(minlcp, 1);
3901 ndbout_c(
"starting %d", nodeId);
3902 res.startNodes(&nodeId, 1);
3905 ndbout_c(
"starting uncommitted transaction %u minutes", minutes);
3906 for (Uint32 m = 0; m < minutes; m++)
3908 if (hugoOps.startTransaction(pNdb) != 0)
3911 if (hugoOps.pkUpdateRecord(pNdb, 0, 50, rand()) != 0)
3914 if (hugoOps.execute_NoCommit(pNdb) != 0)
3918 ndbout_c(
"sleeping 60s");
3919 for (Uint32 i = 0; i<600 && !ctx->isTestStopped(); i++)
3921 hugoOps.getTransaction()->refresh();
3922 NdbSleep_MilliSleep(100);
3925 if (hugoOps.execute_Commit(pNdb) != 0)
3928 hugoOps.closeTransaction(pNdb);
3930 if (ctx->isTestStopped())
3935 res.dumpStateAllNodes(minlcp, 2);
3952 int loops = ctx->getNumLoops();
3955 if (res.getNumDbNodes() < 2)
3958 for (
int i = 0; i<loops; i++)
3960 int master = res.getMasterNodeId();
3961 int next = res.getNextMasterNodeId(master);
3962 ndbout_c(
"master: %u next: %u", master, next);
3964 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
3966 if (res.dumpStateOneNode(master, val2, 2))
3969 if (res.insertErrorInNode(next, 7224))
3972 res.waitNodesNoStart(&master, 1);
3973 res.startNodes(&master, 1);
3974 if (res.waitClusterStarted() != 0)
3986 if (res.getNumDbNodes() < 2)
3989 int node0 = res.getNode(NdbRestarter::NS_RANDOM);
3990 int node1 = res.getRandomNodeSameNodeGroup(node0, rand());
3991 ndbout_c(
"%u %u", node0, node1);
3993 res.restartOneDbNode(node0,
false,
true,
true);
3994 res.waitNodesNoStart(&node0, 1);
3995 res.insertErrorInNode(node0, 1000);
3998 hugoTrans.scanUpdateRecords(GETNDB(step), 0);
4000 res.insertErrorInNode(node1, 5060);
4001 res.startNodes(&node0, 1);
4002 res.waitClusterStarted();
4009 int loops = ctx->getNumLoops();
4012 if (res.getNumDbNodes() < 4)
4015 for (
int i = 0; i<loops; i++)
4017 int master = res.getMasterNodeId();
4018 int next0 = res.getNextMasterNodeId(master);
4019 int next1 = res.getNextMasterNodeId(next0);
4020 ndbout_c(
"master: %d next0: %d next1: %d", master, next0, next1);
4022 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
4024 if (res.dumpStateOneNode(master, val2, 2))
4027 int val3[] = { 7999, 7226, next1 };
4028 if (res.dumpStateOneNode(master, val3, 3))
4031 res.waitNodesNoStart(&master, 1);
4032 res.startNodes(&master, 1);
4033 if (res.waitClusterStarted() != 0)
4044 if (res.getNumDbNodes() < 2)
4050 for (
int j = 0; j<res.getNumDbNodes(); j++)
4052 int node = res.getDbNodeId(j);
4053 int ng = res.getNodeGroup(node);
4054 if (nodeGroupMap.get(ng))
4056 group2.push_back(node);
4060 group1.push_back(node);
4061 nodeGroupMap.set(ng);
4066 for (
size_t i = 0; i<group1.size(); i++)
4067 printf(
"%d ", group1[i]);
4071 for (
size_t i = 0; i<group2.size(); i++)
4072 printf(
"%d ", group2[i]);
4077 NdbRestarter::NRRF_NOSTART | NdbRestarter::NRRF_ABORT);
4078 res.waitNodesNoStart(group1.getBase(), (int)group1.size());
4080 ndbout_c(
"%u", __LINE__);
4082 if (res.restartOneDbNode(group2[0],
4088 ndbout_c(
"%u", __LINE__);
4089 g_err <<
"Restart suceeded without force" << endl;
4093 ndbout_c(
"%u", __LINE__);
4096 if (res.restartOneDbNode(group2[0],
4102 ndbout_c(
"%u", __LINE__);
4103 g_err <<
"Could not restart with force" << endl;
4107 ndbout_c(
"%u", __LINE__);
4111 res.waitClusterNoStart();
4113 ndbout_c(
"%u", __LINE__);
4116 res.startNodes(group2.getBase(), (int)group2.size());
4117 res.waitNodesStarted(group2.getBase(), (int)group2.size());
4119 ndbout_c(
"%u", __LINE__);
4122 if (res.
restartNodes(group2.getBase(), (int)group2.size(),
4123 NdbRestarter::NRRF_NOSTART) != -1)
4125 g_err <<
"Restart suceeded without force" << endl;
4129 ndbout_c(
"%u", __LINE__);
4132 if (res.
restartNodes(group2.getBase(), (int)group2.size(),
4133 NdbRestarter::NRRF_NOSTART |
4134 NdbRestarter::NRRF_FORCE) != 0)
4136 g_err <<
"Could not restart with force" << endl;
4140 ndbout_c(
"%u", __LINE__);
4142 if (res.waitNodesNoStart(group2.getBase(), (int)group2.size()))
4144 g_err <<
"Failed to waitNodesNoStart" << endl;
4150 res.waitClusterStarted();
4159 if (res.getNumDbNodes() < 4)
4162 Ndb* pNdb = GETNDB(step);
4165 int loops = ctx->getNumLoops();
4168 if (hugoOps.startTransaction(pNdb) != 0)
4171 if (hugoOps.pkInsertRecord(pNdb, 0, 128 ) != 0)
4183 int node = (int)hugoOps.getTransaction()->getConnectedNodeId();
4184 int node0 = res.getRandomNodeOtherNodeGroup(node, rand());
4185 int node1 = res.getRandomNodeSameNodeGroup(node0, rand());
4187 ndbout_c(
"node %u err: %u, node: %u err: %u",
4188 node0, 5061, node1, err);
4190 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
4192 res.dumpStateOneNode(node, val2, 2);
4193 res.insertErrorInNode(node0, 5061);
4194 res.insertErrorInNode(node1, err);
4196 hugoOps.execute_Commit(pNdb);
4197 hugoOps.closeTransaction(pNdb);
4199 res.waitNodesNoStart(&node, 1);
4200 res.startNodes(&node, 1);
4201 res.waitClusterStarted();
4202 hugoOps.clearTable(pNdb);
4226 Uint32 dynOrder = ctx->getProperty(
"DynamicOrder", Uint32(0));
4228 Uint32 numNodes = restarter.getNumDbNodes();
4237 ndbout_c(
"No Dynamic reordering possible with 2 nodes");
4242 ndbout_c(
"Non multiple-of-2 number of nodes. Not supported");
4246 Uint32 master = restarter.getMasterNodeId();
4248 for (Uint32
n=0;
n < numNodes;
n++)
4250 currOrder.push_back(master);
4251 master = restarter.getNextMasterNodeId(master);
4254 for (Uint32
n=0;
n < numNodes;
n++)
4256 Uint32 nodeId = restarter.getDbNodeId(
n);
4259 odds.push_back(nodeId);
4263 evens.push_back(nodeId);
4267 if (odds.size() != evens.size())
4269 ndbout_c(
"Failed - odds.size() (%u) != evens.size() (%u)",
4275 ndbout_c(
"Current dynamic ordering : ");
4276 for (Uint32
n=0;
n<numNodes;
n++)
4278 ndbout_c(
" %u %s", currOrder[
n], ((n==0)?
"*":
""));
4283 ndbout_c(
"No change in dynamic order");
4287 Uint32 control= dynOrder - 1;
4289 bool oddPresident = control & 1;
4290 bool interleave = control & 2;
4291 bool reverseSideA = control & 4;
4292 bool reverseSideB = control & 8;
4327 ndbout_c(
"Generating ordering with %s president, sides %sinterleaved",
4328 (oddPresident?
"odd":
"even"),
4329 (interleave?
"":
"not "));
4331 ndbout_c(
" %s reversed", (oddPresident?
"odds":
"evens"));
4334 ndbout_c(
" %s reversed", (oddPresident?
"evens":
"odds"));
4352 for (Uint32 n=0; n < sideA->size(); n++)
4354 Uint32 indexA = reverseSideA? (sideA->size() - (n+1)) : n;
4355 newOrder.push_back((*sideA)[indexA]);
4356 Uint32 indexB = reverseSideB? (sideB->size() - (n+1)) : n;
4357 newOrder.push_back((*sideB)[indexB]);
4362 for (Uint32 n=0; n < sideA->size(); n++)
4364 Uint32 indexA = reverseSideA? (sideA->size() - (n+1)) : n;
4365 newOrder.push_back((*sideA)[indexA]);
4367 for (Uint32 n=0; n < sideB->size(); n++)
4369 Uint32 indexB = reverseSideB? (sideB->size() - (n+1)) : n;
4370 newOrder.push_back((*sideB)[indexB]);
4376 for (Uint32 n=0; n < newOrder.size(); n++)
4382 diff |= (newOrder[
n] != currOrder[
n]);
4387 ndbout_c(
"Cluster already in correct configuration");
4391 for (Uint32 n=0; n < newOrder.size(); n++)
4393 ndbout_c(
"Now restarting node %u", newOrder[n]);
4394 if (restarter.restartOneDbNode(newOrder[n],
4400 ndbout_c(
"Failed to restart node");
4403 if (restarter.waitNodesNoStart((
const int*) &newOrder[n], 1) != NDBT_OK)
4405 ndbout_c(
"Failed waiting for node to enter NOSTART state");
4408 if (restarter.startNodes((
const int*) &newOrder[n], 1) != NDBT_OK)
4410 ndbout_c(
"Failed to start node");
4413 if (restarter.waitNodesStarted((
const int*) &newOrder[n], 1) != NDBT_OK)
4415 ndbout_c(
"Failed waiting for node to start");
4421 ndbout_c(
"All restarts completed. NdbRestarter says master is %u",
4422 restarter.getMasterNodeId());
4423 if (restarter.getMasterNodeId() != (int) newOrder[0])
4425 ndbout_c(
" Should be %u, failing", newOrder[0]);
4444 Uint32 numNodes = restarter.getNumDbNodes();
4445 Uint32 master = restarter.getMasterNodeId();
4455 Uint32 maxDistanceToRemoteLink = 0;
4469 for (Uint32 n=0; n < numNodes; n++)
4471 dynamicOrder.push_back(master);
4472 nodeGroup.push_back(restarter.getNodeGroup(master));
4473 master = restarter.getNextMasterNodeId(master);
4475 nodeIdToDynamicIndex.set(n, master, zero);
4479 for (Uint32 n=0; n < numNodes; n++)
4481 Uint32 nodeId = dynamicOrder[
n];
4482 Uint32 monitoredByIndex = (n+1) % numNodes;
4483 Uint32 monitorsIndex = (n+ numNodes - 1) % numNodes;
4484 monitoredByNode.push_back(dynamicOrder[monitoredByIndex]);
4485 monitorsNode.push_back(dynamicOrder[monitorsIndex]);
4486 remoteMonitored.push_back((nodeId & 1) != (monitoredByNode[n] & 1));
4487 monitorsRemote.push_back((nodeId & 1) != (monitorsNode[n] & 1));
4488 sameNGMonitored.push_back(nodeGroup[n] == nodeGroup[monitoredByIndex]);
4492 for (Uint32 n=0; n < numNodes; n++)
4494 Uint32 distanceToRemoteHBLink = 0;
4495 for (Uint32 m=0; m < numNodes; m++)
4497 if (remoteMonitored[n+m])
4499 distanceToRemoteHBLink++;
4502 distanceToRemote.push_back(distanceToRemoteHBLink);
4503 maxDistanceToRemoteLink = MAX(maxDistanceToRemoteLink, distanceToRemoteHBLink);
4507 ndbout_c(
"Dynamic order analysis");
4509 for (Uint32 n=0; n < numNodes; n++)
4511 ndbout_c(
" %u %s %u%s%u%s%u \t Monitored by %s nodegroup, Dist to remote link : %u",
4515 ((monitorsRemote[n])?
" >":
"-->"),
4517 ((remoteMonitored[n])?
" >":
"-->"),
4519 ((sameNGMonitored[n])?
"same":
"other"),
4520 distanceToRemote[n]);
4527 for (Uint32 n=0; n < numNodes; n++)
4529 Uint32 ng = nodeGroup[
n];
4531 bool ngfound =
false;
4532 for (Uint32 m = 0; m < nodeGroupMembers.size(); m++)
4534 if (nodeGroupMembers[m].ngid == ng)
4537 ngInfo.members[ngInfo.membCount++] = dynamicOrder[
n];
4546 newGroupInfo.ngid = ng;
4547 newGroupInfo.membCount = 1;
4548 newGroupInfo.members[0] = dynamicOrder[
n];
4549 nodeGroupMembers.push_back(newGroupInfo);
4553 ndbout_c(
"Nodegroups");
4555 for (Uint32 n=0; n < nodeGroupMembers.size(); n++)
4557 ndbout <<
" " << nodeGroupMembers[
n].ngid <<
" (";
4558 bool allRemoteMonitored =
true;
4559 for (Uint32 m=0; m < nodeGroupMembers[
n].membCount; m++)
4561 Uint32 nodeId = nodeGroupMembers[
n].members[m];
4563 if ((m+1) < nodeGroupMembers[
n].membCount)
4565 Uint32 dynamicIndex = nodeIdToDynamicIndex[nodeId];
4566 allRemoteMonitored &= remoteMonitored[dynamicIndex];
4568 ndbout <<
") Entirely remote monitored NGs risk : "
4569 << (allRemoteMonitored?
"Y":
"N") <<
"\n";
4573 ndbout_c(
"Cluster-split latency behaviour");
4575 Uint32 oddPresident = dynamicOrder[0];
4576 Uint32 evenPresident = dynamicOrder[0];
4578 for (Uint32 n=0; n <= maxDistanceToRemoteLink; n++)
4581 ndbout <<
" " << n <<
" HB latency period(s), nodes (";
4582 bool useComma =
false;
4583 bool presidentFailed =
false;
4584 for (Uint32 m=0; m < numNodes; m++)
4586 if (distanceToRemote[m] == n)
4588 Uint32 failingNodeId = dynamicOrder[m];
4593 ndbout << failingNodeId;
4595 if ((failingNodeId == evenPresident) ||
4596 (failingNodeId == oddPresident))
4599 presidentFailed =
true;
4603 Uint32 ng = nodeGroup[m];
4604 for (Uint32 i=0; i< nodeGroupMembers.size(); i++)
4606 if (nodeGroupMembers[i].ngid == ng)
4608 if ((--nodeGroupMembers[i].membCount) == 0)
4610 failedNodeGroups.push_back(ng);
4617 ndbout <<
") will be declared failed." << endl;
4618 if (failedNodeGroups.size() != 0)
4620 ndbout <<
" NG failure risk on reconnect for nodegroups : ";
4621 for (Uint32 i=0; i< failedNodeGroups.size(); i++)
4625 ndbout << failedNodeGroups[
i];
4629 if (presidentFailed)
4637 for (Uint32 i=0; i< numNodes; i++)
4643 bool candidateIsOdd = dynamicOrder[
i] & 1;
4647 if (candidateIsOdd ||
4648 (distanceToRemote[i] > n))
4650 newOdd = dynamicOrder[
i];
4655 if ((!candidateIsOdd) ||
4656 (distanceToRemote[
i] >
n))
4658 newEven = dynamicOrder[
i];
4663 bool oddPresidentFailed = (oddPresident != newOdd);
4664 bool evenPresidentFailed = (evenPresident != newEven);
4666 if (oddPresidentFailed)
4668 ndbout_c(
" Odd president (%u) failed, new odd president : %u",
4669 oddPresident, newOdd);
4670 oddPresident = newOdd;
4672 if (evenPresidentFailed)
4674 ndbout_c(
" Even president (%u) failed, new even president : %u",
4675 evenPresident, newEven);
4676 evenPresident = newEven;
4679 if (oddPresident != evenPresident)
4681 ndbout_c(
" President role duplicated, Odd (%u), Even (%u)",
4682 oddPresident, evenPresident);
4688 ndbout << endl << endl;
4707 int dump[] = { 9994, 1500 };
4708 restarter.dumpStateAllNodes(dump, 2);
4712 int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
4713 restarter.dumpStateAllNodes(val2, 2);
4717 restarter.insertErrorInAllNodes(938);
4723 int dumpStateArgs[] = {9990, 1};
4724 restarter.dumpStateAllNodes(dumpStateArgs, 2);
4729 ndbout_c(
"Waiting for half of cluster to die");
4730 int not_started = 0;
4731 const int node_count = restarter.getNumDbNodes();
4735 for (
int i = 0; i < node_count; i++)
4740 }
while (2 * not_started != node_count);
4742 ndbout_c(
"Restarting cluster");
4743 restarter.restartAll(
false,
true,
true);
4744 ndbout_c(
"Waiting cluster not started");
4745 restarter.waitClusterNoStart();
4747 ndbout_c(
"Starting");
4748 restarter.startAll();
4749 restarter.waitClusterStarted();
4754 NDBT_TESTSUITE(testNodeRestart);
4756 "Test that one node at a time can be stopped and then restarted "\
4757 "when there are no load on the system. Do this loop number of times"){
4758 INITIALIZER(runCheckAllNodesStarted);
4759 INITIALIZER(runLoadTable);
4761 FINALIZER(runClearTable);
4764 "Test that one node at a time can be stopped and then restarted "\
4765 "perform pk read while restarting. Do this loop number of times"){
4766 TC_PROPERTY(
"ReadLockMode", NdbOperation::LM_Read);
4767 INITIALIZER(runCheckAllNodesStarted);
4768 INITIALIZER(runLoadTable);
4770 STEP(runPkReadUntilStopped);
4771 FINALIZER(runClearTable);
4773 TESTCASE(
"PkReadCommitted",
4774 "Test that one node at a time can be stopped and then restarted "\
4775 "perform pk read while restarting. Do this loop number of times"){
4777 INITIALIZER(runCheckAllNodesStarted);
4778 INITIALIZER(runLoadTable);
4780 STEP(runPkReadUntilStopped);
4781 FINALIZER(runClearTable);
4783 TESTCASE(
"MixedPkRead",
4784 "Test that one node at a time can be stopped and then restarted "\
4785 "perform pk read while restarting. Do this loop number of times"){
4786 TC_PROPERTY(
"ReadLockMode", Uint32(-1));
4787 INITIALIZER(runCheckAllNodesStarted);
4788 INITIALIZER(runLoadTable);
4790 STEP(runPkReadUntilStopped);
4791 FINALIZER(runClearTable);
4793 TESTCASE(
"PkReadPkUpdate",
4794 "Test that one node at a time can be stopped and then restarted "\
4795 "perform pk read and pk update while restarting. Do this loop number of times"){
4796 TC_PROPERTY(
"ReadLockMode", NdbOperation::LM_Read);
4797 INITIALIZER(runCheckAllNodesStarted);
4798 INITIALIZER(runLoadTable);
4800 STEP(runPkReadUntilStopped);
4801 STEP(runPkUpdateUntilStopped);
4802 STEP(runPkReadPkUpdateUntilStopped);
4803 STEP(runPkReadUntilStopped);
4804 STEP(runPkUpdateUntilStopped);
4805 STEP(runPkReadPkUpdateUntilStopped);
4806 FINALIZER(runClearTable);
4808 TESTCASE(
"MixedPkReadPkUpdate",
4809 "Test that one node at a time can be stopped and then restarted "\
4810 "perform pk read and pk update while restarting. Do this loop number of times"){
4811 TC_PROPERTY(
"ReadLockMode", Uint32(-1));
4812 INITIALIZER(runCheckAllNodesStarted);
4813 INITIALIZER(runLoadTable);
4815 STEP(runPkReadUntilStopped);
4816 STEP(runPkUpdateUntilStopped);
4817 STEP(runPkReadPkUpdateUntilStopped);
4818 STEP(runPkReadUntilStopped);
4819 STEP(runPkUpdateUntilStopped);
4820 STEP(runPkReadPkUpdateUntilStopped);
4821 FINALIZER(runClearTable);
4823 TESTCASE(
"ReadUpdateScan",
4824 "Test that one node at a time can be stopped and then restarted "\
4825 "perform pk read, pk update and scan reads while restarting. Do this loop number of times"){
4826 INITIALIZER(runCheckAllNodesStarted);
4827 INITIALIZER(runLoadTable);
4829 STEP(runPkReadUntilStopped);
4830 STEP(runPkUpdateUntilStopped);
4831 STEP(runPkReadPkUpdateUntilStopped);
4832 STEP(runScanReadUntilStopped);
4833 STEP(runScanUpdateUntilStopped);
4834 FINALIZER(runClearTable);
4836 TESTCASE(
"MixedReadUpdateScan",
4837 "Test that one node at a time can be stopped and then restarted "\
4838 "perform pk read, pk update and scan reads while restarting. Do this loop number of times"){
4839 TC_PROPERTY(
"ReadLockMode", Uint32(-1));
4840 INITIALIZER(runCheckAllNodesStarted);
4841 INITIALIZER(runLoadTable);
4843 STEP(runPkReadUntilStopped);
4844 STEP(runPkUpdateUntilStopped);
4845 STEP(runPkReadPkUpdateUntilStopped);
4846 STEP(runScanReadUntilStopped);
4847 STEP(runScanUpdateUntilStopped);
4848 FINALIZER(runClearTable);
4851 "Test that one node at a time can be stopped and then restarted "\
4852 "perform all kind of transactions while restarting. Do this loop number of times"){
4853 INITIALIZER(runCheckAllNodesStarted);
4854 INITIALIZER(runLoadTable);
4856 STEP(runPkReadUntilStopped);
4857 STEP(runPkUpdateUntilStopped);
4858 STEP(runScanReadUntilStopped);
4859 STEP(runScanUpdateUntilStopped);
4860 FINALIZER(runClearTable);
4863 "Test that one node at a time can be stopped and then restarted "\
4864 "when db is full. Do this loop number of times"){
4865 INITIALIZER(runCheckAllNodesStarted);
4866 INITIALIZER(runFillTable);
4869 TESTCASE(
"RestartRandomNode",
4870 "Test that we can execute the restart RestartRandomNode loop\n"\
4872 INITIALIZER(runCheckAllNodesStarted);
4873 INITIALIZER(runLoadTable);
4875 FINALIZER(runScanReadVerify);
4876 FINALIZER(runClearTable);
4878 TESTCASE(
"RestartRandomNodeError",
4879 "Test that we can execute the restart RestartRandomNodeError loop\n"\
4881 INITIALIZER(runCheckAllNodesStarted);
4882 INITIALIZER(runLoadTable);
4884 FINALIZER(runScanReadVerify);
4885 FINALIZER(runClearTable);
4887 TESTCASE(
"RestartRandomNodeInitial",
4888 "Test that we can execute the restart RestartRandomNodeInitial loop\n"\
4890 INITIALIZER(runCheckAllNodesStarted);
4891 INITIALIZER(runLoadTable);
4893 FINALIZER(runScanReadVerify);
4894 FINALIZER(runClearTable);
4896 TESTCASE(
"RestartNFDuringNR",
4897 "Test that we can execute the restart RestartNFDuringNR loop\n"\
4899 INITIALIZER(runCheckAllNodesStarted);
4900 INITIALIZER(runLoadTable);
4902 STEP(runPkUpdateUntilStopped);
4903 STEP(runScanUpdateUntilStopped);
4904 FINALIZER(runScanReadVerify);
4905 FINALIZER(runClearTable);
4907 TESTCASE(
"RestartMasterNodeError",
4908 "Test that we can execute the restart RestartMasterNodeError loop\n"\
4910 INITIALIZER(runCheckAllNodesStarted);
4911 INITIALIZER(runLoadTable);
4913 FINALIZER(runScanReadVerify);
4914 FINALIZER(runClearTable);
4917 TESTCASE(
"TwoNodeFailure",
4918 "Test that we can execute the restart TwoNodeFailure\n"\
4919 "(which is a multiple node failure restart) loop\n"\
4921 INITIALIZER(runCheckAllNodesStarted);
4922 INITIALIZER(runLoadTable);
4924 FINALIZER(runScanReadVerify);
4925 FINALIZER(runClearTable);
4927 TESTCASE(
"TwoMasterNodeFailure",
4928 "Test that we can execute the restart TwoMasterNodeFailure\n"\
4929 "(which is a multiple node failure restart) loop\n"\
4931 INITIALIZER(runCheckAllNodesStarted);
4932 INITIALIZER(runLoadTable);
4934 FINALIZER(runScanReadVerify);
4935 FINALIZER(runClearTable);
4937 TESTCASE(
"FiftyPercentFail",
4938 "Test that we can execute the restart FiftyPercentFail\n"\
4939 "(which is a multiple node failure restart) loop\n"\
4941 INITIALIZER(runCheckAllNodesStarted);
4942 INITIALIZER(runLoadTable);
4944 FINALIZER(runScanReadVerify);
4945 FINALIZER(runClearTable);
4947 TESTCASE(
"RestartAllNodes",
4948 "Test that we can execute the restart RestartAllNodes\n"\
4949 "(which is a system restart) loop\n"\
4951 INITIALIZER(runCheckAllNodesStarted);
4952 INITIALIZER(runLoadTable);
4954 FINALIZER(runScanReadVerify);
4955 FINALIZER(runClearTable);
4957 TESTCASE(
"RestartAllNodesAbort",
4958 "Test that we can execute the restart RestartAllNodesAbort\n"\
4959 "(which is a system restart) loop\n"\
4961 INITIALIZER(runCheckAllNodesStarted);
4962 INITIALIZER(runLoadTable);
4964 FINALIZER(runScanReadVerify);
4965 FINALIZER(runClearTable);
4967 TESTCASE(
"RestartAllNodesError9999",
4968 "Test that we can execute the restart RestartAllNodesError9999\n"\
4969 "(which is a system restart) loop\n"\
4971 INITIALIZER(runCheckAllNodesStarted);
4972 INITIALIZER(runLoadTable);
4974 FINALIZER(runScanReadVerify);
4975 FINALIZER(runClearTable);
4977 TESTCASE(
"FiftyPercentStopAndWait",
4978 "Test that we can execute the restart FiftyPercentStopAndWait\n"\
4979 "(which is a system restart) loop\n"\
4981 INITIALIZER(runCheckAllNodesStarted);
4982 INITIALIZER(runLoadTable);
4984 FINALIZER(runScanReadVerify);
4985 FINALIZER(runClearTable);
4987 TESTCASE(
"RestartNodeDuringLCP",
4988 "Test that we can execute the restart RestartRandomNode loop\n"\
4990 INITIALIZER(runCheckAllNodesStarted);
4991 INITIALIZER(runLoadTable);
4993 STEP(runPkUpdateUntilStopped);
4994 STEP(runScanUpdateUntilStopped);
4995 FINALIZER(runScanReadVerify);
4996 FINALIZER(runClearTable);
4998 TESTCASE(
"StopOnError",
4999 "Test StopOnError. A node that has StopOnError set to false "\
5000 "should restart automatically when an error occurs"){
5001 INITIALIZER(runCheckAllNodesStarted);
5002 INITIALIZER(runLoadTable);
5004 FINALIZER(runScanReadVerify);
5005 FINALIZER(runClearTable);
5007 TESTCASE(
"CommittedRead",
5008 "Test committed read"){
5009 INITIALIZER(runLoadTable);
5011 FINALIZER(runClearTable);
5013 TESTCASE(
"LateCommit",
5014 "Test commit after node failure"){
5015 INITIALIZER(runLoadTable);
5016 STEP(runLateCommit);
5017 FINALIZER(runClearTable);
5019 TESTCASE(
"Bug15587",
5020 "Test bug with NF during NR"){
5021 INITIALIZER(runLoadTable);
5022 STEP(runScanUpdateUntilStopped);
5024 FINALIZER(runClearTable);
5026 TESTCASE(
"Bug15632",
5027 "Test bug with NF during NR"){
5028 INITIALIZER(runLoadTable);
5030 FINALIZER(runClearTable);
5032 TESTCASE(
"Bug15685",
5033 "Test bug with NF during abort"){
5035 FINALIZER(runClearTable);
5037 TESTCASE(
"Bug16772",
5038 "Test bug with restarting before NF handling is complete"){
5041 TESTCASE(
"Bug18414",
5042 "Test bug with NF during NR"){
5043 INITIALIZER(runLoadTable);
5045 FINALIZER(runClearTable);
5047 TESTCASE(
"Bug18612",
5048 "Test bug with partitioned clusters"){
5049 INITIALIZER(runLoadTable);
5051 FINALIZER(runClearTable);
5053 TESTCASE(
"Bug18612SR",
5054 "Test bug with partitioned clusters"){
5055 INITIALIZER(runLoadTable);
5056 STEP(runBug18612SR);
5057 FINALIZER(runClearTable);
5059 TESTCASE(
"Bug20185",
5061 INITIALIZER(runLoadTable);
5063 FINALIZER(runClearTable);
5065 TESTCASE(
"Bug24543",
"")
5067 INITIALIZER(runBug24543);
5069 TESTCASE(
"Bug21271",
5071 INITIALIZER(runLoadTable);
5073 STEP(runPkUpdateUntilStopped);
5074 FINALIZER(runClearTable);
5076 TESTCASE(
"Bug24717",
""){
5077 INITIALIZER(runBug24717);
5079 TESTCASE(
"Bug25364",
""){
5080 INITIALIZER(runBug25364);
5082 TESTCASE(
"Bug25468",
""){
5083 INITIALIZER(runBug25468);
5085 TESTCASE(
"Bug25554",
""){
5086 INITIALIZER(runBug25554);
5088 TESTCASE(
"Bug25984",
""){
5089 INITIALIZER(runBug25984);
5091 TESTCASE(
"Bug26457",
""){
5092 INITIALIZER(runBug26457);
5094 TESTCASE(
"Bug26481",
""){
5095 INITIALIZER(runBug26481);
5097 TESTCASE(
"Bug26450",
""){
5098 INITIALIZER(runLoadTable);
5099 INITIALIZER(runBug26450);
5101 TESTCASE(
"Bug27003",
""){
5102 INITIALIZER(runBug27003);
5104 TESTCASE(
"Bug27283",
""){
5105 INITIALIZER(runBug27283);
5107 TESTCASE(
"Bug27466",
""){
5108 INITIALIZER(runBug27466);
5110 TESTCASE(
"Bug28023",
""){
5111 INITIALIZER(runBug28023);
5113 TESTCASE(
"Bug28717",
""){
5114 INITIALIZER(runBug28717);
5116 TESTCASE(
"Bug31980",
""){
5117 INITIALIZER(runBug31980);
5119 TESTCASE(
"Bug29364",
""){
5120 INITIALIZER(runBug29364);
5122 TESTCASE(
"GCP",
""){
5123 INITIALIZER(runLoadTable);
5125 STEP(runScanUpdateUntilStopped);
5126 FINALIZER(runClearTable);
5128 TESTCASE(
"CommitAck",
""){
5129 INITIALIZER(runCommitAck);
5130 FINALIZER(runClearTable);
5132 TESTCASE(
"Bug32160",
""){
5133 INITIALIZER(runBug32160);
5135 TESTCASE(
"pnr",
"Parallel node restart")
5137 TC_PROPERTY(
"ScanUpdateNoRowCountCheck", 1);
5138 INITIALIZER(runLoadTable);
5139 INITIALIZER(runCreateBigTable);
5140 STEP(runScanUpdateUntilStopped);
5141 STEP(runDeleteInsertUntilStopped);
5143 FINALIZER(runClearTable);
5144 FINALIZER(runDropBigTable);
5146 TESTCASE(
"pnr_lcp",
"Parallel node restart")
5148 TC_PROPERTY(
"LCP", 1);
5149 TC_PROPERTY(
"ScanUpdateNoRowCountCheck", 1);
5150 INITIALIZER(runLoadTable);
5151 INITIALIZER(runCreateBigTable);
5152 STEP(runScanUpdateUntilStopped);
5153 STEP(runDeleteInsertUntilStopped);
5155 FINALIZER(runClearTable);
5156 FINALIZER(runDropBigTable);
5158 TESTCASE(
"Bug32922",
""){
5159 INITIALIZER(runBug32922);
5161 TESTCASE(
"Bug34216",
""){
5162 INITIALIZER(runCheckAllNodesStarted);
5163 INITIALIZER(runLoadTable);
5165 FINALIZER(runClearTable);
5167 TESTCASE(
"mixedmultiop",
""){
5168 TC_PROPERTY(
"MULTI_OP", 5);
5169 INITIALIZER(runCheckAllNodesStarted);
5170 INITIALIZER(runLoadTable);
5172 STEP(runPkUpdateUntilStopped);
5173 STEP(runPkUpdateUntilStopped);
5174 FINALIZER(runClearTable);
5176 TESTCASE(
"Bug34702",
""){
5177 INITIALIZER(runBug34702);
5179 TESTCASE(
"MNF",
""){
5180 INITIALIZER(runLoadTable);
5182 STEP(runScanUpdateUntilStopped);
5184 TESTCASE(
"Bug36199",
""){
5185 INITIALIZER(runBug36199);
5187 TESTCASE(
"Bug36246",
""){
5188 INITIALIZER(runLoadTable);
5190 VERIFIER(runClearTable);
5192 TESTCASE(
"Bug36247",
""){
5193 INITIALIZER(runLoadTable);
5195 VERIFIER(runClearTable);
5197 TESTCASE(
"Bug36276",
""){
5198 INITIALIZER(runLoadTable);
5200 VERIFIER(runClearTable);
5202 TESTCASE(
"Bug36245",
""){
5203 INITIALIZER(runLoadTable);
5205 VERIFIER(runClearTable);
5207 TESTCASE(
"NF_Hammer",
""){
5208 TC_PROPERTY(
"Sleep0", 9000);
5209 TC_PROPERTY(
"Sleep1", 3000);
5210 TC_PROPERTY(
"Rand", 1);
5211 INITIALIZER(runLoadTable);
5212 STEPS(runHammer, 25);
5214 VERIFIER(runClearTable);
5216 TESTCASE(
"Bug41295",
"")
5218 TC_PROPERTY(
"Threads", 25);
5219 INITIALIZER(runLoadTable);
5220 STEPS(runMixedLoad, 25);
5222 FINALIZER(runClearTable);
5224 TESTCASE(
"Bug41469",
""){
5225 INITIALIZER(runLoadTable);
5227 STEP(runScanUpdateUntilStopped);
5228 FINALIZER(runClearTable);
5230 TESTCASE(
"Bug42422",
""){
5231 INITIALIZER(runBug42422);
5233 TESTCASE(
"Bug43224",
""){
5234 INITIALIZER(runBug43224);
5236 TESTCASE(
"Bug58453",
"")
5238 INITIALIZER(runBug58453);
5240 TESTCASE(
"Bug43888",
""){
5241 INITIALIZER(runBug43888);
5243 TESTCASE(
"Bug44952",
5244 "Test that we can execute the restart RestartNFDuringNR loop\n" \
5246 INITIALIZER(runCheckAllNodesStarted);
5247 INITIALIZER(runLoadTable);
5249 STEP(runPkUpdateUntilStopped);
5250 STEP(runScanUpdateUntilStopped);
5251 FINALIZER(runScanReadVerify);
5252 FINALIZER(runClearTable);
5254 TESTCASE(
"Bug48474",
"")
5256 INITIALIZER(runLoadTable);
5257 INITIALIZER(initBug48474);
5259 STEP(runScanUpdateUntilStopped);
5260 FINALIZER(cleanupBug48474);
5262 TESTCASE(
"MixReadUnlockRestart",
5263 "Run mixed read+unlock and update transactions"){
5264 INITIALIZER(runCheckAllNodesStarted);
5265 INITIALIZER(runLoadTable);
5266 STEP(runPkReadPkUpdateUntilStopped);
5267 STEP(runPkReadPkUpdatePkUnlockUntilStopped);
5268 STEP(runPkReadPkUpdatePkUnlockUntilStopped);
5270 FINALIZER(runClearTable);
5272 TESTCASE(
"Bug56044",
"")
5274 INITIALIZER(runBug56044);
5276 TESTCASE(
"Bug57767",
"")
5278 INITIALIZER(runLoadTable);
5279 INITIALIZER(runBug57767)
5281 TESTCASE(
"Bug57522",
"")
5283 INITIALIZER(runBug57522);
5285 TESTCASE(
"ForceStopAndRestart",
"Test restart and stop -with force flag")
5287 STEP(runForceStopAndRestart);
5289 TESTCASE(
"ClusterSplitLatency",
5290 "Test behaviour of 2-replica cluster with latency between halves")
5292 TC_PROPERTY(
"DynamicOrder", Uint32(9));
5293 INITIALIZER(runRestartToDynamicOrder);
5294 INITIALIZER(analyseDynamicOrder);
5295 INITIALIZER(runSplitLatency25PctFail);
5297 NDBT_TESTSUITE_END(testNodeRestart);
5299 int main(
int argc,
const char** argv){
5301 NDBT_TESTSUITE_INSTANCE(testNodeRestart);
5308 testNodeRestart.setDefaultLoops(1000);
5310 return testNodeRestart.execute(argc, argv);