19 #include <NDBT_Test.hpp> 
   20 #include <HugoTransactions.hpp> 
   21 #include <UtilTransactions.hpp> 
   22 #include <NdbRestarter.hpp> 
   24 #include <signaldata/DumpStateOrd.hpp> 
   25 #include <NdbBackup.hpp> 
   26 #include <Bitmask.hpp> 
   30   int records = ctx->getNumRecords();
 
   32   if (hugoTrans.loadTable(GETNDB(step), records) != 0){
 
   41   NdbBackup backup(GETNDB(step)->getNodeId());
 
   42   backup.clearOldBackups();
 
   46 #define CHECK(b) if (!(b)) { \ 
   47   g_err << "ERR: "<< step->getName() \ 
   48          << " failed on line " << __LINE__ << endl; \ 
   49   result = NDBT_FAILED; \ 
   53   Ndb* pNdb = GETNDB(step);
 
   56   Uint32 loops = ctx->getNumLoops();
 
   57   int records = ctx->getNumRecords();
 
   64   while(i<=loops && result != NDBT_FAILED){
 
   66     ndbout << 
"Loop " << i << 
"/"<< loops <<
" started" << endl;
 
   81     ndbout << 
"Loading records..." << endl;
 
   82     CHECK(hugoTrans.loadTable(pNdb, records) == 0);
 
   84     ndbout << 
"Restarting cluster" << endl;
 
   85     CHECK(restarter.restartAll() == 0);
 
   86     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
   89     ndbout << 
"Verifying records..." << endl;
 
   90     CHECK(hugoTrans.pkReadRecords(pNdb, records) == 0);
 
   91     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
   92     CHECK(count == records);
 
   94     ndbout << 
"Updating records..." << endl;
 
   95     CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
 
   97     ndbout << 
"Restarting cluster..." << endl;
 
   98     CHECK(restarter.restartAll() == 0);
 
   99     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  102     ndbout << 
"Verifying records..." << endl;
 
  103     CHECK(hugoTrans.pkReadRecords(pNdb, records) == 0);
 
  104     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  105     CHECK(count == records);
 
  107     ndbout << 
"Deleting 50% of records..." << endl;
 
  108     CHECK(hugoTrans.pkDelRecords(pNdb, records/2) == 0);
 
  110     ndbout << 
"Restarting cluster..." << endl;
 
  111     CHECK(restarter.restartAll() == 0);
 
  112     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  115     ndbout << 
"Verifying records..." << endl;
 
  116     CHECK(hugoTrans.scanReadRecords(pNdb, records/2, 0, 64) == 0);
 
  117     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  118     CHECK(count == (records/2));
 
  120     ndbout << 
"Deleting all records..." << endl;
 
  121     CHECK(utilTrans.clearTable(pNdb, records/2) == 0);
 
  123     ndbout << 
"Restarting cluster..." << endl;
 
  124     CHECK(restarter.restartAll() == 0);
 
  125     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  128     ndbout << 
"Verifying records..." << endl;
 
  129     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  132     ndbout << 
"Doing it all..." << endl;
 
  133     CHECK(hugoTrans.loadTable(pNdb, records) == 0);
 
  134     CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
 
  135     CHECK(hugoTrans.pkDelRecords(pNdb, records/2) == 0);
 
  136     CHECK(hugoTrans.scanUpdateRecords(pNdb, records/2) == 0);
 
  137     CHECK(utilTrans.clearTable(pNdb, records) == 0);
 
  138     CHECK(hugoTrans.loadTable(pNdb, records) == 0);
 
  139     CHECK(utilTrans.clearTable(pNdb, records) == 0);
 
  140     CHECK(hugoTrans.loadTable(pNdb, records) == 0);
 
  141     CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
 
  142     CHECK(utilTrans.clearTable(pNdb, records) == 0);
 
  144     ndbout << 
"Restarting cluster..." << endl;
 
  145     CHECK(restarter.restartAll() == 0);
 
  146     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  149     ndbout << 
"Verifying records..." << endl;
 
  150     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  153     ndbout << 
"Doing it all..." << endl;
 
  154     CHECK(hugoTrans.loadTable(pNdb, records) == 0);
 
  155     CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
 
  156     CHECK(hugoTrans.pkDelRecords(pNdb, records/2) == 0);
 
  157     CHECK(hugoTrans.scanUpdateRecords(pNdb, records/2) == 0);
 
  158     CHECK(utilTrans.clearTable(pNdb, records) == 0);
 
  159     CHECK(hugoTrans.loadTable(pNdb, records) == 0);
 
  160     CHECK(utilTrans.clearTable(pNdb, records) == 0);
 
  162     ndbout << 
"Restarting cluster with error insert 5020..." << endl;
 
  163     CHECK(restarter.restartAll(
false, 
true) == 0);
 
  164     CHECK(restarter.waitClusterNoStart(timeout) == 0);
 
  165     CHECK(restarter.insertErrorInAllNodes(5020) == 0);
 
  166     CHECK(restarter.startAll() == 0);
 
  167     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  173   ndbout << 
"runSystemRestart1 finished" << endl;  
 
  179   Ndb* pNdb = GETNDB(step);
 
  180   int result = NDBT_OK;
 
  183   Uint32 loops = ctx->getNumLoops();
 
  184   int records = ctx->getNumRecords();
 
  191   while(i<=loops && result != NDBT_FAILED && !ctx->isTestStopped()){
 
  193     ndbout << 
"Loop " << i << 
"/"<< loops <<
" started" << endl;
 
  206     int val = DumpStateOrd::DihMinTimeBetweenLCP;
 
  207     CHECK(restarter.dumpStateAllNodes(&val, 1) == 0);
 
  209     ndbout << 
"Loading records..." << endl;
 
  210     CHECK(hugoTrans.loadTable(pNdb, records) == 0);
 
  212     ndbout << 
"Restarting cluster" << endl;
 
  213     CHECK(restarter.restartAll() == 0);
 
  214     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  216       int val = DumpStateOrd::DihMinTimeBetweenLCP;
 
  217       CHECK(restarter.dumpStateAllNodes(&val, 1) == 0);
 
  221     ndbout << 
"Verifying records..." << endl;
 
  222     CHECK(hugoTrans.pkReadRecords(pNdb, records) == 0);
 
  223     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  224     CHECK(count == records);
 
  226     ndbout << 
"Updating records..." << endl;
 
  227     CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
 
  229     ndbout << 
"Restarting cluster..." << endl;
 
  230     CHECK(restarter.restartAll() == 0);
 
  231     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  233       int val = DumpStateOrd::DihMinTimeBetweenLCP;
 
  234       CHECK(restarter.dumpStateAllNodes(&val, 1) == 0);
 
  238     ndbout << 
"Verifying records..." << endl;
 
  239     CHECK(hugoTrans.pkReadRecords(pNdb, records) == 0);
 
  240     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  241     CHECK(count == records);
 
  243     ndbout << 
"Deleting 50% of records..." << endl;
 
  244     CHECK(hugoTrans.pkDelRecords(pNdb, records/2) == 0);
 
  246     ndbout << 
"Restarting cluster..." << endl;
 
  247     CHECK(restarter.restartAll() == 0);
 
  248     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  250       int val = DumpStateOrd::DihMinTimeBetweenLCP;
 
  251       CHECK(restarter.dumpStateAllNodes(&val, 1) == 0);
 
  255     ndbout << 
"Verifying records..." << endl;
 
  256     CHECK(hugoTrans.scanReadRecords(pNdb, records/2, 0, 64) == 0);
 
  257     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  258     CHECK(count == (records/2));
 
  260     ndbout << 
"Deleting all records..." << endl;
 
  261     CHECK(utilTrans.clearTable(pNdb, records/2) == 0);
 
  263     ndbout << 
"Restarting cluster..." << endl;
 
  264     CHECK(restarter.restartAll() == 0);
 
  265     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  267       int val = DumpStateOrd::DihMinTimeBetweenLCP;
 
  268       CHECK(restarter.dumpStateAllNodes(&val, 1) == 0);
 
  272     ndbout << 
"Verifying records..." << endl;
 
  273     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  276     ndbout << 
"Doing it all..." << endl;
 
  277     CHECK(hugoTrans.loadTable(pNdb, records) == 0);
 
  278     CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
 
  279     CHECK(hugoTrans.pkDelRecords(pNdb, records/2) == 0);
 
  280     CHECK(hugoTrans.scanUpdateRecords(pNdb, records/2) == 0);
 
  281     CHECK(utilTrans.clearTable(pNdb, records) == 0);
 
  282     CHECK(hugoTrans.loadTable(pNdb, records) == 0);
 
  283     CHECK(utilTrans.clearTable(pNdb, records) == 0);
 
  284     CHECK(hugoTrans.loadTable(pNdb, records) == 0);
 
  285     CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
 
  286     CHECK(utilTrans.clearTable(pNdb, records) == 0);
 
  288     ndbout << 
"Restarting cluster..." << endl;
 
  289     CHECK(restarter.restartAll() == 0);
 
  290     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  292       int val = DumpStateOrd::DihMinTimeBetweenLCP;
 
  293       CHECK(restarter.dumpStateAllNodes(&val, 1) == 0);
 
  297     ndbout << 
"Verifying records..." << endl;
 
  298     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  304   ndbout << 
"runSystemRestart2 finished" << endl;  
 
  310   Ndb* pNdb = GETNDB(step);
 
  311   int result = NDBT_OK;
 
  313   Uint32 loops = ctx->getNumLoops();
 
  314   int records = ctx->getNumRecords();
 
  325   while(i<=loops && result != NDBT_FAILED){
 
  327     ndbout << 
"Loop " << i << 
"/"<< loops <<
" started" << endl;
 
  336     ndbout << 
"Dump state: "<<dump7080[0]<<
", "<<dump7080[1]<<endl;
 
  337     CHECK(restarter.dumpStateAllNodes(dump7080, 2) == 0);    
 
  338     NdbSleep_SecSleep(10);
 
  340     ndbout << 
"Doing it all..." << endl;
 
  341     CHECK(hugoTrans.loadTable(pNdb, records) == 0);
 
  342     CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
 
  343     CHECK(hugoTrans.pkDelRecords(pNdb, records/2) == 0);
 
  344     CHECK(hugoTrans.scanUpdateRecords(pNdb, records/2) == 0);
 
  345     CHECK(utilTrans.clearTable(pNdb, records) == 0);
 
  346     CHECK(hugoTrans.loadTable(pNdb, records) == 0);
 
  347     CHECK(utilTrans.clearTable(pNdb, records) == 0);
 
  350     CHECK(restarter.insertErrorInAllNodes(0) == 0);
 
  351     NdbSleep_SecSleep(60);
 
  353     ndbout << 
"Restarting cluster..." << endl;
 
  354     CHECK(restarter.restartAll() == 0);
 
  355     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  358     ndbout << 
"Verifying records..." << endl;
 
  359     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  364     ndbout << 
"Dump state: "<<dump7080[0]<<
", "<<dump7080[1]<<endl;
 
  365     CHECK(restarter.dumpStateAllNodes(dump7080, 2) == 0);
 
  366     NdbSleep_SecSleep(10);
 
  368     ndbout << 
"Doing it all, delete 50%..." << endl;
 
  369     CHECK(hugoTrans.loadTable(pNdb, records) == 0);
 
  370     CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
 
  371     CHECK(hugoTrans.pkDelRecords(pNdb, records/2) == 0);
 
  374     CHECK(restarter.insertErrorInAllNodes(0) == 0);
 
  375     NdbSleep_SecSleep(20);
 
  377     ndbout << 
"Restarting cluster..." << endl;
 
  378     CHECK(restarter.restartAll() == 0);
 
  379     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  382     ndbout << 
"Verifying records..." << endl;
 
  383     CHECK(hugoTrans.scanReadRecords(pNdb, records/2, 0, 64) == 0);
 
  384     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  385     CHECK(count == (records/2));
 
  386     CHECK(utilTrans.clearTable(pNdb, records) == 0);
 
  391   ndbout << 
"runSystemRestartTestUndoLog finished" << endl;  
 
  397   Ndb* pNdb = GETNDB(step);
 
  398   int result = NDBT_OK;
 
  400   Uint32 loops = ctx->getNumLoops();
 
  407   while(i<=loops && result != NDBT_FAILED){
 
  409     ndbout << 
"Loop " << i << 
"/"<< loops <<
" started" << endl;
 
  414     ndbout << 
"Filling up table..." << endl;
 
  415     CHECK(hugoTrans.fillTable(pNdb) == 0);
 
  416     CHECK(utilTrans.selectCount(pNdb, 64, &count1) == 0);
 
  417     ndbout << 
"Db is full. Table has "<<count1 <<
" records."<< endl;
 
  419     ndbout << 
"Restarting cluster" << endl;
 
  420     CHECK(restarter.restartAll() == 0);
 
  421     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  424     ndbout << 
"Verifying records..." << endl;
 
  425     CHECK(hugoTrans.scanReadRecords(pNdb, count1) == 0);
 
  426     CHECK(utilTrans.selectCount(pNdb, 64, &count2) == 0);
 
  427     CHECK(count1 == count2);
 
  429     ndbout << 
"Deleting all records..." << endl;
 
  430     CHECK(utilTrans.clearTable2(pNdb, count1) == 0);
 
  432     ndbout << 
"Restarting cluster..." << endl;
 
  433     CHECK(restarter.restartAll() == 0);
 
  434     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  437     ndbout << 
"Verifying records..." << endl;
 
  438     CHECK(utilTrans.selectCount(pNdb, 64, &count1) == 0);
 
  444   ndbout << 
"runSystemRestartTestFullDb finished" << endl;  
 
  450   Ndb* pNdb = GETNDB(step);
 
  451   int result = NDBT_OK;
 
  453   Uint32 loops = ctx->getNumLoops();
 
  454   int records = ctx->getNumRecords();
 
  459   const Uint32 nodeCount = restarter.getNumDbNodes();
 
  461     g_info << 
"SR3 - Needs atleast 2 nodes to test" << endl;
 
  466   for(i = 0; i<nodeCount; i++)
 
  467     nodeIds.push_back(restarter.getDbNodeId(i));
 
  469   Uint32 currentRestartNodeIndex = 0;
 
  473   while(i<=loops && result != NDBT_FAILED){
 
  475     g_info << 
"Loop " << i << 
"/"<< loops <<
" started" << endl;
 
  488     g_info << 
"Loading records..." << endl;
 
  489     CHECK(hugoTrans.loadTable(pNdb, records) == 0);
 
  492     g_info << 
"1 - Stopping one node" << endl;
 
  493     CHECK(restarter.restartOneDbNode(nodeIds[currentRestartNodeIndex],
 
  497     currentRestartNodeIndex = (currentRestartNodeIndex + 1 ) % nodeCount;
 
  499     g_info << 
"Updating records..." << endl;
 
  500     CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
 
  502     g_info << 
"Restarting cluster..." << endl;
 
  503     CHECK(restarter.restartAll() == 0);
 
  504     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  507     g_info << 
"Verifying records..." << endl;
 
  508     CHECK(hugoTrans.pkReadRecords(pNdb, records) == 0);
 
  509     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  510     CHECK(count == records);
 
  512     g_info << 
"2 - Stopping one node" << endl;
 
  513     CHECK(restarter.restartOneDbNode(nodeIds[currentRestartNodeIndex],
 
  517     currentRestartNodeIndex = (currentRestartNodeIndex + 1 ) % nodeCount;
 
  519     g_info << 
"Deleting 50% of records..." << endl;
 
  520     CHECK(hugoTrans.pkDelRecords(pNdb, records/2) == 0);
 
  522     g_info << 
"Restarting cluster..." << endl;
 
  523     CHECK(restarter.restartAll() == 0);
 
  524     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  527     g_info << 
"Verifying records..." << endl;
 
  528     CHECK(hugoTrans.scanReadRecords(pNdb, records/2, 0, 64) == 0);
 
  529     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  530     CHECK(count == (records/2));
 
  532     g_info << 
"3 - Stopping one node" << endl;
 
  533     CHECK(restarter.restartOneDbNode(nodeIds[currentRestartNodeIndex],
 
  537     currentRestartNodeIndex = (currentRestartNodeIndex + 1 ) % nodeCount;
 
  538     g_info << 
"Deleting all records..." << endl;
 
  539     CHECK(utilTrans.clearTable(pNdb, records/2) == 0);
 
  541     g_info << 
"Restarting cluster..." << endl;
 
  542     CHECK(restarter.restartAll() == 0);
 
  543     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  546     ndbout << 
"Verifying records..." << endl;
 
  547     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  553   g_info << 
"runSystemRestart3 finished" << endl;  
 
  559   Ndb* pNdb = GETNDB(step);
 
  560   int result = NDBT_OK;
 
  562   Uint32 loops = ctx->getNumLoops();
 
  563   int records = ctx->getNumRecords();
 
  568   const Uint32 nodeCount = restarter.getNumDbNodes();
 
  570     g_info << 
"SR4 - Needs atleast 2 nodes to test" << endl;
 
  575   for(i = 0; i<nodeCount; i++)
 
  576     nodeIds.push_back(restarter.getDbNodeId(i));
 
  578   Uint32 currentRestartNodeIndex = 0;
 
  583     int val = DumpStateOrd::DihMinTimeBetweenLCP;
 
  584     if(restarter.dumpStateAllNodes(&val, 1) != 0){
 
  585       g_err << 
"ERR: "<< step->getName() 
 
  586             << 
" failed on line " << __LINE__ << endl; 
 
  591   while(i<=loops && result != NDBT_FAILED){
 
  593     g_info << 
"Loop " << i << 
"/"<< loops <<
" started" << endl;
 
  606     g_info << 
"Loading records..." << endl;
 
  607     CHECK(hugoTrans.loadTable(pNdb, records) == 0);
 
  610     g_info << 
"1 - Stopping one node" << endl;
 
  611     CHECK(restarter.restartOneDbNode(nodeIds[currentRestartNodeIndex],
 
  615     currentRestartNodeIndex = (currentRestartNodeIndex + 1 ) % nodeCount;
 
  617     g_info << 
"Updating records..." << endl;
 
  618     CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
 
  620     g_info << 
"Restarting cluster..." << endl;
 
  621     CHECK(restarter.restartAll() == 0);
 
  622     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  624       int val = DumpStateOrd::DihMinTimeBetweenLCP;
 
  625       CHECK(restarter.dumpStateAllNodes(&val, 1) == 0);
 
  629     g_info << 
"Verifying records..." << endl;
 
  630     CHECK(hugoTrans.pkReadRecords(pNdb, records) == 0);
 
  631     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  632     CHECK(count == records);
 
  634     g_info << 
"2 - Stopping one node" << endl;
 
  635     CHECK(restarter.restartOneDbNode(nodeIds[currentRestartNodeIndex],
 
  639     currentRestartNodeIndex = (currentRestartNodeIndex + 1 ) % nodeCount;
 
  641     g_info << 
"Deleting 50% of records..." << endl;
 
  642     CHECK(hugoTrans.pkDelRecords(pNdb, records/2) == 0);
 
  644     g_info << 
"Restarting cluster..." << endl;
 
  645     CHECK(restarter.restartAll() == 0);
 
  646     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  648       int val = DumpStateOrd::DihMinTimeBetweenLCP;
 
  649       CHECK(restarter.dumpStateAllNodes(&val, 1) == 0);
 
  653     g_info << 
"Verifying records..." << endl;
 
  654     CHECK(hugoTrans.scanReadRecords(pNdb, records/2, 0, 64) == 0);
 
  655     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  656     CHECK(count == (records/2));
 
  658     g_info << 
"3 - Stopping one node" << endl;
 
  659     CHECK(restarter.restartOneDbNode(nodeIds[currentRestartNodeIndex],
 
  663     currentRestartNodeIndex = (currentRestartNodeIndex + 1 ) % nodeCount;
 
  664     g_info << 
"Deleting all records..." << endl;
 
  665     CHECK(utilTrans.clearTable(pNdb, records/2) == 0);
 
  667     g_info << 
"Restarting cluster..." << endl;
 
  668     CHECK(restarter.restartAll() == 0);
 
  669     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  671       int val = DumpStateOrd::DihMinTimeBetweenLCP;
 
  672       CHECK(restarter.dumpStateAllNodes(&val, 1) == 0);
 
  676     ndbout << 
"Verifying records..." << endl;
 
  677     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  683   g_info << 
"runSystemRestart4 finished" << endl;  
 
  689   Ndb* pNdb = GETNDB(step);
 
  690   int result = NDBT_OK;
 
  692   Uint32 loops = ctx->getNumLoops();
 
  693   int records = ctx->getNumRecords();
 
  698   const Uint32 nodeCount = restarter.getNumDbNodes();
 
  700     g_info << 
"SR5 - Needs atleast 2 nodes to test" << endl;
 
  705   for(i = 0; i<nodeCount; i++)
 
  706     nodeIds.push_back(restarter.getDbNodeId(i));
 
  708   Uint32 currentRestartNodeIndex = 0;
 
  713     int val = DumpStateOrd::DihMinTimeBetweenLCP;
 
  714     if(restarter.dumpStateAllNodes(&val, 1) != 0){
 
  715       g_err << 
"ERR: "<< step->getName() 
 
  716             << 
" failed on line " << __LINE__ << endl; 
 
  721   while(i<=loops && result != NDBT_FAILED){
 
  723     g_info << 
"Loop " << i << 
"/"<< loops <<
" started" << endl;
 
  736     g_info << 
"Loading records..." << endl;
 
  737     hugoTrans.loadTable(pNdb, records);
 
  740     g_info << 
"1 - Stopping one node" << endl;
 
  741     CHECK(restarter.restartOneDbNode(nodeIds[currentRestartNodeIndex],
 
  745     currentRestartNodeIndex = (currentRestartNodeIndex + 1 ) % nodeCount;
 
  747     g_info << 
"Updating records..." << endl;
 
  748     hugoTrans.pkUpdateRecords(pNdb, records);
 
  750     g_info << 
"Restarting cluster..." << endl;
 
  751     CHECK(restarter.restartAll(
false, 
false, 
true) == 0);
 
  752     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  754       int val = DumpStateOrd::DihMinTimeBetweenLCP;
 
  755       CHECK(restarter.dumpStateAllNodes(&val, 1) == 0);
 
  759     g_info << 
"Verifying records..." << endl;
 
  760     hugoTrans.pkReadRecords(pNdb, records);
 
  761     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  764     g_info << 
"2 - Stopping one node" << endl;
 
  765     CHECK(restarter.restartOneDbNode(nodeIds[currentRestartNodeIndex],
 
  769     currentRestartNodeIndex = (currentRestartNodeIndex + 1 ) % nodeCount;
 
  771     g_info << 
"Deleting 50% of records..." << endl;
 
  772     hugoTrans.pkDelRecords(pNdb, records/2);
 
  774     g_info << 
"Restarting cluster..." << endl;
 
  775     CHECK(restarter.restartAll(
false, 
false, 
true) == 0);
 
  776     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  778       int val = DumpStateOrd::DihMinTimeBetweenLCP;
 
  779       CHECK(restarter.dumpStateAllNodes(&val, 1) == 0);
 
  783     g_info << 
"Verifying records..." << endl;
 
  784     hugoTrans.scanReadRecords(pNdb, records/2, 0, 64);
 
  785     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  788     g_info << 
"3 - Stopping one node" << endl;
 
  789     CHECK(restarter.restartOneDbNode(nodeIds[currentRestartNodeIndex],
 
  793     currentRestartNodeIndex = (currentRestartNodeIndex + 1 ) % nodeCount;
 
  794     g_info << 
"Deleting all records..." << endl;
 
  795     utilTrans.clearTable(pNdb, records/2);
 
  797     g_info << 
"Restarting cluster..." << endl;
 
  798     CHECK(restarter.restartAll(
false, 
false, 
true) == 0);
 
  799     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  801       int val = DumpStateOrd::DihMinTimeBetweenLCP;
 
  802       CHECK(restarter.dumpStateAllNodes(&val, 1) == 0);
 
  806     ndbout << 
"Verifying records..." << endl;
 
  807     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  810     CHECK(utilTrans.clearTable(pNdb) == 0);    
 
  814   g_info << 
"runSystemRestart5 finished" << endl;  
 
  820   Ndb* pNdb = GETNDB(step);
 
  821   int result = NDBT_OK;
 
  823   Uint32 loops = ctx->getNumLoops();
 
  824   int records = ctx->getNumRecords();
 
  828   const Uint32 nodeCount = restarter.getNumDbNodes();
 
  830     g_info << 
"SR6 - Needs atleast 2 nodes to test" << endl;
 
  835   for(i = 0; i<nodeCount; i++)
 
  836     nodeIds.push_back(restarter.getDbNodeId(i));
 
  838   Uint32 currentRestartNodeIndex = 0;
 
  842   while(i<=loops && result != NDBT_FAILED){
 
  844     g_info << 
"Loop " << i << 
"/"<< loops <<
" started" << endl;
 
  851     g_info << 
"Loading records..." << endl;
 
  852     hugoTrans.loadTable(pNdb, records);
 
  854     CHECK(restarter.restartAll(
false, 
true, 
false) == 0);
 
  856     Uint32 nodeId = nodeIds[currentRestartNodeIndex];
 
  857     currentRestartNodeIndex = (currentRestartNodeIndex + 1 ) % nodeCount;
 
  859     CHECK(restarter.restartOneDbNode(nodeId, 
true, 
true,
false) == 0);
 
  860     CHECK(restarter.waitClusterNoStart(timeout) == 0);
 
  861     CHECK(restarter.startAll() == 0);
 
  862     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
  864     int count = records - 1;
 
  865     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  866     CHECK(count == records);
 
  867     CHECK(utilTrans.clearTable(pNdb) == 0);    
 
  871   g_info << 
"runSystemRestart6 finished" << endl;  
 
  877   Ndb* pNdb = GETNDB(step);
 
  878   int result = NDBT_OK;
 
  879   Uint32 loops = ctx->getNumLoops();
 
  880   int records = ctx->getNumRecords();
 
  884   const Uint32 nodeCount = restarter.getNumDbNodes();
 
  886     g_info << 
"SR7 - Needs atleast 2 nodes to test" << endl;
 
  891   for(i = 0; i<nodeCount; i++)
 
  892     nodeIds.push_back(restarter.getDbNodeId(i));
 
  898   Uint32 currentRestartNodeIndex = 1;
 
  902   while(i<=loops && result != NDBT_FAILED){
 
  904     g_info << 
"Loop " << i << 
"/"<< loops <<
" started" << endl;
 
  913     g_info << 
"Loading records..." << endl;
 
  914     hugoTrans.loadTable(pNdb, records);
 
  916     CHECK(restarter.restartAll(
false, 
true, 
false) == 0);
 
  918     int nodeId = nodeIds[currentRestartNodeIndex];
 
  919     currentRestartNodeIndex = (currentRestartNodeIndex + 1 ) % nodeCount;
 
  922     for(Uint32 k = 0; k<nodeCount; k++){
 
  923       if(nodeIds[k] != nodeId){
 
  924         a_nodeIds[j++] = nodeIds[k];
 
  928     CHECK(restarter.startNodes(a_nodeIds, nodeCount - 1) == 0);
 
  929     CHECK(restarter.waitNodesStarted(a_nodeIds, nodeCount - 1, 120) == 0);
 
  931     int count = records - 1;
 
  932     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  933     CHECK(count == records);
 
  935     CHECK(restarter.startNodes(&nodeId, 1) == 0);
 
  936     CHECK(restarter.waitNodesStarted(&nodeId, 1, 120) == 0);
 
  938     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
  939     CHECK(count == records);
 
  940     CHECK(utilTrans.clearTable(pNdb) == 0);    
 
  945   g_info << 
"runSystemRestart7 finished" << endl;  
 
  951   Ndb* pNdb = GETNDB(step);
 
  952   int result = NDBT_OK;
 
  954   Uint32 loops = ctx->getNumLoops();
 
  955   int records = ctx->getNumRecords();
 
  959   const Uint32 nodeCount = restarter.getNumDbNodes();
 
  961     g_info << 
"SR8 - Needs atleast 2 nodes to test" << endl;
 
  966   for(i = 0; i<nodeCount; i++)
 
  967     nodeIds.push_back(restarter.getDbNodeId(i));
 
  973   Uint32 currentRestartNodeIndex = 1;
 
  977   while(i<=loops && result != NDBT_FAILED){
 
  979     g_info << 
"Loop " << i << 
"/"<< loops <<
" started" << endl;
 
  988     g_info << 
"Loading records..." << endl;
 
  989     hugoTrans.loadTable(pNdb, records);
 
  991     CHECK(restarter.restartAll(
false, 
true, 
false) == 0);
 
  993     int nodeId = nodeIds[currentRestartNodeIndex];
 
  994     currentRestartNodeIndex = (currentRestartNodeIndex + 1 ) % nodeCount;
 
  997     for(Uint32 k = 0; k<nodeCount; k++){
 
  998       if(nodeIds[k] != nodeId){
 
  999         a_nodeIds[j++] = nodeIds[k];
 
 1003     CHECK(restarter.startNodes(a_nodeIds, nodeCount-1) == 0);
 
 1004     CHECK(restarter.waitNodesStartPhase(a_nodeIds, nodeCount-1, 3, 120) == 0);
 
 1005     CHECK(restarter.startNodes(&nodeId, 1) == 0);
 
 1006     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
 1009     int count = records - 1;
 
 1010     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
 1011     CHECK(count == records);
 
 1012     CHECK(utilTrans.clearTable(pNdb) == 0);    
 
 1016   g_info << 
"runSystemRestart8 finished" << endl;  
 
 1022   Ndb* pNdb = GETNDB(step);
 
 1023   int result = NDBT_OK;
 
 1031   int args[] = { DumpStateOrd::DihMaxTimeBetweenLCP };
 
 1032   int dump[] = { DumpStateOrd::DihStartLcpImmediately };
 
 1035     CHECK(restarter.dumpStateAllNodes(args, 1) == 0);
 
 1038     CHECK(ops.startTransaction(pNdb) == 0);
 
 1039     for(i = 0; i<10; i++){
 
 1040       CHECK(ops.pkInsertRecord(pNdb, i, 1, 1) == 0);
 
 1041       CHECK(ops.execute_NoCommit(pNdb) == 0);
 
 1043     for(i = 0; i<10; i++){
 
 1044       CHECK(ops.pkUpdateRecord(pNdb, i, 1) == 0);
 
 1045       CHECK(ops.execute_NoCommit(pNdb) == 0);
 
 1047     NdbSleep_SecSleep(10);
 
 1048     CHECK(restarter.dumpStateAllNodes(dump, 1) == 0);
 
 1049     NdbSleep_SecSleep(10);
 
 1050     CHECK(ops.execute_Commit(pNdb) == 0);  
 
 1052     CHECK(restarter.restartAll() == 0);
 
 1053     CHECK(restarter.waitClusterStarted(timeout) == 0);
 
 1055     ops.closeTransaction(pNdb);
 
 1058   g_info << 
"runSystemRestart9 finished" << endl;  
 
 1065   const Uint32 nodeCount = restarter.getNumDbNodes();
 
 1067     g_info << 
"Bug18385 - Needs atleast 2 nodes to test" << endl;
 
 1071   int node1 = restarter.getDbNodeId(rand() % nodeCount);
 
 1072   int node2 = restarter.getRandomNodeSameNodeGroup(node1, rand());
 
 1074   if (node1 == -1 || node2 == -1)
 
 1077   int dump[] = { DumpStateOrd::DihSetTimeBetweenGcp, 300 };
 
 1079   int result = NDBT_OK;
 
 1081     CHECK(restarter.dumpStateAllNodes(dump, 2) == 0);
 
 1082     CHECK(restarter.restartOneDbNode(node1, 
false, 
true, 
false) == 0);
 
 1083     NdbSleep_SecSleep(3);
 
 1084     CHECK(restarter.restartAll(
false, 
true, 
false) == 0);
 
 1088     for(Uint32 i = 0; i<nodeCount; i++)
 
 1089       if ((nodes[cnt] = restarter.getDbNodeId(i)) != node2)
 
 1092     assert(cnt == nodeCount - 1);
 
 1094     CHECK(restarter.startNodes(nodes, cnt) == 0);
 
 1095     CHECK(restarter.waitNodesStarted(nodes, cnt, 300) == 0);
 
 1097     CHECK(restarter.insertErrorInNode(node2, 7170) == 0);
 
 1098     CHECK(restarter.waitNodesNoStart(&node2, 1) == 0);
 
 1099     CHECK(restarter.restartOneDbNode(node2, 
true, 
false, 
true) == 0);
 
 1100     CHECK(restarter.waitNodesStarted(&node2, 1) == 0);
 
 1104   g_info << 
"Bug18385 finished" << endl;  
 
 1112   restarter.waitClusterStarted(300);
 
 1114   NdbSleep_SecSleep(3);
 
 1119   int records = ctx->getNumRecords();
 
 1121   Ndb* pNdb = GETNDB(step);
 
 1127   if (utilTrans.clearTable2(pNdb,  records) != 0){
 
 1137   const Uint32 nodeCount = restarter.getNumDbNodes();
 
 1139     g_info << 
"Bug21536 - 2 nodes to test" << endl;
 
 1143   int node1 = restarter.getDbNodeId(rand() % nodeCount);
 
 1144   int node2 = restarter.getRandomNodeSameNodeGroup(node1, rand());
 
 1146   if (node1 == -1 || node2 == -1)
 
 1149   int result = NDBT_OK;
 
 1151     CHECK(restarter.restartOneDbNode(node1, 
false, 
true, 
true) == 0);
 
 1152     CHECK(restarter.waitNodesNoStart(&node1, 1) == 0);    
 
 1153     CHECK(restarter.insertErrorInNode(node1, 1000) == 0);    
 
 1154     int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
 
 1155     CHECK(restarter.dumpStateOneNode(node1, val2, 2) == 0);
 
 1156     CHECK(restarter.startNodes(&node1, 1) == 0);    
 
 1157     restarter.waitNodesStartPhase(&node1, 1, 3, 120);
 
 1158     CHECK(restarter.waitNodesNoStart(&node1, 1) == 0);    
 
 1160     CHECK(restarter.restartOneDbNode(node2, 
true, 
true, 
true) == 0);
 
 1161     CHECK(restarter.waitNodesNoStart(&node2, 1) == 0);    
 
 1162     CHECK(restarter.startNodes(&node1, 1) == 0);   
 
 1163     CHECK(restarter.waitNodesStarted(&node1, 1) == 0);
 
 1164     CHECK(restarter.startNodes(&node2, 1) == 0);   
 
 1165     CHECK(restarter.waitClusterStarted() == 0);
 
 1169   g_info << 
"Bug21536 finished" << endl;  
 
 1177   int result = NDBT_OK;
 
 1179   Ndb* pNdb = GETNDB(step);
 
 1181   int records = ctx->getNumRecords();
 
 1185   int args[] = { DumpStateOrd::DihMaxTimeBetweenLCP };
 
 1186   int dump[] = { DumpStateOrd::DihStartLcpImmediately };
 
 1188   restarter.getNumDbNodes();
 
 1196     CHECK(restarter.dumpStateAllNodes(args, 1) == 0);
 
 1197     CHECK(restarter.dumpStateAllNodes(dump, 1) == 0);
 
 1203     if (hugoTrans.loadTable(GETNDB(step), records) != 0){
 
 1207     restarter.insertErrorInAllNodes(10039); 
 
 1208     CHECK(restarter.dumpStateAllNodes(dump, 1) == 0);
 
 1211     NdbSleep_SecSleep(3);
 
 1212     CHECK(utilTrans.clearTable(pNdb,  records) == 0);
 
 1213     if (hugoTrans.loadTable(GETNDB(step), records) != 0){
 
 1217     restarter.insertErrorInAllNodes(10040); 
 
 1225     restarter.restartAll(
false, 
false, 
true);
 
 1226     CHECK(restarter.waitClusterStarted() == 0);
 
 1235   int result = NDBT_OK;
 
 1237   const Uint32 nodeCount = restarter.getNumDbNodes();
 
 1242   int args[] = { DumpStateOrd::DihMaxTimeBetweenLCP };
 
 1243   int dump[] = { DumpStateOrd::DihStartLcpImmediately };
 
 1252     int node1 = restarter.getDbNodeId(rand() % nodeCount);
 
 1253     CHECK(restarter.restartOneDbNode(node1, 
false, 
true, 
true) == 0);
 
 1254     NdbSleep_SecSleep(3);
 
 1255     CHECK(restarter.waitNodesNoStart(&node1, 1) == 0);
 
 1257     CHECK(restarter.dumpStateAllNodes(args, 1) == 0);
 
 1259     for (Uint32 i = 0; i<3; i++)
 
 1261       CHECK(restarter.dumpStateAllNodes(dump, 1) == 0);
 
 1268     restarter.restartAll(
false, 
true, 
true);
 
 1269     NdbSleep_SecSleep(3);
 
 1270     CHECK(restarter.waitClusterNoStart() == 0);
 
 1271     restarter.insertErrorInNode(node1, 5046);
 
 1272     restarter.startAll();
 
 1273     CHECK(restarter.waitClusterStarted() == 0);
 
 1282   int result = NDBT_OK;
 
 1284   const Uint32 nodeCount = restarter.getNumDbNodes();
 
 1290   int master = restarter.getMasterNodeId();
 
 1292     int node1 = restarter.getRandomNodeOtherNodeGroup(master, rand());
 
 1293     int node2 = restarter.getRandomNodeSameNodeGroup(node1, rand());
 
 1295     ndbout_c(
"node1: %u node2: %u", node1, node2);
 
 1297     int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };    
 
 1298     restarter.dumpStateAllNodes(val2, 2);
 
 1299     int dump[] = { DumpStateOrd::DihSetTimeBetweenGcp, 30000 };
 
 1300     restarter.dumpStateAllNodes(dump, 2);
 
 1309     ndb_mgm_destroy_logevent_handle(&handle);
 
 1311     CHECK(restarter.insertErrorInAllNodes(932) == 0);
 
 1313     CHECK(restarter.insertErrorInNode(node1, 7183) == 0);
 
 1314     CHECK(restarter.insertErrorInNode(node2, 7183) == 0);
 
 1316     CHECK(restarter.waitClusterNoStart() == 0);
 
 1317     restarter.startAll();
 
 1318     CHECK(restarter.waitClusterStarted() == 0);  
 
 1325   Ndb* pNdb = GETNDB(step);
 
 1327   int result = NDBT_OK;
 
 1330   Uint32 loops = ctx->getNumLoops();
 
 1331   int records = ctx->getNumRecords();
 
 1335   g_info << 
"Loading records..." << endl;  hugoTrans.loadTable(pNdb, 
 
 1339   while(i<=loops && result != NDBT_FAILED)
 
 1341     g_info << 
"Loop " << i << 
"/"<< loops <<
" started" << endl;
 
 1344       CHECK(restarter.restartAll(
false, 
true, 
false) == 0); 
 
 1348       CHECK(restarter.restartAll(
false, 
true, 
true) == 0); 
 
 1350     CHECK(restarter.waitClusterNoStart() == 0);
 
 1351     restarter.insertErrorInAllNodes(6024);
 
 1352     CHECK(restarter.startAll()== 0);
 
 1353     CHECK(restarter.waitClusterStarted() == 0);
 
 1355     CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
 
 1356     CHECK(count == records);
 
 1359   ndbout << 
" runBug28770 finished" << endl;
 
 1369   while (!ctx->isTestStopped() && 
 
 1370          ((stop = ctx->getProperty(
"StopAbort", Uint32(0))) == 0))
 
 1372     NdbSleep_MilliSleep(30);
 
 1375   if (ctx->isTestStopped())
 
 1380   ctx->setProperty(
"StopAbort", Uint32(0));
 
 1382   ndbout << 
"Killing in " << stop << 
"ms..." << flush;
 
 1383   NdbSleep_MilliSleep(stop);
 
 1384   restarter.restartAll(
false, 
true, 
true);
 
 1390   Ndb* pNdb = GETNDB(step);
 
 1391   int result = NDBT_OK;
 
 1392   Uint32 loops = ctx->getNumLoops();
 
 1394   NdbBackup backup(GETNDB(step)->getNodeId()+1);
 
 1395   bool lcploop = ctx->getProperty(
"LCP", (
unsigned)0);
 
 1396   bool all = ctx->getProperty(
"ALL", (
unsigned)0);
 
 1400   int val[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
 
 1401   int lcp = DumpStateOrd::DihMinTimeBetweenLCP;
 
 1406   while(i<=loops && result != NDBT_FAILED)
 
 1411       CHECK(restarter.dumpStateAllNodes(&lcp, 1) == 0);
 
 1414     int nodeId = restarter.getDbNodeId(rand() % restarter.getNumDbNodes());
 
 1417     ndbout << 
"Loop " << i << 
"/"<< loops <<
" started" << endl;
 
 1418     ndbout << 
"Loading records..." << startFrom << endl;
 
 1419     CHECK(hugoTrans.loadTable(pNdb, startFrom) == 0);
 
 1423       ndbout << 
"Making " << nodeId << 
" crash" << endl;
 
 1424       int kill[] = { 9999, 1000, 3000 };
 
 1425       CHECK(restarter.dumpStateOneNode(nodeId, val, 2) == 0);
 
 1426       CHECK(restarter.dumpStateOneNode(nodeId, kill, 3) == 0);
 
 1430       ndbout << 
"Crashing cluster" << endl;
 
 1431       ctx->setProperty(
"StopAbort", 1000 + rand() % (3000 - 1000));
 
 1433     Uint64 end = NdbTick_CurrentMillisecond() + 4000;
 
 1434     Uint32 row = startFrom;
 
 1436       ndbout << 
"Loading from " << row << 
" to " << row + 1000 << endl;
 
 1437       if (hugoTrans.loadTableStartFrom(pNdb, row, 1000) != 0)
 
 1440     } 
while (NdbTick_CurrentMillisecond() < end);
 
 1444       ndbout << 
"Waiting for " << nodeId << 
" to restart" << endl;
 
 1445       CHECK(restarter.waitNodesNoStart(&nodeId, 1) == 0);
 
 1446       ndbout << 
"Restarting cluster" << endl;
 
 1447       CHECK(restarter.restartAll(
false, 
true, 
true) == 0);
 
 1451       ndbout << 
"Waiting for cluster to restart" << endl;
 
 1453     CHECK(restarter.waitClusterNoStart() == 0);
 
 1454     CHECK(restarter.startAll() == 0);
 
 1455     CHECK(restarter.waitClusterStarted() == 0);
 
 1458     ndbout << 
"Starting backup..." << flush;
 
 1459     CHECK(backup.start() == 0);
 
 1460     ndbout << 
"done" << endl;
 
 1463     CHECK(hugoTrans.selectCount(pNdb, 0, &cnt) == 0);
 
 1464     ndbout << 
"Found " << cnt << 
" records..." << endl;
 
 1465     ndbout << 
"Updating..." << endl;
 
 1466     CHECK(hugoTrans.scanUpdateRecords(pNdb,
 
 1467                                       NdbScanOperation::SF_TupScan, cnt) == 0);
 
 1468     ndbout << 
"Clearing..." << endl;    
 
 1469     CHECK(hugoTrans.clearTable(pNdb,
 
 1470                                NdbScanOperation::SF_TupScan, cnt) == 0);
 
 1472     if (cnt > startFrom)
 
 1480   ndbout << 
"runSR_DD_1 finished" << endl;  
 
 1487   Ndb* pNdb = GETNDB(step);
 
 1488   int result = NDBT_OK;
 
 1489   Uint32 loops = ctx->getNumLoops();
 
 1490   Uint32 rows = ctx->getNumRecords();
 
 1492   NdbBackup backup(GETNDB(step)->getNodeId()+1);
 
 1493   bool lcploop = ctx->getProperty(
"LCP", (
unsigned)0);
 
 1494   bool all = ctx->getProperty(
"ALL", (
unsigned)0);
 
 1495   int error = (int)ctx->getProperty(
"ERROR", (
unsigned)0);
 
 1496   rows = ctx->getProperty(
"ROWS", rows);
 
 1500   int val[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
 
 1501   int lcp = DumpStateOrd::DihMinTimeBetweenLCP;
 
 1505     restarter.insertErrorInAllNodes(error);
 
 1509   while(i<=loops && result != NDBT_FAILED)
 
 1514       CHECK(restarter.dumpStateAllNodes(&lcp, 1) == 0);
 
 1517     int nodeId = restarter.getDbNodeId(rand() % restarter.getNumDbNodes());
 
 1521       ndbout << 
"Making " << nodeId << 
" crash" << endl;
 
 1522       int kill[] = { 9999, 3000, 10000 };
 
 1523       CHECK(restarter.dumpStateOneNode(nodeId, val, 2) == 0);
 
 1524       CHECK(restarter.dumpStateOneNode(nodeId, kill, 3) == 0);
 
 1528       ndbout << 
"Crashing cluster" << endl;
 
 1529       ctx->setProperty(
"StopAbort", 3000 + rand() % (10000 - 3000));
 
 1532     Uint64 end = NdbTick_CurrentMillisecond() + 11000;
 
 1534       if (hugoTrans.loadTable(pNdb, rows) != 0)
 
 1537       if (hugoTrans.clearTable(pNdb, NdbScanOperation::SF_TupScan, rows) != 0)
 
 1539     } 
while (NdbTick_CurrentMillisecond() < end);
 
 1543       ndbout << 
"Waiting for " << nodeId << 
" to restart" << endl;
 
 1544       CHECK(restarter.waitNodesNoStart(&nodeId, 1) == 0);
 
 1545       ndbout << 
"Restarting cluster" << endl;
 
 1546       CHECK(restarter.restartAll(
false, 
true, 
true) == 0);
 
 1550       ndbout << 
"Waiting for cluster to restart" << endl;
 
 1553     CHECK(restarter.waitClusterNoStart() == 0);
 
 1554     CHECK(restarter.startAll() == 0);
 
 1555     CHECK(restarter.waitClusterStarted() == 0);
 
 1560       restarter.insertErrorInAllNodes(error);
 
 1563     ndbout << 
"Starting backup..." << flush;
 
 1564     CHECK(backup.start() == 0);
 
 1565     ndbout << 
"done" << endl;
 
 1568     CHECK(hugoTrans.selectCount(pNdb, 0, &cnt) == 0);
 
 1569     ndbout << 
"Found " << cnt << 
" records..." << endl;
 
 1570     ndbout << 
"Updating..." << endl;
 
 1571     CHECK(hugoTrans.scanUpdateRecords(pNdb,
 
 1572                                       NdbScanOperation::SF_TupScan, cnt) == 0);
 
 1573     ndbout << 
"Clearing..." << endl;    
 
 1574     CHECK(hugoTrans.clearTable(pNdb,
 
 1575                                NdbScanOperation::SF_TupScan, cnt) == 0);
 
 1581     restarter.insertErrorInAllNodes(0);
 
 1584   ndbout << 
"runSR_DD_2 finished" << endl;  
 
 1591   Ndb* pNdb = GETNDB(step);
 
 1592   int result = NDBT_OK;
 
 1593   Uint32 loops = ctx->getNumLoops();
 
 1594   Uint32 rows = ctx->getNumRecords();
 
 1596   NdbBackup backup(GETNDB(step)->getNodeId()+1);
 
 1597   bool lcploop = ctx->getProperty(
"LCP", (
unsigned)0);
 
 1598   bool all = ctx->getProperty(
"ALL", (
unsigned)0);
 
 1599   int error = (int)ctx->getProperty(
"ERROR", (
unsigned)0);
 
 1600   rows = ctx->getProperty(
"ROWS", rows);
 
 1604   int val[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
 
 1605   int lcp = DumpStateOrd::DihMinTimeBetweenLCP;
 
 1609     restarter.insertErrorInAllNodes(error);
 
 1613   while(i<=loops && result != NDBT_FAILED)
 
 1618       CHECK(restarter.dumpStateAllNodes(&lcp, 1) == 0);
 
 1621     int nodeId = restarter.getDbNodeId(rand() % restarter.getNumDbNodes());
 
 1623     if (hugoTrans.loadTable(pNdb, rows) != 0)
 
 1630       ndbout << 
"Making " << nodeId << 
" crash" << endl;
 
 1631       int kill[] = { 9999, 3000, 10000 };
 
 1632       CHECK(restarter.dumpStateOneNode(nodeId, val, 2) == 0);
 
 1633       CHECK(restarter.dumpStateOneNode(nodeId, kill, 3) == 0);
 
 1637       ndbout << 
"Crashing cluster" << endl;
 
 1638       ctx->setProperty(
"StopAbort", 3000 + rand() % (10000 - 3000));
 
 1641     int deletedrows[100];
 
 1642     Uint64 end = NdbTick_CurrentMillisecond() + 13000;
 
 1645       for (; cnt<NDB_ARRAY_SIZE(deletedrows); cnt++)
 
 1647         deletedrows[cnt] = rand() % rows;
 
 1648         if (hugoTrans.startTransaction(pNdb))
 
 1650         if (hugoTrans.pkDeleteRecord(pNdb, deletedrows[cnt]))
 
 1652         if (hugoTrans.execute_Commit(pNdb))
 
 1654         hugoTrans.closeTransaction(pNdb);
 
 1656       if (hugoTrans.getTransaction() != 0)
 
 1657         hugoTrans.closeTransaction(pNdb);
 
 1659       if (hugoTrans.scanUpdateRecords(pNdb, NdbScanOperation::SF_TupScan,0)!=0)
 
 1662       for (Uint32 
n = 0; 
n<cnt; 
n++)
 
 1664         if (hugoTrans.startTransaction(pNdb))
 
 1666         if (hugoTrans.pkInsertRecord(pNdb, deletedrows[
n], 1, rand()))
 
 1668         if (hugoTrans.execute_Commit(pNdb))
 
 1670         hugoTrans.closeTransaction(pNdb);
 
 1672       if (hugoTrans.getTransaction() != 0)
 
 1673         hugoTrans.closeTransaction(pNdb);
 
 1675       if (hugoTrans.scanUpdateRecords(pNdb, NdbScanOperation::SF_TupScan,0)!=0)
 
 1677     } 
while (NdbTick_CurrentMillisecond() < end);
 
 1681       ndbout << 
"Waiting for " << nodeId << 
" to restart" << endl;
 
 1682       CHECK(restarter.waitNodesNoStart(&nodeId, 1) == 0);
 
 1683       ndbout << 
"Restarting cluster" << endl;
 
 1684       CHECK(restarter.restartAll(
false, 
true, 
true) == 0);
 
 1688       ndbout << 
"Waiting for cluster to restart" << endl;
 
 1691     CHECK(restarter.waitClusterNoStart() == 0);
 
 1692     CHECK(restarter.startAll() == 0);
 
 1693     CHECK(restarter.waitClusterStarted() == 0);
 
 1696       restarter.insertErrorInAllNodes(error);
 
 1699     ndbout << 
"Starting backup..." << flush;
 
 1700     CHECK(backup.start() == 0);
 
 1701     ndbout << 
"done" << endl;
 
 1704     CHECK(hugoTrans.selectCount(pNdb, 0, &cnt) == 0);
 
 1705     ndbout << 
"Found " << cnt << 
" records..." << endl;
 
 1706     ndbout << 
"Updating..." << endl;
 
 1707     CHECK(hugoTrans.scanUpdateRecords(pNdb,
 
 1708                                       NdbScanOperation::SF_TupScan, cnt) == 0);
 
 1709     ndbout << 
"Clearing..." << endl;
 
 1710     CHECK(hugoTrans.clearTable(pNdb,
 
 1711                                NdbScanOperation::SF_TupScan, cnt) == 0);
 
 1717     restarter.insertErrorInAllNodes(0);
 
 1720   ndbout << 
"runSR_DD_3 finished" << endl;
 
 1727   Ndb* pNdb = GETNDB(step);
 
 1728   int result = NDBT_OK;
 
 1729   Uint32 loops = ctx->getNumLoops();
 
 1730   Uint32 rows = ctx->getNumRecords();
 
 1735   while(i<=loops && result != NDBT_FAILED)
 
 1737     ndbout_c(
"loop %u", i);
 
 1738     for (Uint32 j = 0; j<10 && result != NDBT_FAILED; j++)
 
 1739       CHECK(hugoTrans.scanUpdateRecords(pNdb, rows) == 0);
 
 1741     CHECK(restarter.restartAll(
false, 
true, i > 0 ? 
true : 
false) == 0);
 
 1742     CHECK(restarter.waitClusterNoStart() == 0);
 
 1743     CHECK(restarter.insertErrorInAllNodes(7072) == 0);
 
 1744     CHECK(restarter.startAll() == 0);
 
 1745     CHECK(restarter.waitClusterStarted() == 0);
 
 1751       NdbSleep_SecSleep(5); 
 
 1762   if (NDBT_Tables::createAllTables(GETNDB(step), 
false, 
true))
 
 1770   Ndb* pNdb = GETNDB(step);
 
 1772   int loops = ctx->getNumLoops();
 
 1773   int records = ctx->getNumRecords();
 
 1775   int result = NDBT_OK;
 
 1777   for (
int l = 0; l<loops; l++)
 
 1779     for (
int i = 0; i<NDBT_Tables::getNumTables(); i++)
 
 1782         pDict->
getTable(NDBT_Tables::getTable(i)->getName());
 
 1786         trans.loadTable(pNdb, records);
 
 1787         trans.scanUpdateRecords(pNdb, records);
 
 1790         trans.scanUpdateRecords(pNdb, records);
 
 1791         trans.clearTable(pNdb, records/2);
 
 1792         trans.loadTable(pNdb, records/2);
 
 1795         trans.clearTable(pNdb, records/2);
 
 1796         trans.loadTable(pNdb, records/2);
 
 1797         trans.clearTable(pNdb, records/2);
 
 1802     ndbout << 
"Restarting cluster..." << endl;
 
 1803     CHECK(restarter.restartAll(
false, 
true, 
false) == 0);
 
 1804     CHECK(restarter.waitClusterNoStart() == 0);
 
 1805     CHECK(restarter.startAll() == 0);
 
 1806     CHECK(restarter.waitClusterStarted() == 0);
 
 1809     for (
int i = 0; i<NDBT_Tables::getNumTables(); i++)
 
 1812         pDict->
getTable(NDBT_Tables::getTable(i)->getName());
 
 1814       trans.scanUpdateRecords(pNdb, records);
 
 1824   NDBT_Tables::dropAllTables(GETNDB(step));
 
 1831   Ndb* pNdb = GETNDB(step);
 
 1832   int result = NDBT_OK;
 
 1833   Uint32 loops = ctx->getNumLoops();
 
 1834   Uint32 rows = ctx->getNumRecords();
 
 1838   if (res.getNumDbNodes() < 2)
 
 1841   Uint32 nodeGroups[256];
 
 1843   for (
int j = 0; j<res.getNumDbNodes(); j++)
 
 1845     int node = res.getDbNodeId(j);
 
 1846     nodeGroups[node] = res.getNodeGroup(node);
 
 1847     nodeGroupMap.set(nodeGroups[node]);
 
 1851   int val[] = { DumpStateOrd::DihMinTimeBetweenLCP, 0 };
 
 1854   while(i<=loops && result != NDBT_FAILED)
 
 1856     CHECK(res.dumpStateAllNodes(val, 1) == 0);
 
 1862     Bitmask<256/32> notstopped = nodeGroupMap;
 
 1863     while(!notstopped.isclear())
 
 1867         node = res.getDbNodeId(rand() % res.getNumDbNodes());
 
 1868       } 
while (!notstopped.get(nodeGroups[node]));
 
 1870       notstopped.clear(nodeGroups[node]);
 
 1871       ndbout_c(
"stopping %u", node);
 
 1872       CHECK(res.restartOneDbNode(node, 
false, 
true, 
true) == 0);
 
 1873       CHECK(res.waitNodesNoStart(&node, 1) == 0);
 
 1874       for (Uint32 j = 0; j<25; j++)
 
 1876         if (! (hugoTrans.scanUpdateRecords(pNdb, 0) == 0))
 
 1886     Uint32 LCP = 
event.LocalCheckpointCompleted.lci;
 
 1887     ndbout_c(
"LCP: %u", LCP);
 
 1897           event.LocalCheckpointCompleted.lci < LCP + 3)
 
 1899         hugoTrans.scanUpdateRecords(pNdb, 0);
 
 1907     ndbout_c(
"LCP: %u", 
event.LocalCheckpointCompleted.lci);
 
 1909     CHECK(res.restartAll(
false, 
true, 
true) == 0);
 
 1910     CHECK(res.waitClusterNoStart() == 0);
 
 1911     CHECK(res.startAll() == 0);
 
 1912     NDB_TICKS now = NdbTick_CurrentMillisecond();
 
 1920     save[0] = g_err.m_out;
 
 1921     g_err.m_out = &null;
 
 1924       hugoTrans.scanUpdateRecords(pNdb, 0);
 
 1925     } 
while (NdbTick_CurrentMillisecond() < (now + 30000));
 
 1926     g_err.m_out = save[0];
 
 1927     CHECK(res.waitClusterStarted() == 0);
 
 1930     hugoTrans.clearTable(pNdb);
 
 1931     hugoTrans.loadTable(pNdb, rows);
 
 1933     CHECK(res.dumpStateAllNodes(val, 1) == 0);
 
 1938     ndb_mgm_destroy_logevent_handle(&handle);
 
 1943   res.dumpStateAllNodes(val, 2); 
 
 1951   Ndb* pNdb = GETNDB(step);
 
 1953   int result = NDBT_OK;
 
 1954   Uint32 loops = ctx->getNumLoops();
 
 1955   Uint32 rows = ctx->getNumRecords();
 
 1958   restarter.getNumDbNodes();
 
 1965   Uint32 frag_data[128];
 
 1966   bzero(frag_data, 
sizeof(frag_data));
 
 1975   for(Uint32 i = 0; i < loops && result != NDBT_FAILED; i++)
 
 1977     ndbout_c(
"loop %u", i);
 
 1995       hugoTrans.loadTable(pNdb, rows);
 
 1998     int dump[] = { DumpStateOrd::DihStartLcpImmediately };
 
 1999     for (
int l = 0; l<2; l++)
 
 2001       CHECK(restarter.dumpStateAllNodes(dump, 1) == 0);
 
 2017     copyptr = pDict->
getTable(
"BUG_45154");
 
 2021       hugoTrans.loadTable(pNdb, rows);
 
 2022       for (Uint32 pp = 0; pp<3; pp++)
 
 2023         hugoTrans.scanUpdateRecords(pNdb, rows);
 
 2025     restarter.restartAll(
false, 
true, 
true);
 
 2026     restarter.waitClusterNoStart();
 
 2027     restarter.startAll();
 
 2028     restarter.waitClusterStarted();
 
 2039   Ndb* pNdb = GETNDB(step);
 
 2041   Uint32 rows = ctx->getNumRecords();
 
 2053   col.setAutoIncrement(
false);
 
 2067   tab.setForceVarPart(
true);
 
 2084     if (trans.loadTable(pNdb, rows) != 0)
 
 2090   res.restartAll2(NdbRestarter::NRRF_NOSTART);
 
 2091   if (res.waitClusterNoStart())
 
 2094   if (res.waitClusterStarted())
 
 2114   res.restartAll2(NdbRestarter::NRRF_NOSTART | NdbRestarter::NRRF_ABORT);
 
 2115   if (res.waitClusterNoStart())
 
 2118   if (res.waitClusterStarted())
 
 2130   Uint32 loops = ctx->getNumLoops();
 
 2132   const Uint32 nodeCount = res.getNumDbNodes();
 
 2138   for (Uint32 l = 0; l<loops; l++)
 
 2141     printf(
"checking nodegroups of getNextMasterNodeId(): ");
 
 2143     bzero(nodes, 
sizeof(nodes));
 
 2144     nodes[0] = res.getMasterNodeId();
 
 2145     printf(
"%d ", nodes[0]);
 
 2146     for (Uint32 i = 1; i<nodeCount; i++)
 
 2148       nodes[
i] = res.getNextMasterNodeId(nodes[i-1]);
 
 2149       printf(
"%d ", nodes[i]);
 
 2155     int restartnodes[256];
 
 2157     Uint32 
limit = (nodeCount / 2);
 
 2158     for (Uint32 i = 0; i<
limit; i++)
 
 2160       int tmp = res.getNodeGroup(nodes[i]);
 
 2161       printf(
"node %d ng: %d", nodes[i], tmp);
 
 2164         restartnodes[cnt++] = nodes[
i];
 
 2165         ndbout_c(
" COLLISION");
 
 2167         if (limit > nodeCount)
 
 2179       printf(
"restarting nodes: ");
 
 2180       for (
int i = 0; i<cnt; i++)
 
 2181         printf(
"%d ", restartnodes[i]);
 
 2183       for (
int i = 0; i<cnt; i++)
 
 2185         res.restartOneDbNode(restartnodes[i], 
false, 
true, 
true);
 
 2187       res.waitNodesNoStart(restartnodes, cnt);
 
 2188       res.startNodes(restartnodes, cnt);
 
 2189       if (res.waitClusterStarted())
 
 2195     int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
 
 2196     res.dumpStateAllNodes(val2, 2);
 
 2199     for (Uint32 i = 0; i<(nodeCount / 2); i++)
 
 2201       int node = nodes[(nodeCount / 2) - (i + 1)];
 
 2203       res.insertErrorInNode(node, 7218);
 
 2206     for (Uint32 i = 0; i<nodeCount; i++)
 
 2208       int node = nodes[
i];
 
 2211       res.insertErrorInNode(node, 7220);
 
 2215     res.dumpStateAllNodes(&lcp, 1);
 
 2217     res.waitClusterNoStart();
 
 2219     if (res.waitClusterStarted())
 
 2229   Ndb* pNdb = GETNDB(step);
 
 2234   save[0] = g_err.m_out;
 
 2235   g_err.m_out = &null;
 
 2236   while (!ctx->isTestStopped())
 
 2238     hugoTrans.scanUpdateRecords(pNdb, 0);
 
 2240   g_err.m_out = save[0];
 
 2248   Uint32 loops = ctx->getNumLoops();
 
 2249   const Uint32 nodeCount = res.getNumDbNodes();
 
 2255   for (Uint32 l = 0; l<loops; l++)
 
 2258     nodes[0] = res.getNode(NdbRestarter::NS_RANDOM);
 
 2259     nodes[1] = res.getRandomNodeSameNodeGroup(nodes[0], rand());
 
 2261     int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
 
 2263     ndbout_c(
"nodes %u %u", nodes[0], nodes[1]);
 
 2265     for (Uint32 j = 0; j<5; j++)
 
 2267       int c = (rand()) % 11;
 
 2268       ndbout_c(
"case: %u", c);
 
 2272         res.dumpStateAllNodes(&val, 1);
 
 2277         res.restartOneDbNode(nodes[0], 
false, 
true, 
true);
 
 2278         res.waitNodesNoStart(nodes+0,1);
 
 2279         res.dumpStateOneNode(nodes[0], val2, 2);
 
 2280         res.insertErrorInNode(nodes[0], 5054); 
 
 2283         res.waitNodesNoStart(nodes+0,1);
 
 2287         res.restartOneDbNode(nodes[0], 
false, 
true, 
true);
 
 2288         res.waitNodesNoStart(nodes+0, 1);
 
 2292         res.dumpStateAllNodes(&val, 1);
 
 2294         res.restartOneDbNode(nodes[1], 
false, 
true, 
true);
 
 2295         res.waitNodesNoStart(nodes+1,1);
 
 2296         res.dumpStateOneNode(nodes[1], val2, 2);
 
 2297         res.insertErrorInNode(nodes[1], 5054); 
 
 2300         res.waitNodesNoStart(nodes+1,1);
 
 2304         res.restartAll(
false, 
true, 
true);
 
 2305         res.waitClusterNoStart();
 
 2310         res.dumpStateAllNodes(val2, 2);
 
 2311         int node = res.getMasterNodeId();
 
 2312         res.insertErrorInNode(node, 7222);
 
 2313         res.waitClusterNoStart();
 
 2318       res.waitClusterStarted();
 
 2320     res.restartAll(
false, 
true, 
true);
 
 2321     res.waitClusterNoStart();
 
 2323     res.waitClusterStarted();
 
 2334   Uint32 loops = ctx->getNumLoops();
 
 2335   Ndb* pNdb = GETNDB(step);
 
 2336   int rows = ctx->getNumRecords();
 
 2340   for (Uint32 l = 0; l<loops; l++)
 
 2342     int val = DumpStateOrd::DihMinTimeBetweenLCP;
 
 2343     res.dumpStateAllNodes(&val, 1);
 
 2345     for (Uint32 i = 0; i < 5; i++)
 
 2347       hugoTrans.scanUpdateRecords(pNdb, rows);
 
 2350     int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
 
 2351     res.dumpStateAllNodes(val2, 2);
 
 2353     int node = res.getMasterNodeId();
 
 2354     res.insertErrorInNode(node, 7222);
 
 2356     while (hugoTrans.scanUpdateRecords(pNdb, rows) == 0);
 
 2357     res.waitClusterNoStart();
 
 2359     res.insertErrorInAllNodes(5055);
 
 2361     res.waitClusterStarted();
 
 2372   Uint32 loops = ctx->getNumLoops();
 
 2373   Ndb* pNdb = GETNDB(step);
 
 2374   int rows = ctx->getNumRecords();
 
 2376   int node = res.getNode(NdbRestarter::NS_RANDOM);
 
 2377   int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
 
 2380   for (Uint32 l = 0; l<loops; l++)
 
 2382     ndbout_c(
"Waiting for %d to restart (5058)", node);
 
 2383     res.dumpStateOneNode(node, val2, 2);
 
 2384     res.insertErrorInNode(node, 5058);
 
 2386     hugoTrans.clearTable(pNdb);
 
 2387     hugoTrans.loadTable(pNdb, rows);
 
 2388     while (hugoTrans.scanUpdateRecords(pNdb, rows) == NDBT_OK &&
 
 2391     res.waitNodesNoStart(&node, 1);
 
 2392     res.startNodes(&node, 1);
 
 2393     ndbout_c(
"Waiting for %d to start", node);
 
 2394     res.waitClusterStarted();
 
 2396     ndbout_c(
"Waiting for %d to restart (5059)", node);
 
 2397     res.dumpStateOneNode(node, val2, 2);
 
 2398     res.insertErrorInNode(node, 5059);
 
 2400     hugoTrans.clearTable(pNdb);
 
 2401     hugoTrans.loadTable(pNdb, rows);
 
 2402     while (hugoTrans.scanUpdateRecords(pNdb, rows) == NDBT_OK &&
 
 2405     res.waitNodesNoStart(&node, 1);
 
 2406     res.startNodes(&node, 1);
 
 2407     ndbout_c(
"Waiting for %d to start", node);
 
 2408     res.waitClusterStarted();
 
 2415 NDBT_TESTSUITE(testSystemRestart);
 
 2417          "Basic system restart test. Focus on testing restart from REDO log.\n" 
 2418          "NOTE! Time between lcp's and gcp's should be left at default, \n" 
 2419          "so that Ndb  uses the Redo log when restarting\n"  
 2421          "2. Restart cluster and verify records \n" 
 2422          "3. Update records\n" 
 2423          "4. Restart cluster and verify records \n" 
 2424          "5. Delete half of the records \n" 
 2425          "6. Restart cluster and verify records \n" 
 2426          "7. Delete all records \n" 
 2427          "8. Restart cluster and verify records \n" 
 2428          "9. Insert, update, delete records \n" 
 2429          "10. Restart cluster and verify records\n" 
 2430          "11. Insert, update, delete records \n" 
 2431          "12. Restart cluster with error insert 5020 and verify records\n"){ 
 
 2432   INITIALIZER(runWaitStarted);
 
 2433   STEP(runSystemRestart1);
 
 2434   FINALIZER(runClearTable);
 
 2437          "Basic system restart test. Focus on testing restart from LCP\n" 
 2438          "NOTE! Time between lcp's is automatically set to it's  min value\n" 
 2439          "so that Ndb  uses LCP's when restarting.\n"  
 2441          "2. Restart cluster and verify records \n" 
 2442          "3. Update records\n" 
 2443          "4. Restart cluster and verify records \n" 
 2444          "5. Delete half of the records \n" 
 2445          "6. Restart cluster and verify records \n" 
 2446          "7. Delete all records \n" 
 2447          "8. Restart cluster and verify records \n" 
 2448          "9. Insert, update, delete records \n" 
 2449          "10. Restart cluster and verify records\n"){
 
 2450   INITIALIZER(runWaitStarted);
 
 2451   STEP(runSystemRestart2);
 
 2452   FINALIZER(runClearTable);
 
 2455          "System restart test. Focus on testing of undologging\n" 
 2456          "in DBACC and DBTUP.\n" 
 2457          "This is done by starting a LCP, turn on undologging \n" 
 2458          "but don't start writing the datapages. This will force all\n" 
 2459          "operations to be written into the undolog.\n" 
 2460          "Then write datapages and complete LCP.\n" 
 2461          "Restart the system\n"){
 
 2462   INITIALIZER(runWaitStarted);
 
 2463   STEP(runSystemRestartTestUndoLog);
 
 2464   FINALIZER(runClearTable);
 
 2466 TESTCASE(
"SR_FULLDB", 
 
 2467          "System restart test. Test to restart when DB is full.\n"){
 
 2468   INITIALIZER(runWaitStarted);
 
 2469   STEP(runSystemRestartTestFullDb);
 
 2470   FINALIZER(runClearTable);
 
 2473          "System restart test. Focus on testing restart from with\n" 
 2474          "not all nodes alive when system went down\n" 
 2476          "* 2. Restart 1 node -nostart\n" 
 2477          "* 3. Update records\n" 
 2478          "* 4. Restart cluster and verify records\n" 
 2479          "* 5. Restart 1 node -nostart\n" 
 2480          "* 6. Delete half of the records\n" 
 2481          "* 7. Restart cluster and verify records\n" 
 2482          "* 8. Restart 1 node -nostart\n" 
 2483          "* 9. Delete all records\n" 
 2484          "* 10. Restart cluster and verify records\n"){
 
 2485   INITIALIZER(runWaitStarted);
 
 2486   STEP(runSystemRestart3);
 
 2487   FINALIZER(runClearTable);
 
 2490          "System restart test. Focus on testing restart from with\n" 
 2491          "not all nodes alive when system went down but running LCP at\n" 
 2492          "high speed so that sometimes a TO is required to start cluster\n" 
 2494          "* 2. Restart 1 node -nostart\n" 
 2495          "* 3. Update records\n" 
 2496          "* 4. Restart cluster and verify records\n" 
 2497          "* 5. Restart 1 node -nostart\n" 
 2498          "* 6. Delete half of the records\n" 
 2499          "* 7. Restart cluster and verify records\n" 
 2500          "* 8. Restart 1 node -nostart\n" 
 2501          "* 9. Delete all records\n" 
 2502          "* 10. Restart cluster and verify records\n"){
 
 2503   INITIALIZER(runWaitStarted);
 
 2504   STEP(runSystemRestart4);
 
 2505   FINALIZER(runClearTable);
 
 2508          "As SR4 but making restart aborts\n" 
 2510          "* 2. Restart 1 node -nostart\n" 
 2511          "* 3. Update records\n" 
 2512          "* 4. Restart cluster and verify records\n" 
 2513          "* 5. Restart 1 node -nostart\n" 
 2514          "* 6. Delete half of the records\n" 
 2515          "* 7. Restart cluster and verify records\n" 
 2516          "* 8. Restart 1 node -nostart\n" 
 2517          "* 9. Delete all records\n" 
 2518          "* 10. Restart cluster and verify records\n"){
 
 2519   INITIALIZER(runWaitStarted);
 
 2520   STEP(runSystemRestart5);
 
 2521   FINALIZER(runClearTable);
 
 2524          "Perform system restart with some nodes having FS others wo/\n" 
 2526          "* 2. Restart all node -nostart\n" 
 2527          "* 3. Restart some nodes -i -nostart\n" 
 2528          "* 4. Start all nodes verify records\n"){
 
 2529   INITIALIZER(runWaitStarted);
 
 2530   INITIALIZER(runClearTable);
 
 2531   STEP(runSystemRestart6);
 
 2532   FINALIZER(runClearTable);
 
 2535          "Perform partition win system restart\n" 
 2537          "* 2. Restart all node -nostart\n" 
 2538          "* 3. Start all but one node\n" 
 2539          "* 4. Verify records\n" 
 2540          "* 5. Start last node\n" 
 2541          "* 6. Verify records\n"){
 
 2542   INITIALIZER(runWaitStarted);
 
 2543   INITIALIZER(runClearTable);
 
 2544   STEP(runSystemRestart7);
 
 2545   FINALIZER(runClearTable);
 
 2548          "Perform partition win system restart with other nodes delayed\n" 
 2550          "* 2. Restart all node -nostart\n" 
 2551          "* 3. Start all but one node\n" 
 2552          "* 4. Wait for startphase >= 2\n" 
 2553          "* 5. Start last node\n" 
 2554          "* 6. Verify records\n"){
 
 2555   INITIALIZER(runWaitStarted);
 
 2556   INITIALIZER(runClearTable);
 
 2557   STEP(runSystemRestart8);
 
 2558   FINALIZER(runClearTable);
 
 2561          "Perform partition win system restart with other nodes delayed\n" 
 2562          "* 1. Start transaction\n" 
 2563          "* 2. insert (1,1)\n" 
 2564          "* 3. update (1,2)\n" 
 2568   INITIALIZER(runWaitStarted);
 
 2569   INITIALIZER(runClearTable);
 
 2570   STEP(runSystemRestart9);
 
 2571   FINALIZER(runClearTable);
 
 2573 TESTCASE(
"Bug18385", 
 
 2574          "Perform partition system restart with other nodes with higher GCI"){
 
 2575   INITIALIZER(runWaitStarted);
 
 2576   INITIALIZER(runClearTable);
 
 2578   FINALIZER(runClearTable);
 
 2580 TESTCASE(
"Bug21536", 
 
 2581          "Perform partition system restart with other nodes with higher GCI"){
 
 2582   INITIALIZER(runWaitStarted);
 
 2583   INITIALIZER(runClearTable);
 
 2585   FINALIZER(runClearTable);
 
 2587 TESTCASE(
"Bug24664",
 
 2588          "Check handling of LCP skip/keep")
 
 2590   INITIALIZER(runWaitStarted);
 
 2591   INITIALIZER(runClearTable);
 
 2593   FINALIZER(runClearTable);
 
 2595 TESTCASE(
"Bug27434",
 
 2598   INITIALIZER(runWaitStarted);
 
 2601 TESTCASE(
"SR_DD_1", 
"")
 
 2603   TC_PROPERTY(
"ALL", 1);
 
 2604   INITIALIZER(runWaitStarted);
 
 2605   INITIALIZER(clearOldBackups);
 
 2608   FINALIZER(runClearTable);
 
 2610 TESTCASE(
"SR_DD_1b", 
"")
 
 2612   INITIALIZER(runWaitStarted);
 
 2613   INITIALIZER(clearOldBackups);
 
 2615   FINALIZER(runClearTable);
 
 2617 TESTCASE(
"SR_DD_1_LCP", 
"")
 
 2619   TC_PROPERTY(
"ALL", 1);
 
 2620   TC_PROPERTY(
"LCP", 1);
 
 2621   INITIALIZER(runWaitStarted);
 
 2622   INITIALIZER(clearOldBackups);
 
 2625   FINALIZER(runClearTable);
 
 2627 TESTCASE(
"SR_DD_1b_LCP", 
"")
 
 2629   TC_PROPERTY(
"LCP", 1);
 
 2630   INITIALIZER(runWaitStarted);
 
 2631   INITIALIZER(clearOldBackups);
 
 2633   FINALIZER(runClearTable);
 
 2635 TESTCASE(
"SR_DD_2", 
"")
 
 2637   TC_PROPERTY(
"ALL", 1);
 
 2638   INITIALIZER(runWaitStarted);
 
 2639   INITIALIZER(clearOldBackups);
 
 2642   FINALIZER(runClearTable);
 
 2644 TESTCASE(
"SR_DD_2b", 
"")
 
 2646   INITIALIZER(runWaitStarted);
 
 2647   INITIALIZER(clearOldBackups);
 
 2649   FINALIZER(runClearTable);
 
 2651 TESTCASE(
"SR_DD_2_LCP", 
"")
 
 2653   TC_PROPERTY(
"ALL", 1);
 
 2654   TC_PROPERTY(
"LCP", 1);
 
 2655   INITIALIZER(runWaitStarted);
 
 2656   INITIALIZER(clearOldBackups);
 
 2659   FINALIZER(runClearTable);
 
 2661 TESTCASE(
"SR_DD_2b_LCP", 
"")
 
 2663   TC_PROPERTY(
"LCP", 1);
 
 2664   INITIALIZER(runWaitStarted);
 
 2665   INITIALIZER(clearOldBackups);
 
 2667   FINALIZER(runClearTable);
 
 2669 TESTCASE(
"SR_DD_3", 
"")
 
 2671   TC_PROPERTY(
"ALL", 1);
 
 2672   INITIALIZER(runWaitStarted);
 
 2673   INITIALIZER(clearOldBackups);
 
 2676   FINALIZER(runClearTable);
 
 2678 TESTCASE(
"SR_DD_3b", 
"")
 
 2680   INITIALIZER(runWaitStarted);
 
 2681   INITIALIZER(clearOldBackups);
 
 2683   FINALIZER(runClearTable);
 
 2685 TESTCASE(
"SR_DD_3_LCP", 
"")
 
 2687   TC_PROPERTY(
"ALL", 1);
 
 2688   TC_PROPERTY(
"LCP", 1);
 
 2689   INITIALIZER(runWaitStarted);
 
 2690   INITIALIZER(clearOldBackups);
 
 2693   FINALIZER(runClearTable);
 
 2695 TESTCASE(
"SR_DD_3b_LCP", 
"")
 
 2697   TC_PROPERTY(
"LCP", 1);
 
 2698   INITIALIZER(runWaitStarted);
 
 2699   INITIALIZER(clearOldBackups);
 
 2701   FINALIZER(runClearTable);
 
 2703 TESTCASE(
"Bug29167", 
"")
 
 2705   INITIALIZER(runWaitStarted);
 
 2708 TESTCASE(
"Bug28770",
 
 2709          "Check readTableFile1 fails, readTableFile2 succeeds\n" 
 2710          "1. Restart all node -nostart\n" 
 2711          "2. Insert error 6100 into all nodes\n" 
 2712          "3. Start all nodes\n" 
 2713          "4. Ensure cluster start\n" 
 2714          "5. Read and verify reocrds\n" 
 2715          "6. Repeat until looping is completed\n"){
 
 2716   INITIALIZER(runWaitStarted);
 
 2717   INITIALIZER(runClearTable);
 
 2719   FINALIZER(runClearTable);
 
 2721 TESTCASE(
"Bug22696", 
"")
 
 2723   INITIALIZER(runWaitStarted);
 
 2724   INITIALIZER(runLoadTable);
 
 2725   INITIALIZER(runBug22696);
 
 2726   FINALIZER(runClearTable);
 
 2728 TESTCASE(
"to", 
"Take-over during SR")
 
 2730   INITIALIZER(runWaitStarted);
 
 2731   INITIALIZER(runLoadTable);
 
 2733   FINALIZER(runClearTable);
 
 2735 TESTCASE(
"basic", 
"")
 
 2737   INITIALIZER(runWaitStarted);
 
 2738   INITIALIZER(runCreateAllTables);
 
 2740   FINALIZER(runDropAllTables);
 
 2742 TESTCASE(
"Bug41915", 
"")
 
 2744   TC_PROPERTY(
"ALL", 1);
 
 2745   TC_PROPERTY(
"ERROR", 5053);
 
 2746   TC_PROPERTY(
"ROWS", 30);
 
 2747   INITIALIZER(runWaitStarted);
 
 2750   FINALIZER(runClearTable);
 
 2752 TESTCASE(
"Bug45154", 
"")
 
 2754   INITIALIZER(runBug45154);
 
 2756 TESTCASE(
"Bug46651", 
"")
 
 2758   INITIALIZER(runBug46651);
 
 2760 TESTCASE(
"Bug46412", 
"")
 
 2762   INITIALIZER(runBug46412);
 
 2764 TESTCASE(
"Bug48436", 
"")
 
 2766   INITIALIZER(runLoadTable);
 
 2768   STEP(runScanUpdateUntilStopped);
 
 2770 TESTCASE(
"Bug54611", 
"")
 
 2772   INITIALIZER(runLoadTable);
 
 2773   INITIALIZER(runBug54611);
 
 2775 TESTCASE(
"Bug56961", 
"")
 
 2777   INITIALIZER(runLoadTable);
 
 2778   INITIALIZER(runBug56961);
 
 2780 NDBT_TESTSUITE_END(testSystemRestart);
 
 2782 int main(
int argc, 
const char** argv){
 
 2784   NDBT_TESTSUITE_INSTANCE(testSystemRestart);
 
 2785   return testSystemRestart.execute(argc, argv);