summaryrefslogtreecommitdiff
path: root/ndb/src
diff options
context:
space:
mode:
Diffstat (limited to 'ndb/src')
-rw-r--r--ndb/src/mgmsrv/ConfigInfo.cpp191
-rw-r--r--ndb/src/mgmsrv/ConfigInfo.hpp3
-rw-r--r--ndb/src/mgmsrv/main.cpp11
3 files changed, 91 insertions, 114 deletions
diff --git a/ndb/src/mgmsrv/ConfigInfo.cpp b/ndb/src/mgmsrv/ConfigInfo.cpp
index b1fe0735612..34a2d8c1302 100644
--- a/ndb/src/mgmsrv/ConfigInfo.cpp
+++ b/ndb/src/mgmsrv/ConfigInfo.cpp
@@ -62,8 +62,6 @@ ConfigInfo::m_sectionNames[]={
DB_TOKEN,
MGM_TOKEN,
API_TOKEN,
- "REP",
- "EXTERNAL REP",
"TCP",
"SCI",
@@ -100,6 +98,7 @@ static bool saveInConfigValues(InitConfigFileParser::Context & ctx, const char *
static bool fixFileSystemPath(InitConfigFileParser::Context & ctx, const char * data);
static bool fixBackupDataDir(InitConfigFileParser::Context & ctx, const char * data);
static bool fixShmUniqueId(InitConfigFileParser::Context & ctx, const char * data);
+static bool checkLocalhostHostnameMix(InitConfigFileParser::Context & ctx, const char * data);
const ConfigInfo::SectionRule
ConfigInfo::m_SectionRules[] = {
@@ -110,8 +109,6 @@ ConfigInfo::m_SectionRules[] = {
{ DB_TOKEN, transformNode, 0 },
{ API_TOKEN, transformNode, 0 },
{ MGM_TOKEN, transformNode, 0 },
- { "REP", transformNode, 0 },
- { "EXTERNAL REP", transformExtNode, 0 },
{ MGM_TOKEN, fixShmUniqueId, 0 },
@@ -128,8 +125,6 @@ ConfigInfo::m_SectionRules[] = {
{ DB_TOKEN, fixNodeHostname, 0 },
{ API_TOKEN, fixNodeHostname, 0 },
{ MGM_TOKEN, fixNodeHostname, 0 },
- { "REP", fixNodeHostname, 0 },
- //{ "EXTERNAL REP", fixNodeHostname, 0 },
{ "TCP", fixNodeId, "NodeId1" },
{ "TCP", fixNodeId, "NodeId2" },
@@ -168,6 +163,10 @@ ConfigInfo::m_SectionRules[] = {
{ "*", fixDepricated, 0 },
{ "*", applyDefaultValues, "system" },
+ { DB_TOKEN, checkLocalhostHostnameMix, 0 },
+ { API_TOKEN, checkLocalhostHostnameMix, 0 },
+ { MGM_TOKEN, checkLocalhostHostnameMix, 0 },
+
{ DB_TOKEN, fixFileSystemPath, 0 },
{ DB_TOKEN, fixBackupDataDir, 0 },
@@ -193,7 +192,6 @@ ConfigInfo::m_SectionRules[] = {
{ DB_TOKEN, saveInConfigValues, 0 },
{ API_TOKEN, saveInConfigValues, 0 },
{ MGM_TOKEN, saveInConfigValues, 0 },
- { "REP", saveInConfigValues, 0 },
{ "TCP", saveInConfigValues, 0 },
{ "SHM", saveInConfigValues, 0 },
@@ -345,17 +343,6 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
0, 0 },
{
- CFG_SYS_REPLICATION_ROLE,
- "ReplicationRole",
- "SYSTEM",
- "Role in Global Replication (None, Primary, or Standby)",
- ConfigInfo::CI_USED,
- false,
- ConfigInfo::CI_STRING,
- UNDEFINED,
- 0, 0 },
-
- {
CFG_SYS_PRIMARY_MGM_NODE,
"PrimaryMGMNode",
"SYSTEM",
@@ -402,7 +389,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
ConfigInfo::CI_INTERNAL,
false,
ConfigInfo::CI_STRING,
- UNDEFINED,
+ "localhost",
0, 0 },
{
@@ -1219,78 +1206,6 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
STR_VALUE(MAX_INT_RNIL) },
/***************************************************************************
- * REP
- ***************************************************************************/
- {
- CFG_SECTION_NODE,
- "REP",
- "REP",
- "Node section",
- ConfigInfo::CI_USED,
- false,
- ConfigInfo::CI_SECTION,
- (const char *)NODE_TYPE_REP,
- 0, 0
- },
-
- {
- CFG_NODE_HOST,
- "HostName",
- "REP",
- "Name of computer for this node",
- ConfigInfo::CI_INTERNAL,
- false,
- ConfigInfo::CI_STRING,
- UNDEFINED,
- 0, 0 },
-
- {
- CFG_NODE_SYSTEM,
- "System",
- "REP",
- "Name of system for this node",
- ConfigInfo::CI_INTERNAL,
- false,
- ConfigInfo::CI_STRING,
- UNDEFINED,
- 0, 0 },
-
- {
- CFG_NODE_ID,
- "Id",
- "REP",
- "Number identifying replication node (REP)",
- ConfigInfo::CI_USED,
- false,
- ConfigInfo::CI_INT,
- MANDATORY,
- "1",
- STR_VALUE(MAX_NODES) },
-
- {
- KEY_INTERNAL,
- "ExecuteOnComputer",
- "REP",
- "String referencing an earlier defined COMPUTER",
- ConfigInfo::CI_USED,
- false,
- ConfigInfo::CI_STRING,
- MANDATORY,
- 0, 0 },
-
- {
- CFG_REP_HEARTBEAT_INTERVAL,
- "HeartbeatIntervalRepRep",
- "REP",
- "Time between REP-REP heartbeats. Connection closed after 3 missed HBs",
- ConfigInfo::CI_USED,
- true,
- ConfigInfo::CI_INT,
- "3000",
- "100",
- STR_VALUE(MAX_INT_RNIL) },
-
- /***************************************************************************
* API
***************************************************************************/
{
@@ -1313,7 +1228,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
ConfigInfo::CI_INTERNAL,
false,
ConfigInfo::CI_STRING,
- UNDEFINED,
+ "",
0, 0 },
{
@@ -1433,7 +1348,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
ConfigInfo::CI_INTERNAL,
false,
ConfigInfo::CI_STRING,
- UNDEFINED,
+ "",
0, 0 },
{
@@ -2464,7 +2379,15 @@ ConfigInfo::isSection(const char * section) const {
}
const char*
-ConfigInfo::getAlias(const char * section) const {
+ConfigInfo::nameToAlias(const char * name) {
+ for (int i = 0; m_sectionNameAliases[i].name != 0; i++)
+ if(!strcasecmp(name, m_sectionNameAliases[i].name))
+ return m_sectionNameAliases[i].alias;
+ return 0;
+}
+
+const char*
+ConfigInfo::getAlias(const char * section) {
for (int i = 0; m_sectionNameAliases[i].name != 0; i++)
if(!strcasecmp(section, m_sectionNameAliases[i].alias))
return m_sectionNameAliases[i].name;
@@ -2623,7 +2546,7 @@ transformNode(InitConfigFileParser::Context & ctx, const char * data){
return true;
}
-static bool checkLocalhostHostnameMix(InitConfigFileParser::Context & ctx)
+static bool checkLocalhostHostnameMix(InitConfigFileParser::Context & ctx, const char * data)
{
DBUG_ENTER("checkLocalhostHostnameMix");
const char * hostname= 0;
@@ -2643,7 +2566,7 @@ static bool checkLocalhostHostnameMix(InitConfigFileParser::Context & ctx)
}
if (localhost_used) {
- ctx.reportError("Mixing of localhost with other hostname(%s) is illegal",
+ ctx.reportError("Mixing of localhost (default for [NDBD]HostName) with other hostname(%s) is illegal",
hostname);
DBUG_RETURN(false);
}
@@ -2652,21 +2575,17 @@ static bool checkLocalhostHostnameMix(InitConfigFileParser::Context & ctx)
}
bool
-fixNodeHostname(InitConfigFileParser::Context & ctx, const char * data){
-
+fixNodeHostname(InitConfigFileParser::Context & ctx, const char * data)
+{
const char * hostname;
+ DBUG_ENTER("fixNodeHostname");
+
if (ctx.m_currentSection->get("HostName", &hostname))
- return checkLocalhostHostnameMix(ctx);
+ DBUG_RETURN(checkLocalhostHostnameMix(ctx,0));
const char * compId;
- if(!ctx.m_currentSection->get("ExecuteOnComputer", &compId)){
- const char * type;
- if(ctx.m_currentSection->get("Type", &type) && strcmp(type,DB_TOKEN) == 0)
- require(ctx.m_currentSection->put("HostName", "localhost"));
- else
- require(ctx.m_currentSection->put("HostName", ""));
- return checkLocalhostHostnameMix(ctx);
- }
+ if(!ctx.m_currentSection->get("ExecuteOnComputer", &compId))
+ DBUG_RETURN(true);
const Properties * computer;
char tmp[255];
@@ -2675,18 +2594,18 @@ fixNodeHostname(InitConfigFileParser::Context & ctx, const char * data){
ctx.reportError("Computer \"%s\" not declared"
"- [%s] starting at line: %d",
compId, ctx.fname, ctx.m_sectionLineno);
- return false;
+ DBUG_RETURN(false);
}
if(!computer->get("HostName", &hostname)){
ctx.reportError("HostName missing in [COMPUTER] (Id: %d) "
" - [%s] starting at line: %d",
compId, ctx.fname, ctx.m_sectionLineno);
- return false;
+ DBUG_RETURN(false);
}
require(ctx.m_currentSection->put("HostName", hostname));
- return checkLocalhostHostnameMix(ctx);
+ DBUG_RETURN(checkLocalhostHostnameMix(ctx,0));
}
bool
@@ -2870,7 +2789,7 @@ transformComputer(InitConfigFileParser::Context & ctx, const char * data){
return true;
}
- return checkLocalhostHostnameMix(ctx);
+ return checkLocalhostHostnameMix(ctx,0);
}
/**
@@ -2878,7 +2797,9 @@ transformComputer(InitConfigFileParser::Context & ctx, const char * data){
*/
void
applyDefaultValues(InitConfigFileParser::Context & ctx,
- const Properties * defaults){
+ const Properties * defaults)
+{
+ DBUG_ENTER("applyDefaultValues");
if(defaults != NULL){
Properties::Iterator it(defaults);
@@ -2891,26 +2812,58 @@ applyDefaultValues(InitConfigFileParser::Context & ctx,
Uint32 val = 0;
::require(defaults->get(name, &val));
ctx.m_currentSection->put(name, val);
+ DBUG_PRINT("info",("%s=%d #default",name,val));
break;
}
case ConfigInfo::CI_INT64:{
Uint64 val = 0;
::require(defaults->get(name, &val));
ctx.m_currentSection->put64(name, val);
+ DBUG_PRINT("info",("%s=%lld #default",name,val));
break;
}
case ConfigInfo::CI_STRING:{
const char * val;
::require(defaults->get(name, &val));
ctx.m_currentSection->put(name, val);
+ DBUG_PRINT("info",("%s=%s #default",name,val));
break;
}
case ConfigInfo::CI_SECTION:
break;
}
}
+#ifndef DBUG_OFF
+ else
+ {
+ switch (ctx.m_info->getType(ctx.m_currentInfo, name)){
+ case ConfigInfo::CI_INT:
+ case ConfigInfo::CI_BOOL:{
+ Uint32 val = 0;
+ ::require(ctx.m_currentSection->get(name, &val));
+ DBUG_PRINT("info",("%s=%d",name,val));
+ break;
+ }
+ case ConfigInfo::CI_INT64:{
+ Uint64 val = 0;
+ ::require(ctx.m_currentSection->get(name, &val));
+ DBUG_PRINT("info",("%s=%lld",name,val));
+ break;
+ }
+ case ConfigInfo::CI_STRING:{
+ const char * val;
+ ::require(ctx.m_currentSection->get(name, &val));
+ DBUG_PRINT("info",("%s=%s",name,val));
+ break;
+ }
+ case ConfigInfo::CI_SECTION:
+ break;
+ }
+ }
+#endif
}
}
+ DBUG_VOID_RETURN;
}
bool
@@ -3482,6 +3435,8 @@ fixDepricated(InitConfigFileParser::Context & ctx, const char * data){
return true;
}
+extern int g_print_full_config;
+
static bool
saveInConfigValues(InitConfigFileParser::Context & ctx, const char * data){
const Properties * sec;
@@ -3503,6 +3458,12 @@ saveInConfigValues(InitConfigFileParser::Context & ctx, const char * data){
break;
}
+ if (g_print_full_config)
+ {
+ const char *alias= ConfigInfo::nameToAlias(ctx.fname);
+ printf("[%s]\n", alias ? alias : ctx.fname);
+ }
+
Uint32 no = 0;
ctx.m_userProperties.get("$Section", id, &no);
ctx.m_userProperties.put("$Section", id, no+1, true);
@@ -3530,18 +3491,24 @@ saveInConfigValues(InitConfigFileParser::Context & ctx, const char * data){
Uint32 val;
require(ctx.m_currentSection->get(n, &val));
ok = ctx.m_configValues.put(id, val);
+ if (g_print_full_config)
+ printf("%s=%u\n", n, val);
break;
}
case PropertiesType_Uint64:{
Uint64 val;
require(ctx.m_currentSection->get(n, &val));
ok = ctx.m_configValues.put64(id, val);
+ if (g_print_full_config)
+ printf("%s=%llu\n", n, val);
break;
}
case PropertiesType_char:{
const char * val;
require(ctx.m_currentSection->get(n, &val));
ok = ctx.m_configValues.put(id, val);
+ if (g_print_full_config)
+ printf("%s=%s\n", n, val);
break;
}
default:
diff --git a/ndb/src/mgmsrv/ConfigInfo.hpp b/ndb/src/mgmsrv/ConfigInfo.hpp
index dff8b34bf4a..871ee62040e 100644
--- a/ndb/src/mgmsrv/ConfigInfo.hpp
+++ b/ndb/src/mgmsrv/ConfigInfo.hpp
@@ -105,7 +105,8 @@ 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;
+ static const char* nameToAlias(const char*);
+ static const char* getAlias(const char*);
bool isSection(const char*) const;
const char* getDescription(const Properties * sec, const char* fname) const;
diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp
index 07b369d4ebc..ec20101493e 100644
--- a/ndb/src/mgmsrv/main.cpp
+++ b/ndb/src/mgmsrv/main.cpp
@@ -121,6 +121,7 @@ struct MgmGlobals {
};
int g_no_nodeid_checks= 0;
+int g_print_full_config;
static MgmGlobals *glob= 0;
/******************************************************************************
@@ -147,6 +148,9 @@ static struct my_option my_long_options[] =
{ "config-file", 'f', "Specify cluster configuration file",
(gptr*) &opt_config_filename, (gptr*) &opt_config_filename, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "print-full-config", 'P', "Print full config and exit",
+ (gptr*) &g_print_full_config, (gptr*) &g_print_full_config, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "daemon", 'd', "Run ndb_mgmd in daemon mode (default)",
(gptr*) &opt_daemon, (gptr*) &opt_daemon, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
@@ -208,7 +212,8 @@ int main(int argc, char** argv)
exit(ho_error);
if (opt_interactive ||
- opt_non_interactive) {
+ opt_non_interactive ||
+ g_print_full_config) {
opt_daemon= 0;
}
@@ -220,6 +225,9 @@ int main(int argc, char** argv)
opt_config_filename,
opt_connect_str);
+ if (g_print_full_config)
+ goto the_end;
+
if (glob->mgmObject->init())
goto error_end;
@@ -358,6 +366,7 @@ int main(int argc, char** argv)
glob->mgmObject->get_config_retriever()->disconnect();
glob->socketServer->stopSessions(true);
g_eventLogger.info("Shutdown complete");
+ the_end:
delete glob;
ndb_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
return 0;