⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testnoderestart.cpp

📁 mysql-5.0.22.tar.gz源码包
💻 CPP
📖 第 1 页 / 共 3 页
字号:
    Bitmask<4> nodesmask;        Uint32 node1 = restarter.getDbNodeId(rand()%cnt);    for (Uint32 i = 0; i<cnt/2; i++)    {      do { 	int tmp = restarter.getRandomNodeOtherNodeGroup(node1, rand());	if (tmp == -1)	  break;	node1 = tmp;      } while(nodesmask.get(node1));            partition0[i] = node1;      partition1[i] = restarter.getRandomNodeSameNodeGroup(node1, rand());            ndbout_c("nodes %d %d", node1, partition1[i]);            assert(!nodesmask.get(node1));      assert(!nodesmask.get(partition1[i]));      nodesmask.set(node1);      nodesmask.set(partition1[i]);    }         ndbout_c("done");    if (restarter.restartAll(false, true, false))      return NDBT_FAILED;    int dump[255];    dump[0] = 9000;    memcpy(dump + 1, partition0, sizeof(int)*cnt/2);        for (Uint32 i = 0; i<cnt/2; i++)      if (restarter.dumpStateOneNode(partition1[i], dump, 1+cnt/2))	return NDBT_FAILED;    dump[0] = 9000;    memcpy(dump + 1, partition1, sizeof(int)*cnt/2);        for (Uint32 i = 0; i<cnt/2; i++)      if (restarter.dumpStateOneNode(partition0[i], dump, 1+cnt/2))	return NDBT_FAILED;    int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };        if (restarter.dumpStateAllNodes(val2, 2))      return NDBT_FAILED;        if (restarter.insertErrorInAllNodes(932))      return NDBT_FAILED;        if (restarter.startAll())      return NDBT_FAILED;        if (restarter.waitClusterStartPhase(2))      return NDBT_FAILED;        dump[0] = 9001;    for (Uint32 i = 0; i<cnt/2; i++)      if (restarter.dumpStateAllNodes(dump, 2))	return NDBT_FAILED;    if (restarter.waitClusterNoStart(30))      if (restarter.waitNodesNoStart(partition0, cnt/2, 10))	if (restarter.waitNodesNoStart(partition1, cnt/2, 10))	  return NDBT_FAILED;        if (restarter.startAll())      return NDBT_FAILED;        if (restarter.waitClusterStarted())      return NDBT_FAILED;  }  return NDBT_OK;}NDBT_TESTSUITE(testNodeRestart);TESTCASE("NoLoad", 	 "Test that one node at a time can be stopped and then restarted "\	 "when there are no load on the system. Do this loop number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarter);  FINALIZER(runClearTable);}TESTCASE("PkRead", 	 "Test that one node at a time can be stopped and then restarted "\	 "perform pk read while restarting. Do this loop number of times"){   TC_PROPERTY("ReadLockMode", NdbOperation::LM_Read);  INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarter);  STEP(runPkReadUntilStopped);  FINALIZER(runClearTable);}TESTCASE("PkReadCommitted", 	 "Test that one node at a time can be stopped and then restarted "\	 "perform pk read while restarting. Do this loop number of times"){   TC_PROPERTY("ReadLockMode", NdbOperation::LM_CommittedRead);  INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarter);  STEP(runPkReadUntilStopped);  FINALIZER(runClearTable);}TESTCASE("MixedPkRead", 	 "Test that one node at a time can be stopped and then restarted "\	 "perform pk read while restarting. Do this loop number of times"){   TC_PROPERTY("ReadLockMode", -1);  INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarter);  STEP(runPkReadUntilStopped);  FINALIZER(runClearTable);}TESTCASE("PkReadPkUpdate", 	 "Test that one node at a time can be stopped and then restarted "\	 "perform pk read and pk update while restarting. Do this loop number of times"){   TC_PROPERTY("ReadLockMode", NdbOperation::LM_Read);  INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarter);  STEP(runPkReadUntilStopped);  STEP(runPkUpdateUntilStopped);  STEP(runPkReadPkUpdateUntilStopped);  STEP(runPkReadUntilStopped);  STEP(runPkUpdateUntilStopped);  STEP(runPkReadPkUpdateUntilStopped);  FINALIZER(runClearTable);}TESTCASE("MixedPkReadPkUpdate", 	 "Test that one node at a time can be stopped and then restarted "\	 "perform pk read and pk update while restarting. Do this loop number of times"){   TC_PROPERTY("ReadLockMode", -1);  INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarter);  STEP(runPkReadUntilStopped);  STEP(runPkUpdateUntilStopped);  STEP(runPkReadPkUpdateUntilStopped);  STEP(runPkReadUntilStopped);  STEP(runPkUpdateUntilStopped);  STEP(runPkReadPkUpdateUntilStopped);  FINALIZER(runClearTable);}TESTCASE("ReadUpdateScan", 	 "Test that one node at a time can be stopped and then restarted "\	 "perform pk read, pk update and scan reads while restarting. Do this loop number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarter);  STEP(runPkReadUntilStopped);  STEP(runPkUpdateUntilStopped);  STEP(runPkReadPkUpdateUntilStopped);  STEP(runScanReadUntilStopped);  STEP(runScanUpdateUntilStopped);  FINALIZER(runClearTable);}TESTCASE("MixedReadUpdateScan", 	 "Test that one node at a time can be stopped and then restarted "\	 "perform pk read, pk update and scan reads while restarting. Do this loop number of times"){   TC_PROPERTY("ReadLockMode", -1);  INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarter);  STEP(runPkReadUntilStopped);  STEP(runPkUpdateUntilStopped);  STEP(runPkReadPkUpdateUntilStopped);  STEP(runScanReadUntilStopped);  STEP(runScanUpdateUntilStopped);  FINALIZER(runClearTable);}TESTCASE("Terror", 	 "Test that one node at a time can be stopped and then restarted "\	 "perform all kind of transactions while restarting. Do this loop number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarter);  STEP(runPkReadUntilStopped);  STEP(runPkUpdateUntilStopped);  STEP(runScanReadUntilStopped);  STEP(runScanUpdateUntilStopped);  FINALIZER(runClearTable);}TESTCASE("FullDb", 	 "Test that one node at a time can be stopped and then restarted "\	 "when db is full. Do this loop number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runFillTable);  STEP(runRestarter);  FINALIZER(runClearTable);}TESTCASE("RestartRandomNode", 	 "Test that we can execute the restart RestartRandomNode loop\n"\	 "number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarts);  FINALIZER(runScanReadVerify);  FINALIZER(runClearTable);}TESTCASE("RestartRandomNodeError", 	 "Test that we can execute the restart RestartRandomNodeError loop\n"\	 "number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarts);  FINALIZER(runScanReadVerify);  FINALIZER(runClearTable);}TESTCASE("RestartRandomNodeInitial", 	 "Test that we can execute the restart RestartRandomNodeInitial loop\n"\	 "number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarts);  FINALIZER(runScanReadVerify);  FINALIZER(runClearTable);}TESTCASE("RestartNFDuringNR", 	 "Test that we can execute the restart RestartNFDuringNR loop\n"\	 "number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarts);  STEP(runPkUpdateUntilStopped);  STEP(runScanUpdateUntilStopped);  FINALIZER(runScanReadVerify);  FINALIZER(runClearTable);}TESTCASE("RestartMasterNodeError", 	 "Test that we can execute the restart RestartMasterNodeError loop\n"\	 "number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarts);  FINALIZER(runScanReadVerify);  FINALIZER(runClearTable);}TESTCASE("TwoNodeFailure", 	 "Test that we can execute the restart TwoNodeFailure\n"\	 "(which is a multiple node failure restart) loop\n"\	 "number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarts);  FINALIZER(runScanReadVerify);  FINALIZER(runClearTable);}TESTCASE("TwoMasterNodeFailure", 	 "Test that we can execute the restart TwoMasterNodeFailure\n"\	 "(which is a multiple node failure restart) loop\n"\	 "number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarts);  FINALIZER(runScanReadVerify);  FINALIZER(runClearTable);}TESTCASE("FiftyPercentFail", 	 "Test that we can execute the restart FiftyPercentFail\n"\	 "(which is a multiple node failure restart) loop\n"\	 "number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarts);  FINALIZER(runScanReadVerify);  FINALIZER(runClearTable);}TESTCASE("RestartAllNodes", 	 "Test that we can execute the restart RestartAllNodes\n"\	 "(which is a system  restart) loop\n"\	 "number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarts);  FINALIZER(runScanReadVerify);  FINALIZER(runClearTable);}TESTCASE("RestartAllNodesAbort", 	 "Test that we can execute the restart RestartAllNodesAbort\n"\	 "(which is a system  restart) loop\n"\	 "number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarts);  FINALIZER(runScanReadVerify);  FINALIZER(runClearTable);}TESTCASE("RestartAllNodesError9999", 	 "Test that we can execute the restart RestartAllNodesError9999\n"\	 "(which is a system  restart) loop\n"\	 "number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarts);  FINALIZER(runScanReadVerify);  FINALIZER(runClearTable);}TESTCASE("FiftyPercentStopAndWait", 	 "Test that we can execute the restart FiftyPercentStopAndWait\n"\	 "(which is a system  restart) loop\n"\	 "number of times"){  INITIALIZER(runCheckAllNodesStarted);   INITIALIZER(runLoadTable);  STEP(runRestarts);  FINALIZER(runScanReadVerify);  FINALIZER(runClearTable);}TESTCASE("RestartNodeDuringLCP", 	 "Test that we can execute the restart RestartRandomNode loop\n"\	 "number of times"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarts);  STEP(runPkUpdateUntilStopped);  STEP(runScanUpdateUntilStopped);  FINALIZER(runScanReadVerify);  FINALIZER(runClearTable);}TESTCASE("StopOnError", 	 "Test StopOnError. A node that has StopOnError set to false "\	 "should restart automatically when an error occurs"){   INITIALIZER(runCheckAllNodesStarted);  INITIALIZER(runLoadTable);  STEP(runRestarts);  FINALIZER(runScanReadVerify);  FINALIZER(runClearTable);}TESTCASE("CommittedRead", 	 "Test committed read"){   INITIALIZER(runLoadTable);  STEP(runDirtyRead);  FINALIZER(runClearTable);}TESTCASE("LateCommit",	 "Test commit after node failure"){  INITIALIZER(runLoadTable);  STEP(runLateCommit);  FINALIZER(runClearTable);}TESTCASE("Bug15587",	 "Test bug with NF during NR"){  INITIALIZER(runLoadTable);  STEP(runScanUpdateUntilStopped);  STEP(runBug15587);  FINALIZER(runClearTable);}TESTCASE("Bug15632",	 "Test bug with NF during NR"){  INITIALIZER(runLoadTable);  STEP(runBug15632);  FINALIZER(runClearTable);}TESTCASE("Bug15685",	 "Test bug with NF during abort"){  STEP(runBug15685);  FINALIZER(runClearTable);}TESTCASE("Bug16772",	 "Test bug with restarting before NF handling is complete"){  STEP(runBug16772);}TESTCASE("Bug18414",	 "Test bug with NF during NR"){  INITIALIZER(runLoadTable);  STEP(runBug18414);  FINALIZER(runClearTable);}TESTCASE("Bug18612",	 "Test bug with partitioned clusters"){  INITIALIZER(runLoadTable);  STEP(runBug18612);  FINALIZER(runClearTable);}TESTCASE("Bug18612SR",	 "Test bug with partitioned clusters"){  INITIALIZER(runLoadTable);  STEP(runBug18612SR);  FINALIZER(runClearTable);}NDBT_TESTSUITE_END(testNodeRestart);int main(int argc, const char** argv){  ndb_init();#if 0  // It might be interesting to have longer defaults for num  // loops in this test  // Just performing 100 node restarts would not be enough?  // We can have initialisers in the NDBT_Testcase class like   // this...  testNodeRestart.setDefaultLoops(1000);#endif  return testNodeRestart.execute(argc, argv);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -