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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
035673c3
Commit
035673c3
authored
Sep 30, 2005
by
jonas@perch.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wl#1882
allow ndb_mgmd to use my.cnf for cluster configuration
parent
21153069
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
453 additions
and
15 deletions
+453
-15
ndb/src/mgmsrv/ConfigInfo.cpp
ndb/src/mgmsrv/ConfigInfo.cpp
+46
-6
ndb/src/mgmsrv/InitConfigFileParser.cpp
ndb/src/mgmsrv/InitConfigFileParser.cpp
+360
-2
ndb/src/mgmsrv/InitConfigFileParser.hpp
ndb/src/mgmsrv/InitConfigFileParser.hpp
+16
-0
ndb/src/mgmsrv/MgmtSrvr.cpp
ndb/src/mgmsrv/MgmtSrvr.cpp
+1
-3
ndb/src/mgmsrv/MgmtSrvrConfig.cpp
ndb/src/mgmsrv/MgmtSrvrConfig.cpp
+9
-1
ndb/src/mgmsrv/main.cpp
ndb/src/mgmsrv/main.cpp
+21
-3
No files found.
ndb/src/mgmsrv/ConfigInfo.cpp
View file @
035673c3
...
...
@@ -241,6 +241,9 @@ struct DepricationTransform {
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
},
{
0
,
0
,
0
,
0
,
0
}
};
...
...
@@ -405,9 +408,21 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
0
,
0
},
{
CFG_NODE_ID
,
KEY_INTERNAL
,
"Id"
,
DB_TOKEN
,
""
,
ConfigInfo
::
CI_DEPRICATED
,
false
,
ConfigInfo
::
CI_INT
,
MANDATORY
,
"1"
,
STR_VALUE
(
MAX_NODES
)
},
{
CFG_NODE_ID
,
"nodeid"
,
DB_TOKEN
,
"Number identifying the database node ("
DB_TOKEN_PRINT
")"
,
ConfigInfo
::
CI_USED
,
false
,
...
...
@@ -1244,9 +1259,21 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
0
,
0
},
{
CFG_NODE_ID
,
KEY_INTERNAL
,
"Id"
,
API_TOKEN
,
""
,
ConfigInfo
::
CI_DEPRICATED
,
false
,
ConfigInfo
::
CI_INT
,
MANDATORY
,
"1"
,
STR_VALUE
(
MAX_NODES
)
},
{
CFG_NODE_ID
,
"nodeid"
,
API_TOKEN
,
"Number identifying application node ("
API_TOKEN_PRINT
")"
,
ConfigInfo
::
CI_USED
,
false
,
...
...
@@ -1375,9 +1402,21 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
0
,
0
},
{
CFG_NODE_ID
,
KEY_INTERNAL
,
"Id"
,
MGM_TOKEN
,
""
,
ConfigInfo
::
CI_DEPRICATED
,
false
,
ConfigInfo
::
CI_INT
,
MANDATORY
,
"1"
,
STR_VALUE
(
MAX_NODES
)
},
{
CFG_NODE_ID
,
"nodeid"
,
MGM_TOKEN
,
"Number identifying the management server node ("
MGM_TOKEN_PRINT
")"
,
ConfigInfo
::
CI_USED
,
false
,
...
...
@@ -2516,14 +2555,14 @@ bool
transformNode
(
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
data
){
Uint32
id
;
if
(
!
ctx
.
m_currentSection
->
get
(
"Id"
,
&
id
)){
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
))
id
++
;
ctx
.
m_userProperties
.
put
(
"NextNodeId"
,
id
+
1
,
true
);
ctx
.
m_currentSection
->
put
(
"
I
d"
,
id
);
ctx
.
m_currentSection
->
put
(
"
nodei
d"
,
id
);
#if 0
ctx.reportError("Mandatory parameter Id missing from section "
"[%s] starting at line: %d",
...
...
@@ -2531,7 +2570,7 @@ transformNode(InitConfigFileParser::Context & ctx, const char * data){
return false;
#endif
}
else
if
(
ctx
.
m_userProperties
.
get
(
"AllocatedNodeId_"
,
id
,
&
id
))
{
ctx
.
reportError
(
"Duplicate
I
d in section "
ctx
.
reportError
(
"Duplicate
nodei
d in section "
"[%s] starting at line: %d"
,
ctx
.
fname
,
ctx
.
m_sectionLineno
);
return
false
;
...
...
@@ -3356,6 +3395,7 @@ transform(InitConfigFileParser::Context & ctx,
PropertiesType
oldType
;
require
(
ctx
.
m_currentSection
->
getTypeOf
(
oldName
,
&
oldType
));
ConfigInfo
::
Type
newType
=
ctx
.
m_info
->
getType
(
ctx
.
m_currentInfo
,
newName
);
if
(
!
((
oldType
==
PropertiesType_Uint32
||
oldType
==
PropertiesType_Uint64
)
&&
(
newType
==
ConfigInfo
::
CI_INT
||
newType
==
ConfigInfo
::
CI_INT64
||
newType
==
ConfigInfo
::
CI_BOOL
))){
ndbout
<<
"oldType: "
<<
(
int
)
oldType
<<
", newType: "
<<
(
int
)
newType
<<
endl
;
...
...
ndb/src/mgmsrv/InitConfigFileParser.cpp
View file @
035673c3
This diff is collapsed.
Click to expand it.
ndb/src/mgmsrv/InitConfigFileParser.hpp
View file @
035673c3
...
...
@@ -50,6 +50,7 @@ public:
*/
Config
*
parseConfig
(
FILE
*
file
);
Config
*
parseConfig
(
const
char
*
filename
);
Config
*
parse_mycnf
();
/**
* Parser context struct
...
...
@@ -122,6 +123,21 @@ private:
* Information about parameters (min, max values etc)
*/
ConfigInfo
*
m_info
;
bool
handle_mycnf_defaults
(
Vector
<
struct
my_option
>&
options
,
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
name
);
bool
load_mycnf_groups
(
Vector
<
struct
my_option
>
&
options
,
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
name
,
const
char
*
groups
[]);
bool
store_in_properties
(
Vector
<
struct
my_option
>&
options
,
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
name
);
Config
*
run_config_rules
(
Context
&
ctx
);
};
#endif // InitConfigFileParser_H
ndb/src/mgmsrv/MgmtSrvr.cpp
View file @
035673c3
...
...
@@ -433,8 +433,6 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
m_newConfig
=
NULL
;
if
(
config_filename
)
m_configFilename
.
assign
(
config_filename
);
else
m_configFilename
.
assign
(
"config.ini"
);
m_nextConfigGenerationNumber
=
0
;
...
...
@@ -469,7 +467,7 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
_config
=
readConfig
();
if
(
_config
==
0
)
{
ndbout
<<
"Unable to read config file"
<<
endl
;
require
(
false
);
exit
(
-
1
);
}
}
...
...
ndb/src/mgmsrv/MgmtSrvrConfig.cpp
View file @
035673c3
...
...
@@ -274,7 +274,15 @@ Config *
MgmtSrvr
::
readConfig
()
{
Config
*
conf
;
InitConfigFileParser
parser
;
conf
=
parser
.
parseConfig
(
m_configFilename
.
c_str
());
if
(
m_configFilename
.
length
())
{
conf
=
parser
.
parseConfig
(
m_configFilename
.
c_str
());
}
else
{
ndbout_c
(
"Reading cluster configuration using my.cnf"
);
conf
=
parser
.
parse_mycnf
();
}
return
conf
;
}
...
...
ndb/src/mgmsrv/main.cpp
View file @
035673c3
...
...
@@ -102,6 +102,7 @@ static int opt_daemon; // NOT bool, bool need not be int
static
int
opt_non_interactive
;
static
int
opt_interactive
;
static
const
char
*
opt_config_filename
=
0
;
static
int
opt_mycnf
=
0
;
struct
MgmGlobals
{
MgmGlobals
();
...
...
@@ -166,6 +167,10 @@ static struct my_option my_long_options[] =
"Don't run as daemon, but don't read from stdin"
,
(
gptr
*
)
&
opt_non_interactive
,
(
gptr
*
)
&
opt_non_interactive
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"mycnf"
,
256
,
"Read cluster config from my.cnf"
,
(
gptr
*
)
&
opt_mycnf
,
(
gptr
*
)
&
opt_mycnf
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
}
};
...
...
@@ -199,7 +204,7 @@ int main(int argc, char** argv)
#endif
global_mgmt_server_check
=
1
;
const
char
*
load_default_groups
[]
=
{
"mysql_cluster"
,
"ndb_mgmd"
,
0
};
load_defaults
(
"my"
,
load_default_groups
,
&
argc
,
&
argv
);
...
...
@@ -217,13 +222,26 @@ int main(int argc, char** argv)
opt_daemon
=
0
;
}
if
(
opt_mycnf
&&
opt_config_filename
)
{
ndbout_c
(
"Both --mycnf and -f is not supported"
);
return
0
;
}
if
(
opt_mycnf
==
0
&&
opt_config_filename
==
0
)
{
struct
stat
buf
;
if
(
stat
(
"config.ini"
,
&
buf
)
!=
-
1
)
opt_config_filename
=
"config.ini"
;
}
glob
->
socketServer
=
new
SocketServer
();
MgmApiService
*
mapi
=
new
MgmApiService
();
glob
->
mgmObject
=
new
MgmtSrvr
(
glob
->
socketServer
,
opt_config_filename
,
opt_connect_str
);
opt_config_filename
,
opt_connect_str
);
if
(
g_print_full_config
)
goto
the_end
;
...
...
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