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/include/util/Properties.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ public: static const char delimiter = ':'; static const char version[]; Properties(); Properties(bool case_insensitive= false); Properties(const Properties &); Properties(const Property *, int len); virtual ~Properties(); Loading ndb/src/common/mgmcommon/ConfigInfo.cpp +36 −24 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 @@ -1885,21 +1892,19 @@ const int ConfigInfo::m_NoOfParams = sizeof(m_ParamInfo) / sizeof(ParamInfo); ****************************************************************************/ static void require(bool v) { if(!v) abort();} ConfigInfo::ConfigInfo() { ConfigInfo::ConfigInfo() : m_info(true), m_systemDefaults(true) { int i; Properties *section; const Properties *oldpinfo; m_info.setCaseInsensitiveNames(true); m_systemDefaults.setCaseInsensitiveNames(true); for (i=0; i<m_NoOfParams; i++) { const ParamInfo & param = m_ParamInfo[i]; // Create new section if it did not exist if (!m_info.getCopy(param._section, §ion)) { Properties newsection; newsection.setCaseInsensitiveNames(true); Properties newsection(true); m_info.put(param._section, &newsection); } Loading @@ -1907,7 +1912,7 @@ ConfigInfo::ConfigInfo() { m_info.getCopy(param._section, §ion); // Create pinfo (parameter info) entry Properties pinfo; Properties pinfo(true); pinfo.put("Id", param._paramId); pinfo.put("Fname", param._fname); pinfo.put("Description", param._description); Loading Loading @@ -1935,8 +1940,7 @@ ConfigInfo::ConfigInfo() { if(param._type != ConfigInfo::SECTION){ Properties * p; if(!m_systemDefaults.getCopy(param._section, &p)){ p = new Properties(); p->setCaseInsensitiveNames(true); p = new Properties(true); } if(param._type != STRING && param._default != UNDEFINED && Loading Loading @@ -2063,6 +2067,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 Loading @@ -2819,7 +2831,7 @@ fixDepricated(InitConfigFileParser::Context & ctx, const char * data){ * Transform old values to new values * Transform new values to old values (backward compatible) */ Properties tmp; Properties tmp(true); Properties::Iterator it(ctx.m_currentSection); for (name = it.first(); name != NULL; name = it.next()) { const DepricationTransform * p = &f_deprication[0]; Loading Loading @@ -2951,8 +2963,8 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, { Uint32 i; Properties * props= ctx.m_config; Properties p_connections; Properties p_connections2; Properties p_connections(true); Properties p_connections2(true); for (i = 0;; i++){ const Properties * tmp; Loading @@ -2972,8 +2984,8 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, Uint32 nNodes; ctx.m_userProperties.get("NoOfNodes", &nNodes); Properties p_db_nodes; Properties p_api_mgm_nodes; Properties p_db_nodes(true); Properties p_api_mgm_nodes(true); Uint32 i_db= 0, i_api_mgm= 0, n; for (i= 0, n= 0; n < nNodes; i++){ Loading @@ -2999,7 +3011,7 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, if(!p_connections2.get("", nodeId1+nodeId2<<16, &dummy)) { ConfigInfo::ConfigRuleSection s; s.m_sectionType= BaseString("TCP"); s.m_sectionData= new Properties; s.m_sectionData= new Properties(true); char buf[16]; snprintf(buf, sizeof(buf), "%u", nodeId1); s.m_sectionData->put("NodeId1", buf); Loading @@ -3016,7 +3028,7 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, if(!p_db_nodes.get("", j, &nodeId2)) break; ConfigInfo::ConfigRuleSection s; s.m_sectionType= BaseString("TCP"); s.m_sectionData= new Properties; s.m_sectionData= new Properties(true); char buf[16]; snprintf(buf, sizeof(buf), "%u", nodeId1); s.m_sectionData->put("NodeId1", buf); Loading @@ -3037,7 +3049,7 @@ static bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>§ions, { #if 0 Properties * props= ctx.m_config; Properties computers; Properties computers(true); Uint32 port_base = NDB_BASE_PORT+2; Uint32 nNodes; 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 +34 −9 Original line number Diff line number Diff line Loading @@ -43,10 +43,10 @@ InitConfigFileParser::~InitConfigFileParser() { // Read Config File //**************************************************************************** InitConfigFileParser::Context::Context(const ConfigInfo * info) : m_configValues(1000, 20) { : m_configValues(1000, 20), m_userProperties(true) { m_config = new Properties(); m_defaults = new Properties(); m_config = new Properties(true); m_defaults = new Properties(true); } InitConfigFileParser::Context::~Context(){ Loading Loading @@ -115,7 +115,7 @@ InitConfigFileParser::parseConfig(FILE * file) { snprintf(ctx.fname, sizeof(ctx.fname), section); free(section); ctx.type = InitConfigFileParser::DefaultSection; ctx.m_sectionLineno = ctx.m_lineno; ctx.m_currentSection = new Properties(); ctx.m_currentSection = new Properties(true); ctx.m_userDefaults = NULL; ctx.m_currentInfo = m_info->getInfo(ctx.fname); ctx.m_systemDefaults = m_info->getDefaults(ctx.fname); Loading @@ -137,7 +137,7 @@ InitConfigFileParser::parseConfig(FILE * file) { free(section); ctx.type = InitConfigFileParser::Section; ctx.m_sectionLineno = ctx.m_lineno; ctx.m_currentSection = new Properties(); ctx.m_currentSection = new Properties(true); ctx.m_userDefaults = getSection(ctx.fname, ctx.m_defaults); ctx.m_currentInfo = m_info->getInfo(ctx.fname); ctx.m_systemDefaults = m_info->getDefaults(ctx.fname); Loading 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[]= {":", "="}; const 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][0])) { separator= separator_list[i]; break; } } if (separator == 0) { ctx.reportError("Parse error"); return false; } Loading @@ -241,13 +250,13 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { // ******************************************* // Get pointer to substring before separator // ******************************************* t = strtok(tmpLine, ":"); t = strtok(tmpLine, separator); // ***************************************** // 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[0]); 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/include/util/Properties.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ public: static const char delimiter = ':'; static const char version[]; Properties(); Properties(bool case_insensitive= false); Properties(const Properties &); Properties(const Property *, int len); virtual ~Properties(); Loading
ndb/src/common/mgmcommon/ConfigInfo.cpp +36 −24 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 @@ -1885,21 +1892,19 @@ const int ConfigInfo::m_NoOfParams = sizeof(m_ParamInfo) / sizeof(ParamInfo); ****************************************************************************/ static void require(bool v) { if(!v) abort();} ConfigInfo::ConfigInfo() { ConfigInfo::ConfigInfo() : m_info(true), m_systemDefaults(true) { int i; Properties *section; const Properties *oldpinfo; m_info.setCaseInsensitiveNames(true); m_systemDefaults.setCaseInsensitiveNames(true); for (i=0; i<m_NoOfParams; i++) { const ParamInfo & param = m_ParamInfo[i]; // Create new section if it did not exist if (!m_info.getCopy(param._section, §ion)) { Properties newsection; newsection.setCaseInsensitiveNames(true); Properties newsection(true); m_info.put(param._section, &newsection); } Loading @@ -1907,7 +1912,7 @@ ConfigInfo::ConfigInfo() { m_info.getCopy(param._section, §ion); // Create pinfo (parameter info) entry Properties pinfo; Properties pinfo(true); pinfo.put("Id", param._paramId); pinfo.put("Fname", param._fname); pinfo.put("Description", param._description); Loading Loading @@ -1935,8 +1940,7 @@ ConfigInfo::ConfigInfo() { if(param._type != ConfigInfo::SECTION){ Properties * p; if(!m_systemDefaults.getCopy(param._section, &p)){ p = new Properties(); p->setCaseInsensitiveNames(true); p = new Properties(true); } if(param._type != STRING && param._default != UNDEFINED && Loading Loading @@ -2063,6 +2067,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 Loading @@ -2819,7 +2831,7 @@ fixDepricated(InitConfigFileParser::Context & ctx, const char * data){ * Transform old values to new values * Transform new values to old values (backward compatible) */ Properties tmp; Properties tmp(true); Properties::Iterator it(ctx.m_currentSection); for (name = it.first(); name != NULL; name = it.next()) { const DepricationTransform * p = &f_deprication[0]; Loading Loading @@ -2951,8 +2963,8 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, { Uint32 i; Properties * props= ctx.m_config; Properties p_connections; Properties p_connections2; Properties p_connections(true); Properties p_connections2(true); for (i = 0;; i++){ const Properties * tmp; Loading @@ -2972,8 +2984,8 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, Uint32 nNodes; ctx.m_userProperties.get("NoOfNodes", &nNodes); Properties p_db_nodes; Properties p_api_mgm_nodes; Properties p_db_nodes(true); Properties p_api_mgm_nodes(true); Uint32 i_db= 0, i_api_mgm= 0, n; for (i= 0, n= 0; n < nNodes; i++){ Loading @@ -2999,7 +3011,7 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, if(!p_connections2.get("", nodeId1+nodeId2<<16, &dummy)) { ConfigInfo::ConfigRuleSection s; s.m_sectionType= BaseString("TCP"); s.m_sectionData= new Properties; s.m_sectionData= new Properties(true); char buf[16]; snprintf(buf, sizeof(buf), "%u", nodeId1); s.m_sectionData->put("NodeId1", buf); Loading @@ -3016,7 +3028,7 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions, if(!p_db_nodes.get("", j, &nodeId2)) break; ConfigInfo::ConfigRuleSection s; s.m_sectionType= BaseString("TCP"); s.m_sectionData= new Properties; s.m_sectionData= new Properties(true); char buf[16]; snprintf(buf, sizeof(buf), "%u", nodeId1); s.m_sectionData->put("NodeId1", buf); Loading @@ -3037,7 +3049,7 @@ static bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>§ions, { #if 0 Properties * props= ctx.m_config; Properties computers; Properties computers(true); Uint32 port_base = NDB_BASE_PORT+2; Uint32 nNodes; 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 +34 −9 Original line number Diff line number Diff line Loading @@ -43,10 +43,10 @@ InitConfigFileParser::~InitConfigFileParser() { // Read Config File //**************************************************************************** InitConfigFileParser::Context::Context(const ConfigInfo * info) : m_configValues(1000, 20) { : m_configValues(1000, 20), m_userProperties(true) { m_config = new Properties(); m_defaults = new Properties(); m_config = new Properties(true); m_defaults = new Properties(true); } InitConfigFileParser::Context::~Context(){ Loading Loading @@ -115,7 +115,7 @@ InitConfigFileParser::parseConfig(FILE * file) { snprintf(ctx.fname, sizeof(ctx.fname), section); free(section); ctx.type = InitConfigFileParser::DefaultSection; ctx.m_sectionLineno = ctx.m_lineno; ctx.m_currentSection = new Properties(); ctx.m_currentSection = new Properties(true); ctx.m_userDefaults = NULL; ctx.m_currentInfo = m_info->getInfo(ctx.fname); ctx.m_systemDefaults = m_info->getDefaults(ctx.fname); Loading @@ -137,7 +137,7 @@ InitConfigFileParser::parseConfig(FILE * file) { free(section); ctx.type = InitConfigFileParser::Section; ctx.m_sectionLineno = ctx.m_lineno; ctx.m_currentSection = new Properties(); ctx.m_currentSection = new Properties(true); ctx.m_userDefaults = getSection(ctx.fname, ctx.m_defaults); ctx.m_currentInfo = m_info->getInfo(ctx.fname); ctx.m_systemDefaults = m_info->getDefaults(ctx.fname); Loading 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[]= {":", "="}; const 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][0])) { separator= separator_list[i]; break; } } if (separator == 0) { ctx.reportError("Parse error"); return false; } Loading @@ -241,13 +250,13 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line) { // ******************************************* // Get pointer to substring before separator // ******************************************* t = strtok(tmpLine, ":"); t = strtok(tmpLine, separator); // ***************************************** // 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[0]); 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