本文整理汇总了C++中NdbRestarter::getNodeTypeVersionRange方法的典型用法代码示例。如果您正苦于以下问题:C++ NdbRestarter::getNodeTypeVersionRange方法的具体用法?C++ NdbRestarter::getNodeTypeVersionRange怎么用?C++ NdbRestarter::getNodeTypeVersionRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NdbRestarter
的用法示例。
在下文中一共展示了NdbRestarter::getNodeTypeVersionRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runPostUpgradeDecideDDL
int runPostUpgradeDecideDDL(NDBT_Context* ctx, NDBT_Step* step)
{
/* We are running post-upgrade, now examine the versions
* of connected nodes and update the 'NoDDL' variable
* accordingly
*/
/* DDL should be ok as long as
* 1) All data nodes have the same version
* 2) There is not some version specific exception
*/
bool useDDL = true;
Ndb* pNdb = GETNDB(step);
NdbRestarter restarter;
int minNdbVer = 0;
int maxNdbVer = 0;
int myVer = NDB_VERSION;
if (restarter.getNodeTypeVersionRange(NDB_MGM_NODE_TYPE_NDB,
minNdbVer,
maxNdbVer) == -1)
{
g_err << "getNodeTypeVersionRange call failed" << endl;
return NDBT_FAILED;
}
if (minNdbVer != maxNdbVer)
{
useDDL = false;
ndbout << "Ndbd nodes have mixed versions, DDL not supported" << endl;
}
if (versionsSpanBoundary(myVer, minNdbVer, SchemaTransVersion))
{
useDDL = false;
ndbout << "Api and Ndbd versions span schema-trans boundary, DDL not supported" << endl;
}
ctx->setProperty("NoDDL", useDDL?0:1);
if (useDDL)
{
ndbout << "Dropping and recreating tables..." << endl;
for (int i=0; i < NDBT_Tables::getNumTables(); i++)
{
/* Drop table (ignoring rc if it doesn't exist etc...) */
pNdb->getDictionary()->dropTable(NDBT_Tables::getTable(i)->getName());
int ret= NDBT_Tables::createTable(pNdb,
NDBT_Tables::getTable(i)->getName(),
false, // temp
false); // exists ok
if(ret)
{
NdbError err = pNdb->getDictionary()->getNdbError();
g_err << "Failed to create table "
<< NDBT_Tables::getTable(i)->getName()
<< " error : "
<< err
<< endl;
/* Check for allowed exceptions during upgrade */
if (err.code == 794)
{
/* Schema feature requires data node upgrade */
if (minNdbVer >= myVer)
{
g_err << "Error 794 received, but data nodes are upgraded" << endl;
// TODO : Dump versions here
return NDBT_FAILED;
}
g_err << "Create table failure due to old version NDBDs, continuing" << endl;
}
}
}
ndbout << "Done" << endl;
}
return NDBT_OK;
}