本文整理汇总了C++中NdbRestarter::restartAll方法的典型用法代码示例。如果您正苦于以下问题:C++ NdbRestarter::restartAll方法的具体用法?C++ NdbRestarter::restartAll怎么用?C++ NdbRestarter::restartAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NdbRestarter
的用法示例。
在下文中一共展示了NdbRestarter::restartAll方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: restart
static int restart()
{
g_info << "Restarting cluster" << endl;
g_hugo_ops->closeTransaction(g_ndb);
disconnect_ndb();
delete g_hugo_ops;
require(!g_restarter.restartAll());
require(!g_restarter.waitClusterStarted(30));
require(!connect_ndb());
g_table = g_ndb->getDictionary()->getTable(g_tablename);
require(g_table);
require(g_hugo_ops = new HugoOperations(* g_table));
require(!g_hugo_ops->startTransaction(g_ndb));
return 0;
}
示例5: runRestoreBankAndVerify
int runRestoreBankAndVerify(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter;
NdbBackup backup(GETNDB(step)->getNodeId()+1);
unsigned minBackupId = ctx->getProperty("MinBackupId");
unsigned maxBackupId = ctx->getProperty("MaxBackupId");
unsigned backupId = minBackupId;
int result = NDBT_OK;
int errSumAccounts = 0;
int errValidateGL = 0;
ndbout << " maxBackupId = " << maxBackupId << endl;
ndbout << " minBackupId = " << minBackupId << endl;
while (backupId <= maxBackupId){
// TEMPORARY FIX
// To erase all tables from cache(s)
// To be removed, maybe replaced by ndb.invalidate();
runDropTable(ctx,step);
{
Bank bank(ctx->m_cluster_connection);
if (bank.dropBank() != NDBT_OK){
result = NDBT_FAILED;
break;
}
}
// END TEMPORARY FIX
ndbout << "Performing restart" << endl;
if (restarter.restartAll(false) != 0)
return NDBT_FAILED;
if (restarter.waitClusterStarted() != 0)
return NDBT_FAILED;
ndbout << "Restoring backup " << backupId << endl;
if (backup.restore(backupId) == -1){
return NDBT_FAILED;
}
ndbout << "Backup " << backupId << " restored" << endl;
// Let bank verify
Bank bank(ctx->m_cluster_connection);
int wait = 0;
int yield = 1;
if (bank.performSumAccounts(wait, yield) != 0){
ndbout << "bank.performSumAccounts FAILED" << endl;
ndbout << " backupId = " << backupId << endl << endl;
result = NDBT_FAILED;
errSumAccounts++;
}
if (bank.performValidateAllGLs() != 0){
ndbout << "bank.performValidateAllGLs FAILED" << endl;
ndbout << " backupId = " << backupId << endl << endl;
result = NDBT_FAILED;
errValidateGL++;
}
backupId++;
}
if (result != NDBT_OK){
ndbout << "Verification of backup failed" << endl
<< " errValidateGL="<<errValidateGL<<endl
<< " errSumAccounts="<<errSumAccounts<<endl << endl;
}
return result;
}
示例6: runTestSingleUserMode
int runTestSingleUserMode(NDBT_Context* ctx, NDBT_Step* step){
int result = NDBT_OK;
int loops = ctx->getNumLoops();
int records = ctx->getNumRecords();
Ndb* pNdb = GETNDB(step);
NdbRestarter restarter;
char tabName[255];
strncpy(tabName, ctx->getTab()->getName(), 255);
ndbout << "tabName="<<tabName<<endl;
int i = 0;
int count;
HugoTransactions hugoTrans(*ctx->getTab());
UtilTransactions utilTrans(*ctx->getTab());
while (i<loops && result == NDBT_OK) {
g_info << i << ": ";
int timeout = 120;
// Test that the single user mode api can do everything
CHECK(restarter.enterSingleUserMode(pNdb->getNodeId()) == 0);
CHECK(restarter.waitClusterSingleUser(timeout) == 0);
CHECK(hugoTrans.loadTable(pNdb, records, 128) == 0);
CHECK(hugoTrans.pkReadRecords(pNdb, records) == 0);
CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
CHECK(count == records);
CHECK(hugoTrans.pkDelRecords(pNdb, records/2) == 0);
CHECK(hugoTrans.scanReadRecords(pNdb, records/2, 0, 64) == 0);
CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
CHECK(count == (records/2));
CHECK(utilTrans.clearTable(pNdb, records/2) == 0);
CHECK(restarter.exitSingleUserMode() == 0);
CHECK(restarter.waitClusterStarted(timeout) == 0);
// Test create index in single user mode
CHECK(restarter.enterSingleUserMode(pNdb->getNodeId()) == 0);
CHECK(restarter.waitClusterSingleUser(timeout) == 0);
CHECK(create_index_on_pk(pNdb, tabName) == 0);
CHECK(hugoTrans.loadTable(pNdb, records, 128) == 0);
CHECK(hugoTrans.pkReadRecords(pNdb, records) == 0);
CHECK(hugoTrans.pkUpdateRecords(pNdb, records) == 0);
CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
CHECK(count == records);
CHECK(hugoTrans.pkDelRecords(pNdb, records/2) == 0);
CHECK(drop_index_on_pk(pNdb, tabName) == 0);
CHECK(restarter.exitSingleUserMode() == 0);
CHECK(restarter.waitClusterStarted(timeout) == 0);
// Test recreate index in single user mode
CHECK(create_index_on_pk(pNdb, tabName) == 0);
CHECK(hugoTrans.loadTable(pNdb, records, 128) == 0);
CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
CHECK(restarter.enterSingleUserMode(pNdb->getNodeId()) == 0);
CHECK(restarter.waitClusterSingleUser(timeout) == 0);
CHECK(drop_index_on_pk(pNdb, tabName) == 0);
CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
CHECK(create_index_on_pk(pNdb, tabName) == 0);
CHECK(restarter.exitSingleUserMode() == 0);
CHECK(restarter.waitClusterStarted(timeout) == 0);
CHECK(drop_index_on_pk(pNdb, tabName) == 0);
CHECK(utilTrans.clearTable(GETNDB(step), records) == 0);
ndbout << "Restarting cluster" << endl;
CHECK(restarter.restartAll() == 0);
CHECK(restarter.waitClusterStarted(timeout) == 0);
CHECK(pNdb->waitUntilReady(timeout) == 0);
i++;
}
return result;
}
示例7: 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;
}
示例8: GETNDB
int
runPostUpgradeChecks(NDBT_Context* ctx, NDBT_Step* step)
{
/**
* Table will be dropped/recreated
* automatically by NDBT...
* so when we enter here, this is already tested
*/
NdbBackup backup;
ndbout << "Starting backup..." << flush;
if (backup.start() != 0)
{
ndbout << "Failed" << endl;
return NDBT_FAILED;
}
ndbout << "done" << endl;
if ((ctx->getProperty("NoDDL", Uint32(0)) == 0) &&
(ctx->getProperty("KeepFS", Uint32(0)) != 0))
{
/**
* Bug48227
* Upgrade with FS 6.3->7.0, followed by table
* create, followed by Sys restart resulted in
* table loss.
*/
Ndb* pNdb = GETNDB(step);
NdbDictionary::Dictionary *pDict = pNdb->getDictionary();
{
NdbDictionary::Dictionary::List l;
pDict->listObjects(l);
for (Uint32 i = 0; i<l.count; i++)
ndbout_c("found %u : %s", l.elements[i].id, l.elements[i].name);
}
pDict->dropTable("I3");
if (NDBT_Tables::createTable(pNdb, "I3"))
{
ndbout_c("Failed to create table!");
ndbout << pDict->getNdbError() << endl;
return NDBT_FAILED;
}
{
NdbDictionary::Dictionary::List l;
pDict->listObjects(l);
for (Uint32 i = 0; i<l.count; i++)
ndbout_c("found %u : %s", l.elements[i].id, l.elements[i].name);
}
NdbRestarter res;
if (res.restartAll() != 0)
{
ndbout_c("restartAll() failed");
return NDBT_FAILED;
}
if (res.waitClusterStarted() != 0)
{
ndbout_c("waitClusterStarted() failed");
return NDBT_FAILED;
}
if (pDict->getTable("I3") == 0)
{
ndbout_c("Table disappered");
return NDBT_FAILED;
}
}
return NDBT_OK;
}