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
50cee6ab
Commit
50cee6ab
authored
Aug 26, 2004
by
tomas@poseidon.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb cluster config fixes, se respective files
parent
03511a0d
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
338 additions
and
207 deletions
+338
-207
mysql-test/ndb/ndb_config_2_node.ini
mysql-test/ndb/ndb_config_2_node.ini
+4
-3
ndb/include/mgmapi/mgmapi_config_parameters.h
ndb/include/mgmapi/mgmapi_config_parameters.h
+3
-0
ndb/include/mgmcommon/ConfigRetriever.hpp
ndb/include/mgmcommon/ConfigRetriever.hpp
+5
-5
ndb/include/mgmcommon/NdbConfig.h
ndb/include/mgmcommon/NdbConfig.h
+1
-0
ndb/src/common/mgmcommon/ConfigInfo.cpp
ndb/src/common/mgmcommon/ConfigInfo.cpp
+231
-148
ndb/src/common/mgmcommon/ConfigRetriever.cpp
ndb/src/common/mgmcommon/ConfigRetriever.cpp
+13
-8
ndb/src/common/mgmcommon/InitConfigFileParser.cpp
ndb/src/common/mgmcommon/InitConfigFileParser.cpp
+0
-4
ndb/src/common/mgmcommon/NdbConfig.c
ndb/src/common/mgmcommon/NdbConfig.c
+11
-1
ndb/src/kernel/Makefile.am
ndb/src/kernel/Makefile.am
+4
-1
ndb/src/kernel/vm/Configuration.cpp
ndb/src/kernel/vm/Configuration.cpp
+19
-7
ndb/src/mgmsrv/MgmtSrvr.cpp
ndb/src/mgmsrv/MgmtSrvr.cpp
+45
-28
ndb/src/mgmsrv/main.cpp
ndb/src/mgmsrv/main.cpp
+2
-2
No files found.
mysql-test/ndb/ndb_config_2_node.ini
View file @
50cee6ab
...
...
@@ -5,15 +5,16 @@ DataMemory= CHOOSE_DataMemory
IndexMemory
=
CHOOSE_IndexMemory
Diskless
=
CHOOSE_Diskless
TimeBetweenWatchDogCheck
=
30000
FileSystemPath
=
CHOOSE_FILESYSTEM
DataDir
=
CHOOSE_FILESYSTEM
[ndbd]
HostName
:
CHOOSE_HOSTNAME_1
HostName
=
CHOOSE_HOSTNAME_1
[ndbd]
HostName
:
CHOOSE_HOSTNAME_2
HostName
=
CHOOSE_HOSTNAME_2
[ndb_mgmd]
DataDir
=
CHOOSE_FILESYSTEM
PortNumber
=
CHOOSE_PORT_MGM
[mysqld]
...
...
ndb/include/mgmapi/mgmapi_config_parameters.h
View file @
50cee6ab
...
...
@@ -12,6 +12,7 @@
#define CFG_NODE_BYTE_ORDER 4
#define CFG_NODE_HOST 5
#define CFG_NODE_SYSTEM 6
#define CFG_NODE_DATADIR 7
/**
* DB config parameters
...
...
@@ -89,6 +90,8 @@
#define CFG_DB_LONG_SIGNAL_BUFFER 157
#define CFG_DB_BACKUP_DATA_PATH 158
#define CFG_NODE_ARBIT_RANK 200
#define CFG_NODE_ARBIT_DELAY 201
...
...
ndb/include/mgmcommon/ConfigRetriever.hpp
View file @
50cee6ab
...
...
@@ -78,6 +78,11 @@ public:
* Get config from file
*/
struct
ndb_mgm_configuration
*
getConfig
(
const
char
*
file
);
/**
* Verify config
*/
bool
verifyConfig
(
const
struct
ndb_mgm_configuration
*
,
Uint32
nodeid
);
private:
BaseString
errorString
;
enum
ErrorType
{
...
...
@@ -97,11 +102,6 @@ private:
Uint32
m_version
;
Uint32
m_node_type
;
NdbMgmHandle
m_handle
;
/**
* Verify config
*/
bool
verifyConfig
(
const
struct
ndb_mgm_configuration
*
);
};
#endif
...
...
ndb/include/mgmcommon/NdbConfig.h
View file @
50cee6ab
...
...
@@ -21,6 +21,7 @@
extern
"C"
{
#endif
void
NdbConfig_SetPath
(
const
char
*
path
);
char
*
NdbConfig_NdbCfgName
(
int
with_ndb_home
);
char
*
NdbConfig_ErrorFileName
(
int
node_id
);
char
*
NdbConfig_ClusterLogFileName
(
int
node_id
);
...
...
ndb/src/common/mgmcommon/ConfigInfo.cpp
View file @
50cee6ab
This diff is collapsed.
Click to expand it.
ndb/src/common/mgmcommon/ConfigRetriever.cpp
View file @
50cee6ab
...
...
@@ -154,7 +154,7 @@ ConfigRetriever::getConfig() {
if
(
p
==
0
)
return
0
;
if
(
!
verifyConfig
(
p
)){
if
(
!
verifyConfig
(
p
,
_ownNodeId
)){
free
(
p
);
p
=
0
;
}
...
...
@@ -239,7 +239,7 @@ ConfigRetriever::setConnectString(const char * connectString) {
}
bool
ConfigRetriever
::
verifyConfig
(
const
struct
ndb_mgm_configuration
*
conf
){
ConfigRetriever
::
verifyConfig
(
const
struct
ndb_mgm_configuration
*
conf
,
Uint32
nodeid
){
char
buf
[
255
];
ndb_mgm_configuration_iterator
*
it
;
...
...
@@ -253,8 +253,8 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
}
NdbAutoPtr
<
ndb_mgm_configuration_iterator
>
ptr
(
it
);
if
(
ndb_mgm_find
(
it
,
CFG_NODE_ID
,
_ownNodeI
d
)
!=
0
){
snprintf
(
buf
,
255
,
"Unable to find node with id: %d"
,
_ownNodeI
d
);
if
(
ndb_mgm_find
(
it
,
CFG_NODE_ID
,
nodei
d
)
!=
0
){
snprintf
(
buf
,
255
,
"Unable to find node with id: %d"
,
nodei
d
);
setError
(
CR_ERROR
,
buf
);
return
false
;
}
...
...
@@ -266,6 +266,11 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
return
false
;
}
const
char
*
datadir
;
if
(
!
ndb_mgm_get_string_parameter
(
it
,
CFG_NODE_DATADIR
,
&
datadir
)){
NdbConfig_SetPath
(
datadir
);
}
char
localhost
[
MAXHOSTNAMELEN
];
if
(
NdbHost_GetHostName
(
localhost
)
!=
0
){
snprintf
(
buf
,
255
,
"Unable to get own hostname"
);
...
...
@@ -332,8 +337,8 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
if
(
iter
.
get
(
CFG_CONNECTION_NODE_1
,
&
nodeId1
))
continue
;
if
(
iter
.
get
(
CFG_CONNECTION_NODE_2
,
&
nodeId2
))
continue
;
if
(
nodeId1
!=
_ownNodeId
&&
nodeId2
!=
_ownNodeI
d
)
continue
;
remoteNodeId
=
(
_ownNodeI
d
==
nodeId1
?
nodeId2
:
nodeId1
);
if
(
nodeId1
!=
nodeid
&&
nodeId2
!=
nodei
d
)
continue
;
remoteNodeId
=
(
nodei
d
==
nodeId1
?
nodeId2
:
nodeId1
);
const
char
*
name
;
struct
in_addr
addr
;
...
...
@@ -342,7 +347,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
if
(
Ndb_getInAddr
(
&
addr
,
name
)
!=
0
){
tmp
.
assfmt
(
"Unable to lookup/illegal hostname %s, "
"connection from node %d to node %d"
,
name
,
_ownNodeI
d
,
remoteNodeId
);
name
,
nodei
d
,
remoteNodeId
);
setError
(
CR_ERROR
,
tmp
.
c_str
());
return
false
;
}
...
...
@@ -352,7 +357,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
if
(
Ndb_getInAddr
(
&
addr
,
name
)
!=
0
){
tmp
.
assfmt
(
"Unable to lookup/illegal hostname %s, "
"connection from node %d to node %d"
,
name
,
_ownNodeI
d
,
remoteNodeId
);
name
,
nodei
d
,
remoteNodeId
);
setError
(
CR_ERROR
,
tmp
.
c_str
());
return
false
;
}
...
...
ndb/src/common/mgmcommon/InitConfigFileParser.cpp
View file @
50cee6ab
...
...
@@ -480,10 +480,6 @@ InitConfigFileParser::parseSectionHeader(const char* line) const {
tmp
[
0
]
=
' '
;
trim
(
tmp
);
// Convert section header to upper
for
(
int
i
=
strlen
(
tmp
)
-
1
;
i
>=
0
;
i
--
)
tmp
[
i
]
=
toupper
(
tmp
[
i
]);
// Get the correct header name if an alias
{
const
char
*
tmp_alias
=
m_info
->
getAlias
(
tmp
);
...
...
ndb/src/common/mgmcommon/NdbConfig.c
View file @
50cee6ab
...
...
@@ -19,6 +19,8 @@
#include <NdbEnv.h>
#include <NdbMem.h>
static
char
*
datadir_path
=
0
;
static
char
*
NdbConfig_AllocHomePath
(
int
_len
)
{
...
...
@@ -27,19 +29,27 @@ NdbConfig_AllocHomePath(int _len)
int
path_len
=
0
;
char
*
buf
;
if
(
path
==
0
)
path
=
datadir_path
;
if
(
path
)
path_len
=
strlen
(
path
);
len
+=
path_len
;
buf
=
NdbMem_Allocate
(
len
);
if
(
path_len
>
0
)
snprintf
(
buf
,
len
,
"%s%
c
"
,
path
,
DIR_SEPARATOR
);
snprintf
(
buf
,
len
,
"%s%
s
"
,
path
,
DIR_SEPARATOR
);
else
buf
[
0
]
=
0
;
return
buf
;
}
void
NdbConfig_SetPath
(
const
char
*
path
){
datadir_path
=
path
;
}
char
*
NdbConfig_NdbCfgName
(
int
with_ndb_home
){
char
*
buf
;
...
...
ndb/src/kernel/Makefile.am
View file @
50cee6ab
...
...
@@ -52,7 +52,10 @@ LDADD += \
$(top_builddir)
/ndb/src/common/mgmcommon/libmgmsrvcommon.la
\
$(top_builddir)
/ndb/src/mgmapi/libmgmapi.la
\
$(top_builddir)
/ndb/src/common/portlib/libportlib.la
\
$(top_builddir)
/ndb/src/common/util/libgeneral.la
$(top_builddir)
/ndb/src/common/util/libgeneral.la
\
$(top_builddir)
/dbug/libdbug.a
\
$(top_builddir)
/mysys/libmysys.a
\
$(top_builddir)
/strings/libmystrings.a
# Don't update the files from bitkeeper
%
::
SCCS/s.%
ndb/src/kernel/vm/Configuration.cpp
View file @
50cee6ab
...
...
@@ -14,6 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#include <my_sys.h>
#include "Configuration.hpp"
#include <ErrorHandlingMacros.hpp>
#include "GlobalData.hpp"
...
...
@@ -56,6 +59,9 @@ Configuration::init(int argc, const char** argv){
int
_deamon
=
0
;
int
_help
=
0
;
int
_print_version
=
0
;
#ifndef DBUG_OFF
const
char
*
debug_option
=
0
;
#endif
/**
* Arguments to NDB process
...
...
@@ -66,6 +72,10 @@ Configuration::init(int argc, const char** argv){
{
"nostart"
,
'n'
,
arg_flag
,
&
_no_start
,
"Don't start ndbd immediately. Ndbd will await command from ndb_mgmd"
,
""
},
{
"daemon"
,
'd'
,
arg_flag
,
&
_deamon
,
"Start ndbd as daemon"
,
""
},
#ifndef DBUG_OFF
{
"debug"
,
0
,
arg_string
,
&
debug_option
,
"Specify debug options e.g. d:t:i:o,out.trace"
,
"options"
},
#endif
{
"initial"
,
'i'
,
arg_flag
,
&
_initial
,
"Perform initial start of ndbd, including cleaning the file system. Consult documentation before using this"
,
""
},
...
...
@@ -84,15 +94,17 @@ Configuration::init(int argc, const char** argv){
return
false
;
}
#if 0
ndbout << "no_start=" <<_no_start<< endl;
ndbout << "initial=" <<_initial<< endl;
ndbout << "deamon=" <<_deamon<< endl;
ndbout << "connect_str="<<_connect_str<<endl;
arg_printusage(args, num_args, argv[0], desc);
return false;
#ifndef DBUG_OFF
my_init
();
if
(
debug_option
)
DBUG_PUSH
(
debug_option
);
#endif
DBUG_PRINT
(
"info"
,
(
"no_start=%d"
,
_no_start
));
DBUG_PRINT
(
"info"
,
(
"initial=%d"
,
_initial
));
DBUG_PRINT
(
"info"
,
(
"deamon=%d"
,
_deamon
));
DBUG_PRINT
(
"info"
,
(
"connect_str=%s"
,
_connect_str
));
ndbSetOwnVersion
();
if
(
_print_version
)
{
...
...
ndb/src/mgmsrv/MgmtSrvr.cpp
View file @
50cee6ab
...
...
@@ -19,6 +19,7 @@
#include "MgmtSrvr.hpp"
#include "MgmtErrorReporter.hpp"
#include <ConfigRetriever.hpp>
#include <NdbOut.hpp>
#include <NdbApiSignal.hpp>
...
...
@@ -512,6 +513,8 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
theConfCount
(
0
),
m_allocated_resources
(
*
this
)
{
DBUG_ENTER
(
"MgmtSrvr::MgmtSrvr"
);
_config
=
NULL
;
_isStatPortActive
=
false
;
_isClusterLogStatActive
=
false
;
...
...
@@ -543,37 +546,39 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
for
(
Uint32
i
=
0
;
i
<
MAX_NODES
;
i
++
)
nodeTypes
[
i
]
=
(
enum
ndb_mgm_node_type
)
-
1
;
ndb_mgm_configuration_iterator
*
iter
=
ndb_mgm_create_configuration_iterator
(
config
->
m_configValues
,
CFG_SECTION_NODE
);
for
(
ndb_mgm_first
(
iter
);
ndb_mgm_valid
(
iter
);
ndb_mgm_next
(
iter
)){
unsigned
type
,
id
;
if
(
ndb_mgm_get_int_parameter
(
iter
,
CFG_TYPE_OF_SECTION
,
&
type
)
!=
0
)
continue
;
if
(
ndb_mgm_get_int_parameter
(
iter
,
CFG_NODE_ID
,
&
id
)
!=
0
)
continue
;
MGM_REQUIRE
(
id
<
MAX_NODES
);
{
ndb_mgm_configuration_iterator
*
iter
=
ndb_mgm_create_configuration_iterator
(
config
->
m_configValues
,
CFG_SECTION_NODE
);
for
(
ndb_mgm_first
(
iter
);
ndb_mgm_valid
(
iter
);
ndb_mgm_next
(
iter
)){
unsigned
type
,
id
;
if
(
ndb_mgm_get_int_parameter
(
iter
,
CFG_TYPE_OF_SECTION
,
&
type
)
!=
0
)
continue
;
switch
(
type
){
case
NODE_TYPE_DB
:
nodeTypes
[
id
]
=
NDB_MGM_NODE_TYPE_NDB
;
break
;
case
NODE_TYPE_API
:
nodeTypes
[
id
]
=
NDB_MGM_NODE_TYPE_API
;
break
;
case
NODE_TYPE_MGM
:
nodeTypes
[
id
]
=
NDB_MGM_NODE_TYPE_MGM
;
break
;
case
NODE_TYPE_REP
:
nodeTypes
[
id
]
=
NDB_MGM_NODE_TYPE_REP
;
break
;
case
NODE_TYPE_EXT_REP
:
default:
break
;
if
(
ndb_mgm_get_int_parameter
(
iter
,
CFG_NODE_ID
,
&
id
)
!=
0
)
continue
;
MGM_REQUIRE
(
id
<
MAX_NODES
);
switch
(
type
){
case
NODE_TYPE_DB
:
nodeTypes
[
id
]
=
NDB_MGM_NODE_TYPE_NDB
;
break
;
case
NODE_TYPE_API
:
nodeTypes
[
id
]
=
NDB_MGM_NODE_TYPE_API
;
break
;
case
NODE_TYPE_MGM
:
nodeTypes
[
id
]
=
NDB_MGM_NODE_TYPE_MGM
;
break
;
case
NODE_TYPE_REP
:
nodeTypes
[
id
]
=
NDB_MGM_NODE_TYPE_REP
;
break
;
case
NODE_TYPE_EXT_REP
:
default:
break
;
}
}
ndb_mgm_destroy_iterator
(
iter
);
}
ndb_mgm_destroy_iterator
(
iter
);
m_statisticsListner
=
NULL
;
...
...
@@ -589,6 +594,18 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
exit
(
-
1
);
}
_ownNodeId
=
tmp
;
{
DBUG_PRINT
(
"info"
,
(
"verifyConfig"
));
ConfigRetriever
cr
(
NDB_VERSION
,
NDB_MGM_NODE_TYPE_MGM
);
if
(
!
cr
.
verifyConfig
(
config
->
m_configValues
,
_ownNodeId
))
{
ndbout
<<
cr
.
getErrorString
()
<<
endl
;
exit
(
-
1
);
}
}
DBUG_VOID_RETURN
;
}
...
...
ndb/src/mgmsrv/main.cpp
View file @
50cee6ab
...
...
@@ -109,7 +109,7 @@ struct getargs args[] = {
"Specify cluster configuration file"
,
"filename"
},
#ifndef DBUG_OFF
{
"debug"
,
0
,
arg_string
,
&
debug_option
,
"Specify debug option
e.d
. d:t:i:o,out.trace"
,
"options"
},
"Specify debug option
s e.g
. d:t:i:o,out.trace"
,
"options"
},
#endif
{
"daemon"
,
'd'
,
arg_flag
,
&
glob
.
daemon
,
"Run ndb_mgmd in daemon mode"
},
...
...
@@ -143,8 +143,8 @@ NDB_MAIN(mgmsrv){
exit
(
1
);
}
my_init
();
#ifndef DBUG_OFF
my_init
();
if
(
debug_option
)
DBUG_PUSH
(
debug_option
);
#endif
...
...
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