本文整理汇总了C++中NdbRestarter类的典型用法代码示例。如果您正苦于以下问题:C++ NdbRestarter类的具体用法?C++ NdbRestarter怎么用?C++ NdbRestarter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NdbRestarter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runFail
int runFail(NDBT_Context* ctx, NDBT_Step* step){
NdbBackup backup(GETNDB(step)->getNodeId()+1);
NdbRestarter restarter;
if (restarter.getNumDbNodes() < 2){
ctx->stopTest();
return NDBT_OK;
}
if(restarter.waitClusterStarted(60) != 0){
g_err << "Cluster failed to start" << endl;
return NDBT_FAILED;
}
if (testMaster) {
if (testSlave) {
if (backup.FailMasterAsSlave(restarter) != NDBT_OK){
return NDBT_FAILED;
}
} else {
if (backup.FailMaster(restarter) != NDBT_OK){
return NDBT_FAILED;
}
}
} else {
if (backup.FailSlave(restarter) != NDBT_OK){
return NDBT_FAILED;
}
}
return NDBT_OK;
}
示例2: runCheckStarted
int runCheckStarted(NDBT_Context* ctx, NDBT_Step* step) {
// Check cluster is started
NdbRestarter restarter;
if(restarter.waitClusterStarted() != 0) {
g_err << "All nodes was not started " << endl;
return NDBT_FAILED;
}
// Check atrtclient is started
AtrtClient atrt;
if(!atrt.waitConnected()) {
g_err << "atrt server was not started " << endl;
return NDBT_FAILED;
}
// Make sure atrt assigns nodeid != -1
SqlResultSet procs;
if (!atrt.doQuery("SELECT * FROM process where type <> \'mysql\'", procs))
return NDBT_FAILED;
while (procs.next())
{
if (procs.columnAsInt("node_id") == (unsigned)-1) {
ndbout << "Found one process with node_id -1, "
<< "use --fix-nodeid=1 to atrt to fix this" << endl;
return NDBT_FAILED;
}
}
return NDBT_OK;
}
示例3: getRandomNodeId
int getRandomNodeId(NdbRestarter& _restarter) {
myRandom48Init((long)NdbTick_CurrentMillisecond());
int randomId = myRandom48(_restarter.getNumDbNodes());
int nodeId = _restarter.getDbNodeId(randomId);
return nodeId;
}
示例4: runRestartGciControl
int runRestartGciControl(NDBT_Context* ctx, NDBT_Step* step){
int records = ctx->getNumRecords();
Ndb* pNdb = GETNDB(step);
UtilTransactions utilTrans(*ctx->getTab());
NdbRestarter restarter;
// Wait until we have enough records in db
int count = 0;
while (count < records){
if (utilTrans.selectCount(pNdb, 64, &count) != 0){
ctx->stopTest();
return NDBT_FAILED;
}
}
// Restart cluster with abort
if (restarter.restartAll(false, false, true) != 0){
ctx->stopTest();
return NDBT_FAILED;
}
// Stop the other thread
ctx->stopTest();
if (restarter.waitClusterStarted(300) != 0){
return NDBT_FAILED;
}
if (pNdb->waitUntilReady() != 0){
return NDBT_FAILED;
}
return NDBT_OK;
}
示例5: runCheckAllNodesStarted
int runCheckAllNodesStarted(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter;
if(restarter.waitClusterStarted(1) != 0){
g_err << "All nodes was not started " << endl;
return NDBT_FAILED;
}
return NDBT_OK;
}
示例6: resetTransactionTimeout
int
resetTransactionTimeout(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter;
int val[] = { DumpStateOrd::TcSetApplTransactionTimeout, g_org_timeout };
if(restarter.dumpStateAllNodes(val, 2) != 0){
return NDBT_FAILED;
}
return NDBT_OK;
}
示例7: get50PercentOfNodes
int get50PercentOfNodes(NdbRestarter& restarter,
int * _nodes){
// For now simply return all nodes with even node id
// TODO Check nodegroup and return one node from each
int num50Percent = restarter.getNumDbNodes() / 2;
require(num50Percent <= MAX_NDB_NODES);
// Calculate which nodes to stop, select all even nodes
for (int i = 0; i < num50Percent; i++){
_nodes[i] = restarter.getDbNodeId(i*2);
}
return num50Percent;
}
示例8: runDropTablesRestart
int runDropTablesRestart(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter;
if (runDropTable(ctx, step) != 0)
return NDBT_FAILED;
if (restarter.restartAll(false) != 0)
return NDBT_FAILED;
if (restarter.waitClusterStarted() != 0)
return NDBT_FAILED;
return NDBT_OK;
}
示例9: runBug57650
int
runBug57650(NDBT_Context* ctx, NDBT_Step* step)
{
NdbBackup backup(GETNDB(step)->getNodeId()+1);
NdbRestarter res;
int node0 = res.getNode(NdbRestarter::NS_RANDOM);
res.insertErrorInNode(node0, 5057);
unsigned backupId = 0;
if (backup.start(backupId) == -1)
return NDBT_FAILED;
return NDBT_OK;
}
示例10: resetTransactionTimeout
int
resetTransactionTimeout(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter;
// g_org_timeout will be passed as printed int to mgm,
// then converted to Uint32 before sent to tc.
// Check convert Uint32 -> int -> Uint32 is safe
NDB_STATIC_ASSERT(UINT_MAX32 == (Uint32)(int)UINT_MAX32);
int val[] = { DumpStateOrd::TcSetApplTransactionTimeout, (int)g_org_timeout };
if(restarter.dumpStateAllNodes(val, 2) != 0){
return NDBT_FAILED;
}
return NDBT_OK;
}
示例11: runDropTablesRestart
int runDropTablesRestart(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter;
Ndb* pNdb = GETNDB(step);
const NdbDictionary::Table *tab = ctx->getTab();
pNdb->getDictionary()->dropTable(tab->getName());
if (restarter.restartAll(false) != 0)
return NDBT_FAILED;
if (restarter.waitClusterStarted() != 0)
return NDBT_FAILED;
return NDBT_OK;
}
示例12: runBug24717
int runBug24717(NDBT_Context* ctx, NDBT_Step* step){
int result = NDBT_OK;
int loops = ctx->getNumLoops();
int records = ctx->getNumRecords();
NdbRestarter restarter;
Ndb* pNdb = GETNDB(step);
HugoTransactions hugoTrans(*ctx->getTab());
int dump[] = { 9002, 0 } ;
Uint32 ownNode = refToNode(pNdb->getReference());
dump[1] = ownNode;
for (; loops; loops --)
{
int nodeId = restarter.getRandomNotMasterNodeId(rand());
restarter.restartOneDbNode(nodeId, false, true, true);
restarter.waitNodesNoStart(&nodeId, 1);
if (restarter.dumpStateOneNode(nodeId, dump, 2))
return NDBT_FAILED;
restarter.startNodes(&nodeId, 1);
do {
for (Uint32 i = 0; i < 100; i++)
{
hugoTrans.pkReadRecords(pNdb, 100, 1, NdbOperation::LM_CommittedRead);
}
} while (restarter.waitClusterStarted(5) != 0);
}
return NDBT_OK;
}
示例13: setTransactionTimeout
int
setTransactionTimeout(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter;
int timeout = ctx->getProperty("TransactionInactiveTimeout",TIMEOUT);
NdbConfig conf;
if (!conf.getProperty(conf.getMasterNodeId(),
NODE_TYPE_DB,
CFG_DB_TRANSACTION_INACTIVE_TIMEOUT,
&g_org_timeout)){
return NDBT_FAILED;
}
int val[] = { DumpStateOrd::TcSetApplTransactionTimeout, timeout };
if(restarter.dumpStateAllNodes(val, 2) != 0){
return NDBT_FAILED;
}
return NDBT_OK;
}
示例14: setDeadlockTimeout
int
setDeadlockTimeout(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter;
int timeout = ctx->getProperty("TransactionDeadlockTimeout", TIMEOUT);
NdbConfig conf;
if (!conf.getProperty(conf.getMasterNodeId(),
NODE_TYPE_DB,
CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT,
&g_org_deadlock))
return NDBT_FAILED;
g_err << "Setting timeout: " << timeout << endl;
int val[] = { DumpStateOrd::TcSetTransactionTimeout, timeout };
if(restarter.dumpStateAllNodes(val, 2) != 0){
return NDBT_FAILED;
}
return NDBT_OK;
}
示例15: runBug20185
int runBug20185(NDBT_Context* ctx, NDBT_Step* step){
int result = NDBT_OK;
int loops = ctx->getNumLoops();
int records = ctx->getNumRecords();
NdbRestarter restarter;
HugoOperations hugoOps(*ctx->getTab());
Ndb* pNdb = GETNDB(step);
int dump[] = { 7090, 20 } ;
if (restarter.dumpStateAllNodes(dump, 2))
return NDBT_FAILED;
NdbSleep_MilliSleep(3000);
if(hugoOps.startTransaction(pNdb) != 0)
return NDBT_FAILED;
if(hugoOps.pkUpdateRecord(pNdb, 1, 1) != 0)
return NDBT_FAILED;
if (hugoOps.execute_NoCommit(pNdb) != 0)
return NDBT_FAILED;
int nodeId;
const int node = hugoOps.getTransaction()->getConnectedNodeId();
do {
nodeId = restarter.getDbNodeId(rand() % restarter.getNumDbNodes());
} while (nodeId == node);
if (restarter.insertErrorInAllNodes(7030))
return NDBT_FAILED;
if (restarter.insertErrorInNode(nodeId, 7031))
return NDBT_FAILED;
NdbSleep_MilliSleep(500);
if (hugoOps.execute_Commit(pNdb) == 0)
return NDBT_FAILED;
NdbSleep_MilliSleep(3000);
restarter.waitClusterStarted();
if (restarter.dumpStateAllNodes(dump, 1))
return NDBT_FAILED;
return NDBT_OK;
}