当前位置: 首页>>代码示例>>C++>>正文


C++ NdbRestarter::getNodeTypeVersionRange方法代码示例

本文整理汇总了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;
}
开发者ID:,项目名称:,代码行数:80,代码来源:


注:本文中的NdbRestarter::getNodeTypeVersionRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。