本文整理汇总了C++中NdbRestarter::enterSingleUserMode方法的典型用法代码示例。如果您正苦于以下问题:C++ NdbRestarter::enterSingleUserMode方法的具体用法?C++ NdbRestarter::enterSingleUserMode怎么用?C++ NdbRestarter::enterSingleUserMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NdbRestarter
的用法示例。
在下文中一共展示了NdbRestarter::enterSingleUserMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}