Loading mysql-test/ndb/ndb_config_2_node.ini +4 −4 Original line number Diff line number Diff line Loading @@ -24,13 +24,13 @@ ExecuteOnComputer: 2 [MGM] PortNumber: CHOOSE_PORT_MGM [API] [MYSQLD] [API] [MYSQLD] [API] [MYSQLD] [API] [MYSQLD] [TCP DEFAULT] PortNumber: CHOOSE_PORT_TRANSPORTER ndb/src/common/mgmcommon/ConfigInfo.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,13 @@ /**************************************************************************** * Section names ****************************************************************************/ const ConfigInfo::AliasPair ConfigInfo::m_sectionNameAliases[]={ {"API", "MYSQLD"}, {0, 0} }; const char* ConfigInfo::m_sectionNames[]={ "SYSTEM", Loading Loading @@ -2063,6 +2070,14 @@ ConfigInfo::isSection(const char * section) const { return false; } const char* ConfigInfo::getAlias(const char * section) const { for (int i = 0; m_sectionNameAliases[i].name != 0; i++) if(!strcmp(section, m_sectionNameAliases[i].alias)) return m_sectionNameAliases[i].name; return 0; } bool ConfigInfo::verify(const Properties * section, const char* fname, Uint64 value) const { Loading ndb/src/common/mgmcommon/ConfigInfo.hpp +7 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,11 @@ public: Uint64 _max; }; struct AliasPair{ const char * name; const char * alias; }; /** * Entry for one section rule */ Loading Loading @@ -100,6 +105,7 @@ public: * @note Result is not defined if section/name are wrong! */ bool verify(const Properties* secti, const char* fname, Uint64 value) const; const char* getAlias(const char*) const; bool isSection(const char*) const; const char* getDescription(const Properties * sec, const char* fname) const; Loading @@ -123,6 +129,7 @@ private: static const ParamInfo m_ParamInfo[]; static const int m_NoOfParams; static const AliasPair m_sectionNameAliases[]; static const char* m_sectionNames[]; static const int m_noOfSectionNames; Loading ndb/src/common/mgmcommon/InitConfigFileParser.cpp +28 −3 Original line number Diff line number Diff line Loading @@ -222,6 +222,8 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { char tmpLine[MAX_LINE_LENGTH]; char fname[MAX_LINE_LENGTH], rest[MAX_LINE_LENGTH]; char* t; const char separator_list[]= {':', '='}; char separator= 0; if (ctx.m_currentSection == NULL){ ctx.reportError("Value specified outside section"); Loading @@ -233,7 +235,14 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { // ************************************* // Check if a separator exists in line // ************************************* if (!strchr(tmpLine, ':')) { for(int i= 0; i < sizeof(separator_list); i++) { if(strchr(tmpLine, separator_list[i])) { separator= separator_list[i]; break; } } if (separator == 0) { ctx.reportError("Parse error"); return false; } Loading @@ -247,7 +256,7 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { // Count number of tokens before separator // ***************************************** if (sscanf(t, "%120s%120s", fname, rest) != 1) { ctx.reportError("Multiple names before \':\'"); ctx.reportError("Multiple names before \'%c\'", separator); return false; } if (!ctx.m_currentInfo->contains(fname)) { Loading Loading @@ -475,8 +484,24 @@ InitConfigFileParser::parseSectionHeader(const char* line) const { tmp[0] = ' '; trim(tmp); // Convert section header to upper for(int i= strlen(tmp)-1; i >= 0; i--) tmp[i]= toupper(tmp[i]); // Get the correct header name if an alias { const char *tmp_alias= m_info->getAlias(tmp); if (tmp_alias) { free(tmp); tmp= strdup(tmp_alias); } } // Lookup token among sections if(!m_info->isSection(tmp)) return NULL; if(!m_info->isSection(tmp)) { free(tmp); return NULL; } if(m_info->getInfo(tmp)) return tmp; free(tmp); Loading Loading
mysql-test/ndb/ndb_config_2_node.ini +4 −4 Original line number Diff line number Diff line Loading @@ -24,13 +24,13 @@ ExecuteOnComputer: 2 [MGM] PortNumber: CHOOSE_PORT_MGM [API] [MYSQLD] [API] [MYSQLD] [API] [MYSQLD] [API] [MYSQLD] [TCP DEFAULT] PortNumber: CHOOSE_PORT_TRANSPORTER
ndb/src/common/mgmcommon/ConfigInfo.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,13 @@ /**************************************************************************** * Section names ****************************************************************************/ const ConfigInfo::AliasPair ConfigInfo::m_sectionNameAliases[]={ {"API", "MYSQLD"}, {0, 0} }; const char* ConfigInfo::m_sectionNames[]={ "SYSTEM", Loading Loading @@ -2063,6 +2070,14 @@ ConfigInfo::isSection(const char * section) const { return false; } const char* ConfigInfo::getAlias(const char * section) const { for (int i = 0; m_sectionNameAliases[i].name != 0; i++) if(!strcmp(section, m_sectionNameAliases[i].alias)) return m_sectionNameAliases[i].name; return 0; } bool ConfigInfo::verify(const Properties * section, const char* fname, Uint64 value) const { Loading
ndb/src/common/mgmcommon/ConfigInfo.hpp +7 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,11 @@ public: Uint64 _max; }; struct AliasPair{ const char * name; const char * alias; }; /** * Entry for one section rule */ Loading Loading @@ -100,6 +105,7 @@ public: * @note Result is not defined if section/name are wrong! */ bool verify(const Properties* secti, const char* fname, Uint64 value) const; const char* getAlias(const char*) const; bool isSection(const char*) const; const char* getDescription(const Properties * sec, const char* fname) const; Loading @@ -123,6 +129,7 @@ private: static const ParamInfo m_ParamInfo[]; static const int m_NoOfParams; static const AliasPair m_sectionNameAliases[]; static const char* m_sectionNames[]; static const int m_noOfSectionNames; Loading
ndb/src/common/mgmcommon/InitConfigFileParser.cpp +28 −3 Original line number Diff line number Diff line Loading @@ -222,6 +222,8 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { char tmpLine[MAX_LINE_LENGTH]; char fname[MAX_LINE_LENGTH], rest[MAX_LINE_LENGTH]; char* t; const char separator_list[]= {':', '='}; char separator= 0; if (ctx.m_currentSection == NULL){ ctx.reportError("Value specified outside section"); Loading @@ -233,7 +235,14 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { // ************************************* // Check if a separator exists in line // ************************************* if (!strchr(tmpLine, ':')) { for(int i= 0; i < sizeof(separator_list); i++) { if(strchr(tmpLine, separator_list[i])) { separator= separator_list[i]; break; } } if (separator == 0) { ctx.reportError("Parse error"); return false; } Loading @@ -247,7 +256,7 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { // Count number of tokens before separator // ***************************************** if (sscanf(t, "%120s%120s", fname, rest) != 1) { ctx.reportError("Multiple names before \':\'"); ctx.reportError("Multiple names before \'%c\'", separator); return false; } if (!ctx.m_currentInfo->contains(fname)) { Loading Loading @@ -475,8 +484,24 @@ InitConfigFileParser::parseSectionHeader(const char* line) const { tmp[0] = ' '; trim(tmp); // Convert section header to upper for(int i= strlen(tmp)-1; i >= 0; i--) tmp[i]= toupper(tmp[i]); // Get the correct header name if an alias { const char *tmp_alias= m_info->getAlias(tmp); if (tmp_alias) { free(tmp); tmp= strdup(tmp_alias); } } // Lookup token among sections if(!m_info->isSection(tmp)) return NULL; if(!m_info->isSection(tmp)) { free(tmp); return NULL; } if(m_info->getInfo(tmp)) return tmp; free(tmp); Loading