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

📄 testnoderestart.cpp

📁 这是linux下运行的mysql软件包,可用于linux 下安装 php + mysql + apach 的网络配置
💻 CPP
📖 第 1 页 / 共 2 页
字号:
  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;}int runBug16772(NDBT_Context* ctx, NDBT_Step* step){  NdbRestarter restarter;  if (restarter.getNumDbNodes() < 2)  {    ctx->stopTest();    return NDBT_OK;  }  int aliveNodeId = restarter.getRandomNotMasterNodeId(rand());  int deadNodeId = aliveNodeId;  while (deadNodeId == aliveNodeId)    deadNodeId = restarter.getDbNodeId(rand() % restarter.getNumDbNodes());    if (restarter.insertErrorInNode(aliveNodeId, 930))    return NDBT_FAILED;  if (restarter.restartOneDbNode(deadNodeId,				 /** initial */ false, 				 /** nostart */ true,				 /** abort   */ true))    return NDBT_FAILED;    if (restarter.waitNodesNoStart(&deadNodeId, 1))    return NDBT_FAILED;  if (restarter.startNodes(&deadNodeId, 1))    return NDBT_FAILED;  // It should now be hanging since we throw away NDB_FAILCONF  int ret = restarter.waitNodesStartPhase(&deadNodeId, 1, 3, 10);  // So this should fail...i.e it should not reach startphase 3  // Now send a NDB_FAILCONF for deadNo  int dump[] = { 7020, 323, 252, 0 };  dump[3] = deadNodeId;  if (restarter.dumpStateOneNode(aliveNodeId, dump, 4))    return NDBT_FAILED;    if (restarter.waitNodesStarted(&deadNodeId, 1))    return NDBT_FAILED;  return ret ? NDBT_OK : NDBT_FAILED;}int runBug18414(NDBT_Context* ctx, NDBT_Step* step){  NdbRestarter restarter;  if (restarter.getNumDbNodes() < 2)  {    ctx->stopTest();    return NDBT_OK;  }  Ndb* pNdb = GETNDB(step);  HugoOperations hugoOps(*ctx->getTab());  HugoTransactions hugoTrans(*ctx->getTab());  int loop = 0;  do   {    if(hugoOps.startTransaction(pNdb) != 0)      goto err;        if(hugoOps.pkUpdateRecord(pNdb, 0, 128, rand()) != 0)      goto err;        if(hugoOps.execute_NoCommit(pNdb) != 0)      goto err;    int node1 = hugoOps.getTransaction()->getConnectedNodeId();    int node2 = restarter.getRandomNodeSameNodeGroup(node1, rand());        if (node1 == -1 || node2 == -1)      break;        if (loop & 1)    {      if (restarter.insertErrorInNode(node1, 8050))	goto err;    }        int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };    if (restarter.dumpStateOneNode(node2, val2, 2))      goto err;        if (restarter.insertErrorInNode(node2, 5003))      goto err;        int res= hugoOps.execute_Rollback(pNdb);      if (restarter.waitNodesNoStart(&node2, 1) != 0)      goto err;        if (restarter.insertErrorInAllNodes(0))      goto err;        if (restarter.startNodes(&node2, 1) != 0)      goto err;        if (restarter.waitClusterStarted() != 0)      goto err;        if (hugoTrans.scanUpdateRecords(pNdb, 128) != 0)      goto err;    hugoOps.closeTransaction(pNdb);      } while(++loop < 5);    return NDBT_OK;  err:  hugoOps.closeTransaction(pNdb);  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);}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);}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 + -