Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
ca21e07a
Commit
ca21e07a
authored
Jun 17, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed need for specifying TCP connections in MySQL Cluster configuration
parent
b7476c17
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
147 additions
and
74 deletions
+147
-74
mysql-test/ndb/ndb_config_2_node.ini
mysql-test/ndb/ndb_config_2_node.ini
+1
-59
ndb/src/common/mgmcommon/ConfigInfo.cpp
ndb/src/common/mgmcommon/ConfigInfo.cpp
+104
-7
ndb/src/common/mgmcommon/ConfigInfo.hpp
ndb/src/common/mgmcommon/ConfigInfo.hpp
+16
-0
ndb/src/common/mgmcommon/InitConfigFileParser.cpp
ndb/src/common/mgmcommon/InitConfigFileParser.cpp
+26
-8
No files found.
mysql-test/ndb/ndb_config_2_node.ini
View file @
ca21e07a
...
...
@@ -73,63 +73,5 @@ ExecuteOnComputer: 6
Id:
14
ExecuteOnComputer:
7
# Mgmtsrvr connections
[TCP]
NodeId1:
1
NodeId2:
2
[TCP DEFAULT]
PortNumber:
CHOOSE_PORT_BASE02
[TCP]
NodeId1:
1
NodeId2:
3
PortNumber:
CHOOSE_PORT_BASE03
# Ndb nodes connections
[TCP]
NodeId1:
2
NodeId2:
3
PortNumber:
CHOOSE_PORT_BASE04
# Api connections
[TCP]
NodeId1:
11
NodeId2:
2
PortNumber:
CHOOSE_PORT_BASE05
[TCP]
NodeId1:
11
NodeId2:
3
PortNumber:
CHOOSE_PORT_BASE06
[TCP]
NodeId1:
12
NodeId2:
2
PortNumber:
CHOOSE_PORT_BASE07
[TCP]
NodeId1:
12
NodeId2:
3
PortNumber:
CHOOSE_PORT_BASE08
[TCP]
NodeId1:
13
NodeId2:
2
PortNumber:
CHOOSE_PORT_BASE09
[TCP]
NodeId1:
13
NodeId2:
3
PortNumber:
CHOOSE_PORT_BASE10
[TCP]
NodeId1:
14
NodeId2:
2
PortNumber:
CHOOSE_PORT_BASE11
[TCP]
NodeId1:
14
NodeId2:
3
PortNumber:
CHOOSE_PORT_BASE12
ndb/src/common/mgmcommon/ConfigInfo.cpp
View file @
ca21e07a
...
...
@@ -143,6 +143,19 @@ ConfigInfo::m_SectionRules[] = {
};
const
int
ConfigInfo
::
m_NoOfRules
=
sizeof
(
m_SectionRules
)
/
sizeof
(
SectionRule
);
/****************************************************************************
* Config Rules declarations
****************************************************************************/
bool
addNodeConnections
(
Vector
<
ConfigInfo
::
ConfigRuleSection
>&
sections
,
struct
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
ruleData
);
const
ConfigInfo
::
ConfigRule
ConfigInfo
::
m_ConfigRules
[]
=
{
{
addNodeConnections
,
0
},
{
0
,
0
}
};
struct
DepricationTransform
{
const
char
*
m_section
;
const
char
*
m_oldName
;
...
...
@@ -1525,7 +1538,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
ConfigInfo
::
USED
,
false
,
ConfigInfo
::
INT
,
MANDATORY
,
2202
,
0
,
0x7FFFFFFF
},
...
...
@@ -2712,8 +2725,8 @@ checkMandatory(InitConfigFileParser::Context & ctx, const char * data){
* Transform a string "NodeidX" (e.g. "uppsala.32")
* into a Uint32 "NodeIdX" (e.g. 32) and a string "SystemX" (e.g. "uppsala").
*/
bool
fixNodeId
(
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
data
)
{
bool
fixNodeId
(
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
data
)
{
char
buf
[]
=
"NodeIdX"
;
buf
[
6
]
=
data
[
sizeof
(
"NodeI"
)];
char
sysbuf
[]
=
"SystemX"
;
sysbuf
[
6
]
=
data
[
sizeof
(
"NodeI"
)];
const
char
*
nodeId
;
...
...
@@ -2739,7 +2752,6 @@ bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data){
require
(
ctx
.
m_currentSection
->
put
(
buf
,
id
,
true
));
require
(
ctx
.
m_currentSection
->
put
(
sysbuf
,
token1
));
}
return
true
;
}
...
...
@@ -2862,9 +2874,9 @@ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){
Uint32
adder
=
0
;
ctx
.
m_userProperties
.
get
(
"PortNumberAdder"
,
&
adder
);
Uint32
base
=
0
;
if
(
!
ctx
.
m_userDefaults
->
get
(
"PortNumber"
,
&
base
)
&&
if
(
!
(
ctx
.
m_userDefaults
&&
ctx
.
m_userDefaults
->
get
(
"PortNumber"
,
&
base
)
)
&&
!
ctx
.
m_systemDefaults
->
get
(
"PortNumber"
,
&
base
)){
return
tru
e
;
return
fals
e
;
}
ctx
.
m_currentSection
->
put
(
"PortNumber"
,
base
+
adder
);
adder
++
;
...
...
@@ -3144,3 +3156,88 @@ saveInConfigValues(InitConfigFileParser::Context & ctx, const char * data){
}
while
(
0
);
return
true
;
}
bool
addNodeConnections
(
Vector
<
ConfigInfo
::
ConfigRuleSection
>&
sections
,
struct
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
ruleData
)
{
Properties
*
props
=
ctx
.
m_config
;
Properties
p_connections
;
Properties
p_connections2
;
for
(
Uint32
i
=
0
;;
i
++
){
const
Properties
*
tmp
;
Uint32
nodeId1
,
nodeId2
;
if
(
!
props
->
get
(
"Connection"
,
i
,
&
tmp
))
break
;
if
(
!
tmp
->
get
(
"NodeId1"
,
&
nodeId1
))
continue
;
p_connections
.
put
(
""
,
nodeId1
,
nodeId1
);
if
(
!
tmp
->
get
(
"NodeId2"
,
&
nodeId2
))
continue
;
p_connections
.
put
(
""
,
nodeId2
,
nodeId2
);
p_connections2
.
put
(
""
,
nodeId1
+
nodeId2
<<
16
,
nodeId1
);
p_connections2
.
put
(
""
,
nodeId2
+
nodeId1
<<
16
,
nodeId2
);
}
Uint32
nNodes
;
ctx
.
m_userProperties
.
get
(
"NoOfNodes"
,
&
nNodes
);
Properties
p_db_nodes
;
Properties
p_api_mgm_nodes
;
Uint32
i_db
=
0
,
i_api_mgm
=
0
;
for
(
Uint32
i
=
0
,
n
=
0
;
n
<
nNodes
;
i
++
){
const
Properties
*
tmp
;
if
(
!
props
->
get
(
"Node"
,
i
,
&
tmp
))
continue
;
n
++
;
const
char
*
type
;
if
(
!
tmp
->
get
(
"Type"
,
&
type
))
continue
;
if
(
strcmp
(
type
,
"DB"
)
==
0
)
p_db_nodes
.
put
(
""
,
i_db
++
,
i
);
else
if
(
strcmp
(
type
,
"API"
)
==
0
||
strcmp
(
type
,
"MGM"
)
==
0
)
p_api_mgm_nodes
.
put
(
""
,
i_api_mgm
++
,
i
);
}
Uint32
nodeId1
,
nodeId2
,
dummy
;
for
(
Uint32
i
=
0
;
p_db_nodes
.
get
(
""
,
i
,
&
nodeId1
);
i
++
){
for
(
Uint32
j
=
i
+
1
;;
j
++
){
if
(
!
p_db_nodes
.
get
(
""
,
j
,
&
nodeId2
))
break
;
if
(
!
p_connections2
.
get
(
""
,
nodeId1
+
nodeId2
<<
16
,
&
dummy
))
{
ConfigInfo
::
ConfigRuleSection
s
;
s
.
m_sectionType
=
BaseString
(
"TCP"
);
s
.
m_sectionData
=
new
Properties
;
char
buf
[
16
];
snprintf
(
buf
,
sizeof
(
buf
),
"%u"
,
nodeId1
);
s
.
m_sectionData
->
put
(
"NodeId1"
,
buf
);
snprintf
(
buf
,
sizeof
(
buf
),
"%u"
,
nodeId2
);
s
.
m_sectionData
->
put
(
"NodeId2"
,
buf
);
sections
.
push_back
(
s
);
}
}
}
for
(
Uint32
i
=
0
;
p_api_mgm_nodes
.
get
(
""
,
i
,
&
nodeId1
);
i
++
){
if
(
!
p_connections
.
get
(
""
,
nodeId1
,
&
dummy
))
{
for
(
Uint32
j
=
0
;;
j
++
){
if
(
!
p_db_nodes
.
get
(
""
,
j
,
&
nodeId2
))
break
;
ConfigInfo
::
ConfigRuleSection
s
;
s
.
m_sectionType
=
BaseString
(
"TCP"
);
s
.
m_sectionData
=
new
Properties
;
char
buf
[
16
];
snprintf
(
buf
,
sizeof
(
buf
),
"%u"
,
nodeId1
);
s
.
m_sectionData
->
put
(
"NodeId1"
,
buf
);
snprintf
(
buf
,
sizeof
(
buf
),
"%u"
,
nodeId2
);
s
.
m_sectionData
->
put
(
"NodeId2"
,
buf
);
sections
.
push_back
(
s
);
}
}
}
return
true
;
}
ndb/src/common/mgmcommon/ConfigInfo.hpp
View file @
ca21e07a
...
...
@@ -71,6 +71,21 @@ public:
const
char
*
m_ruleData
;
};
/**
* Entry for config rule
*/
struct
ConfigRuleSection
{
BaseString
m_sectionType
;
Properties
*
m_sectionData
;
};
struct
ConfigRule
{
bool
(
*
m_configRule
)(
Vector
<
ConfigRuleSection
>&
,
struct
InitConfigFileParser
::
Context
&
,
const
char
*
m_ruleData
);
const
char
*
m_ruleData
;
};
ConfigInfo
();
/**
...
...
@@ -113,6 +128,7 @@ private:
public:
static
const
SectionRule
m_SectionRules
[];
static
const
ConfigRule
m_ConfigRules
[];
static
const
int
m_NoOfRules
;
};
...
...
ndb/src/common/mgmcommon/InitConfigFileParser.cpp
View file @
ca21e07a
...
...
@@ -163,6 +163,30 @@ InitConfigFileParser::parseConfig(FILE * file) {
return
0
;
}
for
(
size_t
i
=
0
;
ConfigInfo
::
m_ConfigRules
[
i
].
m_configRule
!=
0
;
i
++
){
ctx
.
type
=
InitConfigFileParser
::
Undefined
;
ctx
.
m_currentSection
=
0
;
ctx
.
m_userDefaults
=
0
;
ctx
.
m_currentInfo
=
0
;
ctx
.
m_systemDefaults
=
0
;
Vector
<
ConfigInfo
::
ConfigRuleSection
>
tmp
;
if
(
!
(
*
ConfigInfo
::
m_ConfigRules
[
i
].
m_configRule
)(
tmp
,
ctx
,
ConfigInfo
::
m_ConfigRules
[
i
].
m_ruleData
))
return
0
;
for
(
size_t
j
=
0
;
j
<
tmp
.
size
();
j
++
){
snprintf
(
ctx
.
fname
,
sizeof
(
ctx
.
fname
),
tmp
[
j
].
m_sectionType
.
c_str
());
ctx
.
type
=
InitConfigFileParser
::
Section
;
ctx
.
m_currentSection
=
tmp
[
j
].
m_sectionData
;
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
);
if
(
!
storeSection
(
ctx
))
return
0
;
}
}
Uint32
nConnections
=
0
;
Uint32
nComputers
=
0
;
Uint32
nNodes
=
0
;
...
...
@@ -499,30 +523,24 @@ bool
InitConfigFileParser
::
storeSection
(
Context
&
ctx
){
if
(
ctx
.
m_currentSection
==
NULL
)
return
true
;
for
(
int
i
=
strlen
(
ctx
.
fname
)
-
1
;
i
>=
0
;
i
--
){
ctx
.
fname
[
i
]
=
toupper
(
ctx
.
fname
[
i
]);
}
snprintf
(
ctx
.
pname
,
sizeof
(
ctx
.
pname
),
ctx
.
fname
);
char
buf
[
255
];
if
(
ctx
.
type
==
InitConfigFileParser
::
Section
)
snprintf
(
buf
,
sizeof
(
buf
),
"%s"
,
ctx
.
fname
);
if
(
ctx
.
type
==
InitConfigFileParser
::
DefaultSection
)
snprintf
(
buf
,
sizeof
(
buf
),
"%s DEFAULT"
,
ctx
.
fname
);
snprintf
(
ctx
.
fname
,
sizeof
(
ctx
.
fname
),
buf
);
if
(
ctx
.
type
==
InitConfigFileParser
::
Section
){
for
(
int
i
=
0
;
i
<
m_info
->
m_NoOfRules
;
i
++
){
const
ConfigInfo
::
SectionRule
&
rule
=
m_info
->
m_SectionRules
[
i
];
if
(
!
strcmp
(
rule
.
m_section
,
"*"
)
||
!
strcmp
(
rule
.
m_section
,
ctx
.
fname
))
{
if
(
!
(
*
rule
.
m_sectionRule
)(
ctx
,
rule
.
m_ruleData
))
{
if
(
!
strcmp
(
rule
.
m_section
,
"*"
)
||
!
strcmp
(
rule
.
m_section
,
ctx
.
fname
))
if
(
!
(
*
rule
.
m_sectionRule
)(
ctx
,
rule
.
m_ruleData
))
return
false
;
}
}
}
}
if
(
ctx
.
type
==
InitConfigFileParser
::
DefaultSection
)
require
(
ctx
.
m_defaults
->
put
(
ctx
.
pname
,
ctx
.
m_currentSection
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment