Below is the list of changes that have just been committed into a local
5.0 repository of tomas. When tomas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2030 05/10/12 14:17:39 tomas@stripped +8 -0
Bug #13009 No gaps allowed in node id number sequence
+ some small bugfixes in ndb_config
+ extending ndb_config to print connections and take shm option
ndb/tools/ndb_config.cpp
1.11 05/10/12 14:17:28 tomas@stripped +84 -19
Bug #13009 No gaps allowed in node id number sequence
+ some small bugfixes in ndb_config
+ extending ndb_config to print connections and take shm option
ndb/src/mgmsrv/InitConfigFileParser.cpp
1.25 05/10/12 14:17:28 tomas@stripped +7 -4
Bug #13009 No gaps allowed in node id number sequence
+ some small bugfixes in ndb_config
+ extending ndb_config to print connections and take shm option
ndb/src/mgmsrv/ConfigInfo.cpp
1.70 05/10/12 14:17:28 tomas@stripped +103 -242
Bug #13009 No gaps allowed in node id number sequence
+ some small bugfixes in ndb_config
+ extending ndb_config to print connections and take shm option
ndb/src/common/mgmcommon/IPCConfig.cpp
1.22 05/10/12 14:17:28 tomas@stripped +10 -14
Bug #13009 No gaps allowed in node id number sequence
+ some small bugfixes in ndb_config
+ extending ndb_config to print connections and take shm option
ndb/include/mgmapi/mgmapi_config_parameters.h
1.19 05/10/12 14:17:28 tomas@stripped +1 -0
Bug #13009 No gaps allowed in node id number sequence
+ some small bugfixes in ndb_config
+ extending ndb_config to print connections and take shm option
mysql-test/t/ndb_config.test
1.10 05/10/12 14:17:28 tomas@stripped +5 -0
Bug #13009 No gaps allowed in node id number sequence
+ some small bugfixes in ndb_config
+ extending ndb_config to print connections and take shm option
mysql-test/std_data/ndb_config_mycnf2.cnf
1.2 05/10/12 14:17:28 tomas@stripped +2 -2
Bug #13009 No gaps allowed in node id number sequence
+ some small bugfixes in ndb_config
+ extending ndb_config to print connections and take shm option
mysql-test/r/ndb_config.result
1.5 05/10/12 14:17:28 tomas@stripped +5 -0
Bug #13009 No gaps allowed in node id number sequence
+ some small bugfixes in ndb_config
+ extending ndb_config to print connections and take shm option
mysql-test/std_data/ndb_config_mycnf2.cnf
1.1 05/10/12 12:27:22 tomas@stripped +31 -0
mysql-test/std_data/ndb_config_mycnf2.cnf
1.0 05/10/12 12:27:22 tomas@stripped +0 -0
BitKeeper file /home/tomas/mysql-5.0/mysql-test/std_data/ndb_config_mycnf2.cnf
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: tomas
# Host: poseidon.ndb.mysql.com
# Root: /home/tomas/mysql-5.0
--- 1.4/mysql-test/r/ndb_config.result 2005-09-30 12:19:13 +02:00
+++ 1.5/mysql-test/r/ndb_config.result 2005-10-12 14:17:28 +02:00
@@ -5,3 +5,8 @@
1 2
ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6,
mysqld,7,
ndbd,1,localhost,52428800,26214400 ndbd,2,localhost,52428800,36700160
ndbd,3,localhost,52428800,52428800 ndbd,4,localhost,52428800,52428800
ndb_mgmd,5,localhost,, mysqld,6,localhost,,
+ndbd,1,localhost ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndb_mgmd,5,localhost
mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10,
+Cluster configuration warning line 0: Could not use next node id 2 for section [API],
using next unused node id 7.
+ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndb_mgmd,6,localhost
mysqld,1, mysqld,7, mysqld,8, mysqld,9, mysqld,10,
+ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndbd,6,localhost ndb_mgmd,1,localhost
ndb_mgmd,2,localhost mysqld,11, mysqld,12, mysqld,13, mysqld,14, mysqld,15,
+shm,3,4,35,3 shm,3,5,35,3 shm,3,6,35,3 shm,4,5,35,4 shm,4,6,35,4 shm,5,6,35,5
tcp,11,3,55,3 tcp,11,4,55,4 tcp,11,5,55,5 tcp,11,6,55,6 tcp,12,3,55,3 tcp,12,4,55,4
tcp,12,5,55,5 tcp,12,6,55,6 tcp,13,3,55,3 tcp,13,4,55,4 tcp,13,5,55,5 tcp,13,6,55,6
tcp,14,3,55,3 tcp,14,4,55,4 tcp,14,5,55,5 tcp,14,6,55,6 tcp,15,3,55,3 tcp,15,4,55,4
tcp,15,5,55,5 tcp,15,6,55,6 tcp,1,3,55,1 tcp,1,4,55,1 tcp,1,5,55,1 tcp,1,6,55,1
tcp,2,3,55,2 tcp,2,4,55,2 tcp,2,5,55,2 tcp,2,6,55,2
--- 1.9/mysql-test/t/ndb_config.test 2005-09-30 12:19:13 +02:00
+++ 1.10/mysql-test/t/ndb_config.test 2005-10-12 14:17:28 +02:00
@@ -11,3 +11,8 @@
# End of 4.1 tests
--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.jonas
--defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf1.cnf
--query=type,nodeid,host,IndexMemory,DataMemory --mycnf 2> /dev/null
+
+--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster0
--defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --query=type,nodeid,host
--mycnf 2> /dev/null
+--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster1
--defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --query=type,nodeid,host
--mycnf 2> /dev/null
+--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster2
--defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --query=type,nodeid,host
--mycnf 2> /dev/null
+--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster2
--defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --ndb-shm --connections
--query=type,nodeid1,nodeid2,group,nodeidserver --mycnf 2> /dev/null
--- 1.18/ndb/include/mgmapi/mgmapi_config_parameters.h 2005-07-25 13:23:29 +02:00
+++ 1.19/ndb/include/mgmapi/mgmapi_config_parameters.h 2005-10-12 14:17:28 +02:00
@@ -116,6 +116,7 @@
#define CFG_CONNECTION_HOSTNAME_1 407
#define CFG_CONNECTION_HOSTNAME_2 408
#define CFG_CONNECTION_GROUP 409
+#define CFG_CONNECTION_NODE_ID_SERVER 410
#define CFG_TCP_SERVER 452
#define CFG_TCP_SEND_BUFFER_SIZE 454
--- 1.10/ndb/tools/ndb_config.cpp 2005-09-30 18:16:43 +02:00
+++ 1.11/ndb/tools/ndb_config.cpp 2005-10-12 14:17:28 +02:00
@@ -33,7 +33,7 @@
static int g_verbose = 0;
static int try_reconnect = 3;
-static int g_nodes = 1;
+static int g_nodes, g_connections, g_section;
static const char * g_connectstring = 0;
static const char * g_query = 0;
@@ -70,13 +70,19 @@
"Overides specifying entries in NDB_CONNECTSTRING and Ndb.cfg",
(gptr*) &g_connectstring, (gptr*) &g_connectstring,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "ndb-shm", 256, "Print nodes",
+ (gptr*) &opt_ndb_shm, (gptr*) &opt_ndb_shm,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ "nodes", 256, "Print nodes",
(gptr*) &g_nodes, (gptr*) &g_nodes,
- 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ { "connections", 256, "Print connections",
+ (gptr*) &g_connections, (gptr*) &g_connections,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ "query", 'q', "Query option(s)",
(gptr*) &g_query, (gptr*) &g_query,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- { "host", 257, "Host",
+ { "host", 256, "Host",
(gptr*) &g_host, (gptr*) &g_host,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "type", 258, "Type of node/connection",
@@ -155,6 +161,11 @@
virtual int apply(const Iter&);
};
+struct ConnectionTypeApply : public Apply
+{
+ virtual int apply(const Iter&);
+};
+
static int parse_query(Vector<Apply*>&, int &argc, char**& argv);
static int parse_where(Vector<Match*>&, int &argc, char**& argv);
static int eval(const Iter&, const Vector<Match*>&);
@@ -172,6 +183,15 @@
ndb_std_get_one_option)))
return -1;
+ if (g_nodes && g_connections)
+ {
+ ndbout_c("Only one option of --nodes and --connections allowed");
+ }
+
+ g_section = CFG_SECTION_NODE; //default
+ if (g_connections)
+ g_section = CFG_SECTION_CONNECTION;
+
ndb_mgm_configuration * conf = 0;
if (g_config_file || g_mycnf)
@@ -202,7 +222,7 @@
exit(0);
}
- Iter iter(* conf, CFG_SECTION_NODE);
+ Iter iter(* conf, g_section);
bool prev= false;
iter.first();
for(iter.first(); iter.valid(); iter.next())
@@ -231,13 +251,32 @@
for(unsigned i = 0; i<list.size(); i++)
{
const char * str= list[i].c_str();
- if(strcasecmp(str, "id") == 0 || strcasecmp(str, "nodeid") == 0)
- select.push_back(new Apply(CFG_NODE_ID));
- else if(strncasecmp(str, "host", 4) == 0)
- select.push_back(new Apply(CFG_NODE_HOST));
- else if(strcasecmp(str, "type") == 0)
- select.push_back(new NodeTypeApply());
- else if(g_nodes)
+ if(g_section == CFG_SECTION_NODE)
+ {
+ if(strcasecmp(str, "id") == 0 || strcasecmp(str, "nodeid") == 0)
+ {
+ select.push_back(new Apply(CFG_NODE_ID));
+ continue;
+ }
+ else if(strncasecmp(str, "host", 4) == 0)
+ {
+ select.push_back(new Apply(CFG_NODE_HOST));
+ continue;
+ }
+ else if(strcasecmp(str, "type") == 0)
+ {
+ select.push_back(new NodeTypeApply());
+ continue;
+ }
+ }
+ else if (g_section == CFG_SECTION_CONNECTION)
+ {
+ if(strcasecmp(str, "type") == 0)
+ {
+ select.push_back(new ConnectionTypeApply());
+ continue;
+ }
+ }
{
bool found = false;
for(int p = 0; p<ConfigInfo::m_NoOfParams; p++)
@@ -245,9 +284,15 @@
if(0)ndbout_c("%s %s",
ConfigInfo::m_ParamInfo[p]._section,
ConfigInfo::m_ParamInfo[p]._fname);
- if(strcmp(ConfigInfo::m_ParamInfo[p]._section, "DB") == 0 ||
- strcmp(ConfigInfo::m_ParamInfo[p]._section, "API") == 0 ||
- strcmp(ConfigInfo::m_ParamInfo[p]._section, "MGM") == 0)
+ if(g_section == CFG_SECTION_CONNECTION &&
+ (strcmp(ConfigInfo::m_ParamInfo[p]._section, "TCP") == 0 ||
+ strcmp(ConfigInfo::m_ParamInfo[p]._section, "SCI") == 0 ||
+ strcmp(ConfigInfo::m_ParamInfo[p]._section, "SHM") == 0)
+ ||
+ g_section == CFG_SECTION_NODE &&
+ (strcmp(ConfigInfo::m_ParamInfo[p]._section, "DB") == 0 ||
+ strcmp(ConfigInfo::m_ParamInfo[p]._section, "API") == 0 ||
+ strcmp(ConfigInfo::m_ParamInfo[p]._section, "MGM") == 0))
{
if(strcasecmp(ConfigInfo::m_ParamInfo[p]._fname, str) == 0)
{
@@ -263,11 +308,6 @@
return 1;
}
}
- else
- {
- fprintf(stderr, "Unknown query option: %s\n", str);
- return 1;
- }
}
}
return 0;
@@ -421,6 +461,31 @@
if (iter.get(CFG_TYPE_OF_SECTION, &val32) == 0)
{
printf("%s", ndb_mgm_get_node_type_alias_string((ndb_mgm_node_type)val32, 0));
+ }
+ return 0;
+}
+
+int
+ConnectionTypeApply::apply(const Iter& iter)
+{
+ Uint32 val32;
+ if (iter.get(CFG_TYPE_OF_SECTION, &val32) == 0)
+ {
+ switch (val32)
+ {
+ case CONNECTION_TYPE_TCP:
+ printf("tcp");
+ break;
+ case CONNECTION_TYPE_SCI:
+ printf("sci");
+ break;
+ case CONNECTION_TYPE_SHM:
+ printf("shm");
+ break;
+ default:
+ printf("<unknown>");
+ break;
+ }
}
return 0;
}
--- 1.69/ndb/src/mgmsrv/ConfigInfo.cpp 2005-10-11 15:47:58 +02:00
+++ 1.70/ndb/src/mgmsrv/ConfigInfo.cpp 2005-10-12 14:17:28 +02:00
@@ -57,7 +57,6 @@
const char*
ConfigInfo::m_sectionNames[]={
"SYSTEM",
- "EXTERNAL SYSTEM",
"COMPUTER",
DB_TOKEN,
@@ -78,9 +77,7 @@
****************************************************************************/
static bool transformComputer(InitConfigFileParser::Context & ctx, const char *);
static bool transformSystem(InitConfigFileParser::Context & ctx, const char *);
-static bool transformExternalSystem(InitConfigFileParser::Context & ctx, const char
*);
static bool transformNode(InitConfigFileParser::Context & ctx, const char *);
-static bool transformExtNode(InitConfigFileParser::Context & ctx, const char *);
static bool checkConnectionSupport(InitConfigFileParser::Context & ctx, const char
*);
static bool transformConnection(InitConfigFileParser::Context & ctx, const char *);
static bool applyDefaultValues(InitConfigFileParser::Context & ctx, const char *);
@@ -93,7 +90,6 @@
static bool fixNodeHostname(InitConfigFileParser::Context & ctx, const char * data);
static bool fixHostname(InitConfigFileParser::Context & ctx, const char * data);
static bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data);
-static bool fixExtConnection(InitConfigFileParser::Context & ctx, const char * data);
static bool fixDepricated(InitConfigFileParser::Context & ctx, const char *);
static bool saveInConfigValues(InitConfigFileParser::Context & ctx, const char *);
static bool fixFileSystemPath(InitConfigFileParser::Context & ctx, const char *
data);
@@ -104,7 +100,6 @@
const ConfigInfo::SectionRule
ConfigInfo::m_SectionRules[] = {
{ "SYSTEM", transformSystem, 0 },
- { "EXTERNAL SYSTEM", transformExternalSystem, 0 },
{ "COMPUTER", transformComputer, 0 },
{ DB_TOKEN, transformNode, 0 },
@@ -151,14 +146,6 @@
{ "SHM", fixPortNumber, 0 }, // has to come after fixHostName
{ "SCI", fixPortNumber, 0 }, // has to come after fixHostName
- /**
- * fixExtConnection must be after fixNodeId
- */
- { "TCP", fixExtConnection, 0 },
- { "SHM", fixExtConnection, 0 },
- { "SCI", fixExtConnection, 0 },
- { "OSE", fixExtConnection, 0 },
-
{ "*", applyDefaultValues, "user" },
{ "*", fixDepricated, 0 },
{ "*", applyDefaultValues, "system" },
@@ -174,9 +161,6 @@
{ DB_TOKEN, checkDbConstraints, 0 },
- /**
- * checkConnectionConstraints must be after fixExtConnection
- */
{ "TCP", checkConnectionConstraints, 0 },
{ "SHM", checkConnectionConstraints, 0 },
{ "SCI", checkConnectionConstraints, 0 },
@@ -214,9 +198,6 @@
static bool
set_connection_priorities(Vector<ConfigInfo::ConfigRuleSection>§ions,
struct InitConfigFileParser::Context &ctx,
const char * rule_data);
-static bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>§ions,
- struct InitConfigFileParser::Context &ctx,
- const char * rule_data);
static bool
check_node_vs_replicas(Vector<ConfigInfo::ConfigRuleSection>§ions,
struct InitConfigFileParser::Context &ctx,
const char * rule_data);
@@ -226,7 +207,6 @@
{ sanity_checks, 0 },
{ add_node_connections, 0 },
{ set_connection_priorities, 0 },
- { add_server_ports, 0 },
{ check_node_vs_replicas, 0 },
{ 0, 0 }
};
@@ -242,9 +222,9 @@
static
const DepricationTransform f_deprication[] = {
{ DB_TOKEN, "Discless", "Diskless", 0, 1 },
- { DB_TOKEN, "Id", "nodeid", 0, 1 },
- { API_TOKEN, "Id", "nodeid", 0, 1 },
- { MGM_TOKEN, "Id", "nodeid", 0, 1 },
+ { DB_TOKEN, "Id", "NodeId", 0, 1 },
+ { API_TOKEN, "Id", "NodeId", 0, 1 },
+ { MGM_TOKEN, "Id", "NodeId", 0, 1 },
{ 0, 0, 0, 0, 0}
};
@@ -422,7 +402,7 @@
{
CFG_NODE_ID,
- "nodeid",
+ "NodeId",
DB_TOKEN,
"Number identifying the database node ("DB_TOKEN_PRINT")",
ConfigInfo::CI_USED,
@@ -1273,7 +1253,7 @@
{
CFG_NODE_ID,
- "nodeid",
+ "NodeId",
API_TOKEN,
"Number identifying application node ("API_TOKEN_PRINT")",
ConfigInfo::CI_USED,
@@ -1416,7 +1396,7 @@
{
CFG_NODE_ID,
- "nodeid",
+ "NodeId",
MGM_TOKEN,
"Number identifying the management server node ("MGM_TOKEN_PRINT")",
ConfigInfo::CI_USED,
@@ -1579,6 +1559,17 @@
"0", "200" },
{
+ CFG_CONNECTION_NODE_ID_SERVER,
+ "NodeIdServer",
+ "TCP",
+ "",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ MANDATORY,
+ "1", "63" },
+
+ {
CFG_CONNECTION_SEND_SIGNAL_ID,
"SendSignalId",
"TCP",
@@ -1767,6 +1758,17 @@
"0", "200" },
{
+ CFG_CONNECTION_NODE_ID_SERVER,
+ "NodeIdServer",
+ "SHM",
+ "",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ MANDATORY,
+ "1", "63" },
+
+ {
CFG_CONNECTION_SEND_SIGNAL_ID,
"SendSignalId",
"SHM",
@@ -1888,6 +1890,17 @@
"0", "200" },
{
+ CFG_CONNECTION_NODE_ID_SERVER,
+ "NodeIdServer",
+ "SCI",
+ "",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ MANDATORY,
+ "1", "63" },
+
+ {
CFG_CONNECTION_HOSTNAME_1,
"HostName1",
"SCI",
@@ -2555,29 +2568,32 @@
bool
transformNode(InitConfigFileParser::Context & ctx, const char * data){
- Uint32 id;
- if(!ctx.m_currentSection->get("nodeid", &id) &&
!ctx.m_currentSection->get("Id", &id)){
+ Uint32 id, line;
+ if(!ctx.m_currentSection->get("NodeId", &id) &&
!ctx.m_currentSection->get("Id", &id)){
Uint32 nextNodeId= 1;
ctx.m_userProperties.get("NextNodeId", &nextNodeId);
id= nextNodeId;
- while (ctx.m_userProperties.get("AllocatedNodeId_", id, &id))
+ while (ctx.m_userProperties.get("AllocatedNodeId_", id, &line))
id++;
- ctx.m_userProperties.put("NextNodeId", id+1, true);
- ctx.m_currentSection->put("nodeid", id);
-#if 0
- ctx.reportError("Mandatory parameter Id missing from section "
- "[%s] starting at line: %d",
- ctx.fname, ctx.m_sectionLineno);
- return false;
-#endif
- } else if(ctx.m_userProperties.get("AllocatedNodeId_", id, &id)) {
+ if (id != nextNodeId)
+ {
+ ndbout_c("Cluster configuration warning line %d: "
+ "Could not use next node id %d for section [%s], "
+ "using next unused node id %d.",
+ ctx.m_sectionLineno, nextNodeId, ctx.fname, id);
+ }
+ ctx.m_currentSection->put("NodeId", id);
+ } else if(ctx.m_userProperties.get("AllocatedNodeId_", id, &line)) {
ctx.reportError("Duplicate nodeid in section "
- "[%s] starting at line: %d",
- ctx.fname, ctx.m_sectionLineno);
+ "[%s] starting at line: %d. Previously used on line %d.",
+ ctx.fname, ctx.m_sectionLineno, line);
return false;
}
- ctx.m_userProperties.put("AllocatedNodeId_", id, id);
+ // next node id _always_ next numbers after last used id
+ ctx.m_userProperties.put("NextNodeId", id+1, true);
+
+ ctx.m_userProperties.put("AllocatedNodeId_", id, ctx.m_sectionLineno);
BaseString::snprintf(ctx.pname, sizeof(ctx.pname), "Node_%d", id);
ctx.m_currentSection->put("Type", ctx.fname);
@@ -2691,38 +2707,6 @@
return false;
}
-bool
-transformExtNode(InitConfigFileParser::Context & ctx, const char * data){
-
- Uint32 id;
- const char * systemName;
-
- if(!ctx.m_currentSection->get("Id", &id)){
- ctx.reportError("Mandatory parameter 'Id' missing from section "
- "[%s] starting at line: %d",
- ctx.fname, ctx.m_sectionLineno);
- return false;
- }
-
- if(!ctx.m_currentSection->get("System", &systemName)){
- ctx.reportError("Mandatory parameter 'System' missing from section "
- "[%s] starting at line: %d",
- ctx.fname, ctx.m_sectionLineno);
- return false;
- }
-
- ctx.m_currentSection->put("Type", ctx.fname);
-
- Uint32 nodes = 0;
- ctx.m_userProperties.get("ExtNoOfNodes", &nodes);
- require(ctx.m_userProperties.put("ExtNoOfNodes",++nodes, true));
-
- BaseString::snprintf(ctx.pname, sizeof(ctx.pname), "EXTERNAL SYSTEM_%s:Node_%d",
- systemName, id);
-
- return true;
-}
-
/**
* Connection rule: Check support of connection
*/
@@ -2799,23 +2783,6 @@
}
/**
- * External system rule: Just add it
- */
-bool
-transformExternalSystem(InitConfigFileParser::Context & ctx, const char * data){
- const char * name;
- if(!ctx.m_currentSection->get("Name", &name)){
- ctx.reportError("Mandatory parameter Name missing from section "
- "[%s] starting at line: %d",
- ctx.fname, ctx.m_sectionLineno);
- return false;
- }
- BaseString::snprintf(ctx.pname, sizeof(ctx.pname), "EXTERNAL SYSTEM_%s", name);
-
- return true;
-}
-
-/**
* Computer rule: Update "NoOfComputers", add "Type"
*/
bool
@@ -2991,87 +2958,6 @@
}
/**
- * @returns true if connection is external (one node is external)
- * Also returns:
- * - name of external system in parameter extSystemName, and
- * - nodeId of external node in parameter extSystemNodeId.
- */
-static bool
-isExtConnection(InitConfigFileParser::Context & ctx,
- const char **extSystemName, Uint32 * extSystemNodeId){
-
- Uint32 nodeId1, nodeId2;
-
- if (ctx.m_currentSection->contains("System1") &&
- ctx.m_currentSection->get("System1", extSystemName) &&
- ctx.m_currentSection->get("NodeId1", &nodeId1)) {
- *extSystemNodeId = nodeId1;
- return true;
- }
-
- if (ctx.m_currentSection->contains("System2") &&
- ctx.m_currentSection->get("System2", extSystemName) &&
- ctx.m_currentSection->get("NodeId2", &nodeId2)) {
- *extSystemNodeId = nodeId2;
- return true;
- }
-
- return false;
-}
-
-/**
- * External Connection Rule:
- * If connection is to an external system, then move connection into
- * external system configuration (i.e. a sub-property).
- */
-static bool
-fixExtConnection(InitConfigFileParser::Context & ctx, const char * data){
-
- const char * extSystemName;
- Uint32 extSystemNodeId;
-
- if (isExtConnection(ctx, &extSystemName, &extSystemNodeId)) {
-
- Uint32 connections = 0;
- ctx.m_userProperties.get("ExtNoOfConnections", &connections);
- require(ctx.m_userProperties.put("ExtNoOfConnections",++connections, true));
-
- char tmpLine1[MAX_LINE_LENGTH];
- BaseString::snprintf(tmpLine1, MAX_LINE_LENGTH, "Connection_%d", connections-1);
-
- /**
- * Section: EXTERNAL SYSTEM_<Ext System Name>
- */
- char extSystemPropName[MAX_LINE_LENGTH];
- strncpy(extSystemPropName, "EXTERNAL SYSTEM_", MAX_LINE_LENGTH);
- strncat(extSystemPropName, extSystemName, MAX_LINE_LENGTH);
- strncat(extSystemPropName, ":", MAX_LINE_LENGTH);
- strncat(extSystemPropName, tmpLine1, MAX_LINE_LENGTH);
-
- /**
- * Increase number of external connections for the system
- *
- * @todo Limitation: Only one external system is allowed
- */
- require(ctx.m_userProperties.put("ExtSystem", extSystemName, true));
-
- /**
- * Make sure section is stored in right place
- */
- strncpy(ctx.pname, extSystemPropName, MAX_LINE_LENGTH);
-
- /**
- * Since this is an external connection,
- * decrease number of internal connections
- */
- require(ctx.m_userProperties.get("NoOfConnections", &connections));
- require(ctx.m_userProperties.put("NoOfConnections", --connections, true));
- }
-
- return true;
-}
-
-/**
* Connection rule: Fix hostname
*
* Unless Hostname is not already specified, do steps:
@@ -3113,7 +2999,7 @@
DBUG_ENTER("fixPortNumber");
- Uint32 id1= 0, id2= 0;
+ Uint32 id1, id2;
const char *hostName1;
const char *hostName2;
require(ctx.m_currentSection->get("NodeId1", &id1));
@@ -3123,17 +3009,46 @@
DBUG_PRINT("info",("NodeId1=%d HostName1=\"%s\"",id1,hostName1));
DBUG_PRINT("info",("NodeId2=%d HostName2=\"%s\"",id2,hostName2));
- if (id1 > id2) {
- Uint32 tmp= id1;
- const char *tmp_name= hostName1;
- hostName1= hostName2;
- id1= id2;
- hostName2= tmp_name;
- id2= tmp;
- }
+ const Properties *node1, *node2;
+ require(ctx.m_config->get("Node", id1, &node1));
+ require(ctx.m_config->get("Node", id2, &node2));
- const Properties * node;
- require(ctx.m_config->get("Node", id1, &node));
+ const char *type1, *type2;
+ require(node1->get("Type", &type1));
+ require(node2->get("Type", &type2));
+
+ /* add NodeIdServer info */
+ {
+ Uint32 nodeIdServer = id1 < id2 ? id1 : id2;
+ if(strcmp(type1, API_TOKEN) == 0 || strcmp(type2, MGM_TOKEN) == 0)
+ nodeIdServer = id2;
+ else if(strcmp(type2, API_TOKEN) == 0 || strcmp(type1, MGM_TOKEN) == 0)
+ nodeIdServer = id1;
+ ctx.m_currentSection->put("NodeIdServer", nodeIdServer);
+
+ if (id2 == nodeIdServer) {
+ {
+ const char *tmp= hostName1;
+ hostName1= hostName2;
+ hostName2= tmp;
+ }
+ {
+ Uint32 tmp= id1;
+ id1= id2;
+ id2= tmp;
+ }
+ {
+ const Properties *tmp= node1;
+ node1= node2;
+ node2= tmp;
+ }
+ {
+ const char *tmp= type1;
+ type1= type2;
+ type2= tmp;
+ }
+ }
+ }
BaseString hostname(hostName1);
@@ -3144,21 +3059,13 @@
}
Uint32 port= 0;
- const char * type1;
- const char * type2;
- const Properties * node2;
-
- node->get("Type", &type1);
- ctx.m_config->get("Node", id2, &node2);
- node2->get("Type", &type2);
-
if(strcmp(type1, MGM_TOKEN)==0)
- node->get("PortNumber",&port);
+ node1->get("PortNumber",&port);
else if(strcmp(type2, MGM_TOKEN)==0)
node2->get("PortNumber",&port);
if (!port &&
- !node->get("ServerPort", &port) &&
+ !node1->get("ServerPort", &port) &&
!ctx.m_userProperties.get("ServerPort_", id1, &port))
{
Uint32 base= 0;
@@ -3309,11 +3216,6 @@
ctx.m_currentSection->get("NodeId1", &id1);
ctx.m_currentSection->get("NodeId2", &id2);
- // If external connection, just accept it
- if (ctx.m_currentSection->contains("System1") ||
- ctx.m_currentSection->contains("System2"))
- return true;
-
if(id1 == id2){
ctx.reportError("Illegal connection from node to itself"
" - [%s] starting at line: %d",
@@ -3346,12 +3248,10 @@
* Report error if the following are true
* -# None of the nodes is of type DB
* -# Not both of them are MGMs
- * -# None of them contain a "SystemX" name
*/
if((strcmp(type1, DB_TOKEN) != 0 && strcmp(type2, DB_TOKEN) != 0) &&
- !(strcmp(type1, MGM_TOKEN) == 0 && strcmp(type2, MGM_TOKEN) == 0) &&
- !ctx.m_currentSection->contains("System1") &&
- !ctx.m_currentSection->contains("System2")){
+ !(strcmp(type1, MGM_TOKEN) == 0 && strcmp(type2, MGM_TOKEN) == 0))
+ {
ctx.reportError("Invalid connection between node %d (%s) and node %d (%s)"
" - [%s] starting at line: %d",
id1, type1, id2, type2,
@@ -3441,11 +3341,11 @@
if(strcmp(p->m_section, ctx.fname) == 0){
double mul = p->m_mul;
double add = p->m_add;
- if(strcmp(name, p->m_oldName) == 0){
+ if(strcasecmp(name, p->m_oldName) == 0){
if(!transform(ctx, tmp, name, p->m_newName, add, mul)){
return false;
}
- } else if(strcmp(name, p->m_newName) == 0) {
+ } else if(strcasecmp(name, p->m_newName) == 0) {
if(!transform(ctx, tmp, name, p->m_oldName, -add/mul,1.0/mul)){
return false;
}
@@ -3722,45 +3622,6 @@
{
DBUG_ENTER("set_connection_priorities");
DBUG_RETURN(true);
-}
-
-static bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>§ions,
- struct InitConfigFileParser::Context &ctx,
- const char * rule_data)
-{
-#if 0
- Properties * props= ctx.m_config;
- Properties computers(true);
- Uint32 port_base = NDB_TCP_BASE_PORT;
-
- Uint32 nNodes;
- ctx.m_userProperties.get("NoOfNodes", &nNodes);
-
- for (Uint32 i= 0, n= 0; n < nNodes; i++){
- Properties * tmp;
- if(!props->get("Node", i, &tmp)) continue;
- n++;
-
- const char * type;
- if(!tmp->get("Type", &type)) continue;
-
- Uint32 port;
- if (tmp->get("ServerPort", &port)) continue;
-
- Uint32 computer;
- if (!tmp->get("ExecuteOnComputer", &computer)) continue;
-
- Uint32 adder= 0;
- computers.get("",computer, &adder);
-
- if (strcmp(type,DB_TOKEN) == 0) {
- adder++;
- tmp->put("ServerPort", port_base+adder);
- computers.put("",computer, adder);
- }
- }
-#endif
- return true;
}
static bool
--- 1.21/ndb/src/common/mgmcommon/IPCConfig.cpp 2005-07-15 01:24:10 +02:00
+++ 1.22/ndb/src/common/mgmcommon/IPCConfig.cpp 2005-10-12 14:17:28 +02:00
@@ -231,8 +231,11 @@
Uint32 server_port= 0;
if(iter.get(CFG_CONNECTION_SERVER_PORT, &server_port)) break;
+ Uint32 nodeIdServer= 0;
+ if(iter.get(CFG_CONNECTION_NODE_ID_SERVER, &nodeIdServer)) break;
+
/*
- We check the node type. MGM node becomes server.
+ We check the node type.
*/
Uint32 node1type, node2type;
ndb_mgm_configuration_iterator node1iter(config, CFG_SECTION_NODE);
@@ -242,20 +245,12 @@
node1iter.get(CFG_TYPE_OF_SECTION,&node1type);
node2iter.get(CFG_TYPE_OF_SECTION,&node2type);
- conf.serverNodeId= (nodeId1 < nodeId2)? nodeId1:nodeId2;
-
- conf.isMgmConnection= false;
- if(node2type==NODE_TYPE_MGM)
- {
- conf.isMgmConnection= true;
- conf.serverNodeId= nodeId2;
- }
- else if(node1type==NODE_TYPE_MGM)
- {
+ if(node1type==NODE_TYPE_MGM || node2type==NODE_TYPE_MGM)
conf.isMgmConnection= true;
- conf.serverNodeId= nodeId1;
- }
- else if (nodeId == conf.serverNodeId) {
+ else
+ conf.isMgmConnection= false;
+
+ if (nodeId == nodeIdServer && !conf.isMgmConnection) {
tr.add_transporter_interface(remoteNodeId, localHostName, server_port);
}
@@ -279,6 +274,7 @@
conf.s_port = server_port;
conf.localHostName = localHostName;
conf.remoteHostName = remoteHostName;
+ conf.serverNodeId = nodeIdServer;
switch(type){
case CONNECTION_TYPE_SHM:
--- 1.24/ndb/src/mgmsrv/InitConfigFileParser.cpp 2005-10-10 12:25:22 +02:00
+++ 1.25/ndb/src/mgmsrv/InitConfigFileParser.cpp 2005-10-12 14:17:28 +02:00
@@ -640,7 +640,7 @@
value_int = *(Uint64*)options[i].value;
break;
case GET_STR:
- ctx.m_currentSection->put(options[i].name, (char*)options[i].value);
+ ctx.m_currentSection->put(options[i].name, *(char**)options[i].value);
continue;
default:
abort();
@@ -762,9 +762,6 @@
Vector<struct my_option> options;
for(i = 0; i<ConfigInfo::m_NoOfParams; i++)
{
- if (strcmp(ConfigInfo::m_ParamInfo[i]._section, "DB") == 0 ||
- strcmp(ConfigInfo::m_ParamInfo[i]._section, "API") == 0 ||
- strcmp(ConfigInfo::m_ParamInfo[i]._section, "MGM") == 0)
{
struct my_option opt;
bzero(&opt, sizeof(opt));
@@ -854,6 +851,12 @@
if(!handle_mycnf_defaults(options, ctx, "API"))
goto end;
if(!handle_mycnf_defaults(options, ctx, "MGM"))
+ goto end;
+ if(!handle_mycnf_defaults(options, ctx, "TCP"))
+ goto end;
+ if(!handle_mycnf_defaults(options, ctx, "SHM"))
+ goto end;
+ if(!handle_mycnf_defaults(options, ctx, "SCI"))
goto end;
{
--- New file ---
+++ mysql-test/std_data/ndb_config_mycnf2.cnf 05/10/12 12:27:22
#
# Testing automatic node id generation
#
[cluster_config]
NoOfReplicas=2
Signum=39
[cluster_config.cluster0]
ndbd = localhost,localhost,localhost,localhost
ndb_mgmd = localhost
mysqld = ,,,,
[cluster_config.cluster1]
ndbd = localhost,localhost,localhost,localhost
ndb_mgmd = localhost
mysqld = ,,,,
[cluster_config.ndbd.1.cluster1]
NodeId=2
[cluster_config.mysqld.1.cluster1]
NodeId=1
[cluster_config.cluster2]
ndbd = localhost,localhost,localhost,localhost
ndb_mgmd = localhost,localhost
mysqld = ,,,,
[cluster_config.mysqld.1.cluster2]
NodeId=11
[cluster_config.ndb_mgmd.1.cluster2]
NodeId=1
[cluster_config.ndbd.1.cluster2]
NodeId=3
| Thread |
|---|
| • bk commit into 5.0 tree (tomas:1.2030) BUG#13009 | tomas | 12 Oct |