Commit 9f2b7e91 authored by unknown's avatar unknown

ndb config ability/naming changes, see respective file


mysql-test/ndb/ndb_config_2_node.ini:
  using new naming capabilities
ndb/src/common/mgmcommon/ConfigInfo.cpp:
  fixes case insensitive
  + removed abort from config handling
ndb/src/common/mgmcommon/InitConfigFileParser.cpp:
  fixed alias handling
  some requires in config handling
ndb/src/mgmclient/CommandInterpreter.cpp:
  new printout to reflect new naming in config
parent 340d40a7
[DB DEFAULT] [ndbd default]
NoOfReplicas: 2 NoOfReplicas= 2
MaxNoOfConcurrentOperations: CHOOSE_MaxNoOfConcurrentOperations MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations
DataMemory: CHOOSE_DataMemory DataMemory= CHOOSE_DataMemory
IndexMemory: CHOOSE_IndexMemory IndexMemory= CHOOSE_IndexMemory
Diskless: CHOOSE_Diskless Diskless= CHOOSE_Diskless
TimeBetweenWatchDogCheck: 30000 TimeBetweenWatchDogCheck= 30000
FileSystemPath: CHOOSE_FILESYSTEM FileSystemPath= CHOOSE_FILESYSTEM
[COMPUTER] [computer]
Id: 1 Id= 1
HostName: CHOOSE_HOSTNAME_1 HostName= CHOOSE_HOSTNAME_1
[COMPUTER] [computer]
Id: 2 Id= 2
HostName: CHOOSE_HOSTNAME_2 HostName= CHOOSE_HOSTNAME_2
[DB] [ndbd]
ExecuteOnComputer: 1 ExecuteOnComputer= 1
[DB] [ndbd]
ExecuteOnComputer: 2 ExecuteOnComputer= 2
[MGM] [ndb_mgmd]
PortNumber: CHOOSE_PORT_MGM PortNumber= CHOOSE_PORT_MGM
[MYSQLD] [mysqld]
[MYSQLD] [mysqld]
[MYSQLD] [mysqld]
[MYSQLD] [mysqld]
[TCP DEFAULT] [tcp default]
PortNumber: CHOOSE_PORT_TRANSPORTER PortNumber= CHOOSE_PORT_TRANSPORTER
...@@ -1989,7 +1989,8 @@ const Properties * ...@@ -1989,7 +1989,8 @@ const Properties *
ConfigInfo::getInfo(const char * section) const { ConfigInfo::getInfo(const char * section) const {
const Properties * p; const Properties * p;
if(!m_info.get(section, &p)){ if(!m_info.get(section, &p)){
warning("getInfo", section); return 0;
// warning("getInfo", section);
} }
return p; return p;
} }
...@@ -1998,7 +1999,8 @@ const Properties * ...@@ -1998,7 +1999,8 @@ const Properties *
ConfigInfo::getDefaults(const char * section) const { ConfigInfo::getDefaults(const char * section) const {
const Properties * p; const Properties * p;
if(!m_systemDefaults.get(section, &p)){ if(!m_systemDefaults.get(section, &p)){
warning("getDefaults", section); return 0;
//warning("getDefaults", section);
} }
return p; return p;
} }
...@@ -2072,7 +2074,7 @@ ConfigInfo::isSection(const char * section) const { ...@@ -2072,7 +2074,7 @@ ConfigInfo::isSection(const char * section) const {
const char* const char*
ConfigInfo::getAlias(const char * section) const { ConfigInfo::getAlias(const char * section) const {
for (int i = 0; m_sectionNameAliases[i].name != 0; i++) for (int i = 0; m_sectionNameAliases[i].name != 0; i++)
if(!strcmp(section, m_sectionNameAliases[i].alias)) if(!strcasecmp(section, m_sectionNameAliases[i].alias))
return m_sectionNameAliases[i].name; return m_sectionNameAliases[i].name;
return 0; return 0;
} }
......
...@@ -117,8 +117,8 @@ InitConfigFileParser::parseConfig(FILE * file) { ...@@ -117,8 +117,8 @@ InitConfigFileParser::parseConfig(FILE * file) {
ctx.m_sectionLineno = ctx.m_lineno; ctx.m_sectionLineno = ctx.m_lineno;
ctx.m_currentSection = new Properties(true); ctx.m_currentSection = new Properties(true);
ctx.m_userDefaults = NULL; ctx.m_userDefaults = NULL;
ctx.m_currentInfo = m_info->getInfo(ctx.fname); require((ctx.m_currentInfo = m_info->getInfo(ctx.fname)) != 0);
ctx.m_systemDefaults = m_info->getDefaults(ctx.fname); require((ctx.m_systemDefaults = m_info->getDefaults(ctx.fname)) != 0);
continue; continue;
} }
...@@ -139,8 +139,8 @@ InitConfigFileParser::parseConfig(FILE * file) { ...@@ -139,8 +139,8 @@ InitConfigFileParser::parseConfig(FILE * file) {
ctx.m_sectionLineno = ctx.m_lineno; ctx.m_sectionLineno = ctx.m_lineno;
ctx.m_currentSection = new Properties(true); ctx.m_currentSection = new Properties(true);
ctx.m_userDefaults = getSection(ctx.fname, ctx.m_defaults); ctx.m_userDefaults = getSection(ctx.fname, ctx.m_defaults);
ctx.m_currentInfo = m_info->getInfo(ctx.fname); require((ctx.m_currentInfo = m_info->getInfo(ctx.fname)) != 0);
ctx.m_systemDefaults = m_info->getDefaults(ctx.fname); require((ctx.m_systemDefaults = m_info->getDefaults(ctx.fname)) != 0);
continue; continue;
} }
...@@ -180,8 +180,8 @@ InitConfigFileParser::parseConfig(FILE * file) { ...@@ -180,8 +180,8 @@ InitConfigFileParser::parseConfig(FILE * file) {
ctx.type = InitConfigFileParser::Section; ctx.type = InitConfigFileParser::Section;
ctx.m_currentSection = tmp[j].m_sectionData; ctx.m_currentSection = tmp[j].m_sectionData;
ctx.m_userDefaults = getSection(ctx.fname, ctx.m_defaults); ctx.m_userDefaults = getSection(ctx.fname, ctx.m_defaults);
ctx.m_currentInfo = m_info->getInfo(ctx.fname); require((ctx.m_currentInfo = m_info->getInfo(ctx.fname)) != 0);
ctx.m_systemDefaults = m_info->getDefaults(ctx.fname); require((ctx.m_systemDefaults = m_info->getDefaults(ctx.fname)) != 0);
if(!storeSection(ctx)) if(!storeSection(ctx))
return 0; return 0;
} }
...@@ -516,7 +516,7 @@ char* ...@@ -516,7 +516,7 @@ char*
InitConfigFileParser::parseDefaultSectionHeader(const char* line) const { InitConfigFileParser::parseDefaultSectionHeader(const char* line) const {
static char token1[MAX_LINE_LENGTH], token2[MAX_LINE_LENGTH]; static char token1[MAX_LINE_LENGTH], token2[MAX_LINE_LENGTH];
int no = sscanf(line, "[%120[A-Za-z] %120[A-Za-z]]", token1, token2); int no = sscanf(line, "[%120[A-Z_a-z] %120[A-Z_a-z]]", token1, token2);
// Not correct no of tokens // Not correct no of tokens
if (no != 2) return NULL; if (no != 2) return NULL;
...@@ -524,8 +524,12 @@ InitConfigFileParser::parseDefaultSectionHeader(const char* line) const { ...@@ -524,8 +524,12 @@ InitConfigFileParser::parseDefaultSectionHeader(const char* line) const {
// Not correct keyword at end // Not correct keyword at end
if (!strcasecmp(token2, "DEFAULT") == 0) return NULL; if (!strcasecmp(token2, "DEFAULT") == 0) return NULL;
if(m_info->getInfo(token1)){ const char *token1_alias= m_info->getAlias(token1);
return strdup(token1); if (token1_alias == 0)
token1_alias= token1;
if(m_info->getInfo(token1_alias)){
return strdup(token1_alias);
} }
// Did not find section // Did not find section
......
...@@ -682,12 +682,12 @@ CommandInterpreter::executeShow(char* parameters) ...@@ -682,12 +682,12 @@ CommandInterpreter::executeShow(char* parameters)
} }
ndbout << ndb_nodes ndbout << ndb_nodes
<< " NDB Node(s)" << " [ndbd] node(s)"
<< endl; << endl;
for(i=0; i < state->no_of_nodes; i++) { for(i=0; i < state->no_of_nodes; i++) {
if(state->node_states[i].node_type == NDB_MGM_NODE_TYPE_NDB) { if(state->node_states[i].node_type == NDB_MGM_NODE_TYPE_NDB) {
ndbout << "DB node:\t" << state->node_states[i].node_id; ndbout << "[ndbd]\t\tid=" << state->node_states[i].node_id;
if(state->node_states[i].version != 0) { if(state->node_states[i].version != 0) {
ndbout << " (Version: " ndbout << " (Version: "
<< getMajor(state->node_states[i].version) << "." << getMajor(state->node_states[i].version) << "."
...@@ -707,12 +707,12 @@ CommandInterpreter::executeShow(char* parameters) ...@@ -707,12 +707,12 @@ CommandInterpreter::executeShow(char* parameters)
ndbout << endl; ndbout << endl;
ndbout << mgm_nodes ndbout << mgm_nodes
<< " MGM Node(s)" << " [ndb_mgmd] node(s)"
<< endl; << endl;
for(i=0; i < state->no_of_nodes; i++) { for(i=0; i < state->no_of_nodes; i++) {
if(state->node_states[i].node_type == NDB_MGM_NODE_TYPE_MGM) { if(state->node_states[i].node_type == NDB_MGM_NODE_TYPE_MGM) {
ndbout << "MGM node:\t" << state->node_states[i].node_id; ndbout << "[ndb_mgmd]\tid=" << state->node_states[i].node_id;
if(state->node_states[i].version != 0) { if(state->node_states[i].version != 0) {
ndbout << " (Version: " ndbout << " (Version: "
<< getMajor(state->node_states[i].version) << "." << getMajor(state->node_states[i].version) << "."
...@@ -728,12 +728,12 @@ CommandInterpreter::executeShow(char* parameters) ...@@ -728,12 +728,12 @@ CommandInterpreter::executeShow(char* parameters)
ndbout << endl; ndbout << endl;
ndbout << api_nodes ndbout << api_nodes
<< " API Node(s)" << " [mysqld] node(s)"
<< endl; << endl;
for(i=0; i < state->no_of_nodes; i++) { for(i=0; i < state->no_of_nodes; i++) {
if(state->node_states[i].node_type == NDB_MGM_NODE_TYPE_API) { if(state->node_states[i].node_type == NDB_MGM_NODE_TYPE_API) {
ndbout << "API node:\t" << state->node_states[i].node_id; ndbout << "[mysqld]\tid=" << state->node_states[i].node_id;
if(state->node_states[i].version != 0) { if(state->node_states[i].version != 0) {
ndbout << " (Version: " ndbout << " (Version: "
<< getMajor(state->node_states[i].version) << "." << getMajor(state->node_states[i].version) << "."
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment