本文整理汇总了C++中NdbRestarter::startAll方法的典型用法代码示例。如果您正苦于以下问题:C++ NdbRestarter::startAll方法的具体用法?C++ NdbRestarter::startAll怎么用?C++ NdbRestarter::startAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NdbRestarter
的用法示例。
在下文中一共展示了NdbRestarter::startAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bzero
int
runBug18612SR(NDBT_Context* ctx, NDBT_Step* step){
// Assume two replicas
NdbRestarter restarter;
if (restarter.getNumDbNodes() < 2)
{
ctx->stopTest();
return NDBT_OK;
}
Uint32 cnt = restarter.getNumDbNodes();
for(int loop = 0; loop < ctx->getNumLoops(); loop++)
{
int partition0[256];
int partition1[256];
bzero(partition0, sizeof(partition0));
bzero(partition1, sizeof(partition1));
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;
}
示例2: testWorker
int testWorker(NDBT_Context* ctx, NDBT_Step* step)
{
/* Run as a 'T1' testcase - do nothing for other tables */
if (strcmp(ctx->getTab()->getName(), "T1") != 0)
return NDBT_OK;
/* Worker step to run in a separate thread for
* blocking activities
* Generally the blocking of the DIH table definition flush
* blocks the completion of the drop table/node restarts,
* so this must be done in a separate thread to avoid
* deadlocks.
*/
while (!ctx->isTestStopped())
{
ndbout_c("Worker : waiting for request...");
ctx->getPropertyWait("DIHWritesRequest", 1);
if (!ctx->isTestStopped())
{
Uint32 req = ctx->getProperty("DIHWritesRequestType", (Uint32)0);
switch ((Tasks) req)
{
case DROP_TABLE_REQ:
{
/* Drop table */
ndbout_c("Worker : dropping table");
if (dropTable(ctx, step, 2) != NDBT_OK)
{
return NDBT_FAILED;
}
ndbout_c("Worker : table dropped.");
break;
}
case MASTER_RESTART_REQ:
{
ndbout_c("Worker : restarting Master");
NdbRestarter restarter;
int master_nodeid = restarter.getMasterNodeId();
ndbout_c("Worker : Restarting Master (%d)...", master_nodeid);
if (restarter.restartOneDbNode2(master_nodeid,
NdbRestarter::NRRF_NOSTART |
NdbRestarter::NRRF_FORCE |
NdbRestarter::NRRF_ABORT) ||
restarter.waitNodesNoStart(&master_nodeid, 1) ||
restarter.startAll())
{
ndbout_c("Worker : Error restarting Master.");
return NDBT_FAILED;
}
ndbout_c("Worker : Waiting for master to recover...");
if (restarter.waitNodesStarted(&master_nodeid, 1))
{
ndbout_c("Worker : Error waiting for Master restart");
return NDBT_FAILED;
}
ndbout_c("Worker : Master recovered.");
break;
}
case SLAVE_RESTART_REQ:
{
NdbRestarter restarter;
int slave_nodeid = restarter.getRandomNotMasterNodeId(rand());
ndbout_c("Worker : Restarting non-master (%d)...", slave_nodeid);
if (restarter.restartOneDbNode2(slave_nodeid,
NdbRestarter::NRRF_NOSTART |
NdbRestarter::NRRF_FORCE |
NdbRestarter::NRRF_ABORT) ||
restarter.waitNodesNoStart(&slave_nodeid, 1) ||
restarter.startAll())
{
ndbout_c("Worker : Error restarting Slave.");
return NDBT_FAILED;
}
ndbout_c("Worker : Waiting for slave to recover...");
if (restarter.waitNodesStarted(&slave_nodeid, 1))
{
ndbout_c("Worker : Error waiting for Slave restart");
return NDBT_FAILED;
}
ndbout_c("Worker : Slave recovered.");
break;
}
default:
{
break;
}
}
}
ctx->setProperty("DIHWritesRequestType", (Uint32) 0);
ctx->setProperty("DIHWritesRequest", (Uint32) 2);
}
ndbout_c("Worker, done.");
return NDBT_OK;
}