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

📄 testnoderestart.cpp

📁 mysql数据库
💻 CPP
📖 第 1 页 / 共 2 页
字号:
  int dump[2] = { DumpStateOrd::LqhErrorInsert5042, 0 };  dump[1] = tableId;  int nodeId = restarter.getDbNodeId(1);  ndbout << "Restart node " << nodeId << endl;     if (restarter.restartOneDbNode(nodeId,				 /** initial */ false, 				 /** nostart */ true,				 /** abort   */ true))    return NDBT_FAILED;    if (restarter.waitNodesNoStart(&nodeId, 1))    return NDBT_FAILED;      if (restarter.dumpStateOneNode(nodeId, dump, 2))    return NDBT_FAILED;  if (restarter.startNodes(&nodeId, 1))    return NDBT_FAILED;  if (restarter.waitNodesStarted(&nodeId, 1))    return NDBT_FAILED;    ctx->stopTest();  return NDBT_OK;}int runBug15632(NDBT_Context* ctx, NDBT_Step* step){  int result = NDBT_OK;  int loops = ctx->getNumLoops();  int records = ctx->getNumRecords();  NdbRestarter restarter;    int nodeId = restarter.getDbNodeId(1);  ndbout << "Restart node " << nodeId << endl;     if (restarter.restartOneDbNode(nodeId,				 /** initial */ false, 				 /** nostart */ true,				 /** abort   */ true))    return NDBT_FAILED;    if (restarter.waitNodesNoStart(&nodeId, 1))    return NDBT_FAILED;      if (restarter.insertErrorInNode(nodeId, 7165))    return NDBT_FAILED;    if (restarter.startNodes(&nodeId, 1))    return NDBT_FAILED;  if (restarter.waitNodesStarted(&nodeId, 1))    return NDBT_FAILED;  if (restarter.restartOneDbNode(nodeId,				 /** initial */ false, 				 /** nostart */ true,				 /** abort   */ true))    return NDBT_FAILED;    if (restarter.waitNodesNoStart(&nodeId, 1))    return NDBT_FAILED;      if (restarter.insertErrorInNode(nodeId, 7171))    return NDBT_FAILED;    if (restarter.startNodes(&nodeId, 1))    return NDBT_FAILED;    if (restarter.waitNodesStarted(&nodeId, 1))    return NDBT_FAILED;    ctx->stopTest();  return NDBT_OK;}int runBug15685(NDBT_Context* ctx, NDBT_Step* step){  Ndb* pNdb = GETNDB(step);  HugoOperations hugoOps(*ctx->getTab());  NdbRestarter restarter;  HugoTransactions hugoTrans(*ctx->getTab());  if (hugoTrans.loadTable(GETNDB(step), 10) != 0){    return NDBT_FAILED;  }  if(hugoOps.startTransaction(pNdb) != 0)    goto err;    if(hugoOps.pkUpdateRecord(pNdb, 0, 1, rand()) != 0)    goto err;  if(hugoOps.execute_NoCommit(pNdb) != 0)    goto err;  if (restarter.insertErrorInAllNodes(5100))    return NDBT_FAILED;    hugoOps.execute_Rollback(pNdb);  if (restarter.waitClusterStarted() != 0)    goto err;  if (restarter.insertErrorInAllNodes(0))    return NDBT_FAILED;    ctx->stopTest();  return NDBT_OK;  err:  ctx->stopTest();  return NDBT_FAILED;}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);}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 + -