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
5490cdfb
Commit
5490cdfb
authored
Jul 23, 2005
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tool to extract config info from ndb_mgmd
parent
a7830ed9
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
467 additions
and
28 deletions
+467
-28
ndb/include/mgmapi/mgmapi.h
ndb/include/mgmapi/mgmapi.h
+7
-0
ndb/src/mgmapi/mgmapi.cpp
ndb/src/mgmapi/mgmapi.cpp
+38
-24
ndb/src/mgmsrv/ConfigInfo.hpp
ndb/src/mgmsrv/ConfigInfo.hpp
+3
-3
ndb/tools/Makefile.am
ndb/tools/Makefile.am
+12
-1
ndb/tools/config.cpp
ndb/tools/config.cpp
+407
-0
No files found.
ndb/include/mgmapi/mgmapi.h
View file @
5490cdfb
...
...
@@ -49,6 +49,7 @@
* @{
*/
#include <stdio.h>
#include <ndb_types.h>
#include "mgmapi_config_parameters.h"
...
...
@@ -351,6 +352,12 @@ extern "C" {
int
ndb_mgm_get_latest_error_line
(
const
NdbMgmHandle
handle
);
#endif
/**
* Set error stream
*/
void
ndb_mgm_set_error_stream
(
NdbMgmHandle
,
FILE
*
);
/** @} *********************************************************************/
/**
* @name Functions: Create/Destroy Management Server Handles
...
...
ndb/src/mgmapi/mgmapi.cpp
View file @
5490cdfb
...
...
@@ -100,6 +100,7 @@ struct ndb_mgm_handle {
#ifdef MGMAPI_LOG
FILE
*
logfile
;
#endif
FILE
*
errstream
;
};
#define SET_ERROR(h, e, s) setError(h, e, __LINE__, s)
...
...
@@ -152,6 +153,7 @@ ndb_mgm_create_handle()
h
->
read_timeout
=
50000
;
h
->
write_timeout
=
100
;
h
->
cfg_i
=
0
;
h
->
errstream
=
stdout
;
strncpy
(
h
->
last_error_desc
,
"No error"
,
NDB_MGM_MAX_ERR_DESC_SIZE
);
...
...
@@ -205,6 +207,13 @@ ndb_mgm_destroy_handle(NdbMgmHandle * handle)
*
handle
=
0
;
}
extern
"C"
void
ndb_mgm_set_error_stream
(
NdbMgmHandle
handle
,
FILE
*
file
)
{
handle
->
errstream
=
file
;
}
/*****************************************************************************
* Error handling
*****************************************************************************/
...
...
@@ -369,7 +378,7 @@ ndb_mgm_connect(NdbMgmHandle handle, int no_retries,
break
;
if
(
verbose
>
0
)
{
char
buf
[
1024
];
ndbout_c
(
"Unable to connect with connect string: %s
"
,
fprintf
(
handle
->
errstream
,
"Unable to connect with connect string: %s
\n
"
,
cfg
.
makeConnectString
(
buf
,
sizeof
(
buf
)));
verbose
=
-
1
;
}
...
...
@@ -379,30 +388,33 @@ ndb_mgm_connect(NdbMgmHandle handle, int no_retries,
"Unable to connect with connect string: %s"
,
cfg
.
makeConnectString
(
buf
,
sizeof
(
buf
)));
if
(
verbose
==
-
2
)
ndbout
<<
", failed."
<<
endl
;
fprintf
(
handle
->
errstream
,
", failed.
\n
"
)
;
return
-
1
;
}
if
(
verbose
==
-
1
)
{
ndbout
<<
"Retrying every "
<<
retry_delay_in_seconds
<<
" seconds"
;
fprintf
(
handle
->
errstream
,
"Retrying every %d seconds"
,
retry_delay_in_seconds
);
if
(
no_retries
>
0
)
ndbout
<<
". Attempts left:"
;
fprintf
(
handle
->
errstream
,
". Attempts left:"
)
;
else
ndbout
<<
", until connected."
;;
ndbout
<<
flush
;
fprintf
(
handle
->
errstream
,
", until connected."
);
fflush
(
handle
->
errstream
)
;
verbose
=
-
2
;
}
if
(
no_retries
>
0
)
{
if
(
verbose
==
-
2
)
{
ndbout
<<
" "
<<
no_retries
;
ndbout
<<
flush
;
fprintf
(
handle
->
errstream
,
" %d"
,
no_retries
)
;
fflush
(
handle
->
errstream
)
;
}
no_retries
--
;
}
NdbSleep_SecSleep
(
retry_delay_in_seconds
);
}
if
(
verbose
==
-
2
)
ndbout
<<
endl
;
{
fprintf
(
handle
->
errstream
,
"
\n
"
);
fflush
(
handle
->
errstream
);
}
handle
->
cfg_i
=
i
;
handle
->
socket
=
sockfd
;
...
...
@@ -456,6 +468,8 @@ ndb_mgm_match_node_type(const char * type)
for
(
int
i
=
0
;
i
<
no_of_type_values
;
i
++
)
if
(
strcmp
(
type
,
type_values
[
i
].
str
)
==
0
)
return
type_values
[
i
].
value
;
else
if
(
strcmp
(
type
,
type_values
[
i
].
alias
)
==
0
)
return
type_values
[
i
].
value
;
return
NDB_MGM_NODE_TYPE_UNKNOWN
;
}
...
...
@@ -1651,28 +1665,28 @@ ndb_mgm_get_configuration(NdbMgmHandle handle, unsigned int version) {
do
{
const
char
*
buf
;
if
(
!
prop
->
get
(
"result"
,
&
buf
)
||
strcmp
(
buf
,
"Ok"
)
!=
0
){
ndbout_c
(
"ERROR Message: %s
\n
"
,
buf
);
fprintf
(
handle
->
errstream
,
"ERROR Message: %s
\n
\n
"
,
buf
);
break
;
}
buf
=
"<Unspecified>"
;
if
(
!
prop
->
get
(
"Content-Type"
,
&
buf
)
||
strcmp
(
buf
,
"ndbconfig/octet-stream"
)
!=
0
){
ndbout_c
(
"Unhandled response type: %s
"
,
buf
);
fprintf
(
handle
->
errstream
,
"Unhandled response type: %s
\n
"
,
buf
);
break
;
}
buf
=
"<Unspecified>"
;
if
(
!
prop
->
get
(
"Content-Transfer-Encoding"
,
&
buf
)
||
strcmp
(
buf
,
"base64"
)
!=
0
){
ndbout_c
(
"Unhandled encoding: %s
"
,
buf
);
fprintf
(
handle
->
errstream
,
"Unhandled encoding: %s
\n
"
,
buf
);
break
;
}
buf
=
"<Content-Length Unspecified>"
;
Uint32
len
=
0
;
if
(
!
prop
->
get
(
"Content-Length"
,
&
len
)){
ndbout_c
(
"Invalid response: %s
\n
"
,
buf
);
fprintf
(
handle
->
errstream
,
"Invalid response: %s
\n
\n
"
,
buf
);
break
;
}
...
...
@@ -1697,14 +1711,14 @@ ndb_mgm_get_configuration(NdbMgmHandle handle, unsigned int version) {
const
int
res
=
base64_decode
(
buf64
,
len
-
1
,
tmp
);
delete
[]
buf64
;
if
(
res
!=
0
){
ndbout_c
(
"Failed to decode buffer
"
);
fprintf
(
handle
->
errstream
,
"Failed to decode buffer
\n
"
);
break
;
}
ConfigValuesFactory
cvf
;
const
int
res2
=
cvf
.
unpack
(
tmp
);
if
(
!
res2
){
ndbout_c
(
"Failed to unpack buffer
"
);
fprintf
(
handle
->
errstream
,
"Failed to unpack buffer
\n
"
);
break
;
}
...
...
@@ -1808,7 +1822,7 @@ ndb_mgm_alloc_nodeid(NdbMgmHandle handle, unsigned int version, int nodetype)
}
Uint32
_nodeid
;
if
(
!
prop
->
get
(
"nodeid"
,
&
_nodeid
)
!=
0
){
ndbout_c
(
"ERROR Message: <nodeid Unspecified>
\n
"
);
fprintf
(
handle
->
errstream
,
"ERROR Message: <nodeid Unspecified>
\n
"
);
break
;
}
nodeid
=
_nodeid
;
...
...
@@ -1884,7 +1898,7 @@ ndb_mgm_set_int_parameter(NdbMgmHandle handle,
do
{
const
char
*
buf
;
if
(
!
prop
->
get
(
"result"
,
&
buf
)
||
strcmp
(
buf
,
"Ok"
)
!=
0
){
ndbout_c
(
"ERROR Message: %s
\n
"
,
buf
);
fprintf
(
handle
->
errstream
,
"ERROR Message: %s
\n
"
,
buf
);
break
;
}
res
=
0
;
...
...
@@ -1927,7 +1941,7 @@ ndb_mgm_set_int64_parameter(NdbMgmHandle handle,
do
{
const
char
*
buf
;
if
(
!
prop
->
get
(
"result"
,
&
buf
)
||
strcmp
(
buf
,
"Ok"
)
!=
0
){
ndbout_c
(
"ERROR Message: %s
\n
"
,
buf
);
fprintf
(
handle
->
errstream
,
"ERROR Message: %s
\n
"
,
buf
);
break
;
}
res
=
0
;
...
...
@@ -1970,7 +1984,7 @@ ndb_mgm_set_string_parameter(NdbMgmHandle handle,
do
{
const
char
*
buf
;
if
(
!
prop
->
get
(
"result"
,
&
buf
)
||
strcmp
(
buf
,
"Ok"
)
!=
0
){
ndbout_c
(
"ERROR Message: %s
\n
"
,
buf
);
fprintf
(
handle
->
errstream
,
"ERROR Message: %s
\n
"
,
buf
);
break
;
}
res
=
0
;
...
...
@@ -2007,7 +2021,7 @@ ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **purged){
do
{
const
char
*
buf
;
if
(
!
prop
->
get
(
"result"
,
&
buf
)
||
strcmp
(
buf
,
"Ok"
)
!=
0
){
ndbout_c
(
"ERROR Message: %s
\n
"
,
buf
);
fprintf
(
handle
->
errstream
,
"ERROR Message: %s
\n
"
,
buf
);
break
;
}
if
(
purged
)
{
...
...
ndb/src/mgmsrv/ConfigInfo.hpp
View file @
5490cdfb
...
...
@@ -126,14 +126,14 @@ private:
Properties
m_info
;
Properties
m_systemDefaults
;
static
const
ParamInfo
m_ParamInfo
[];
static
const
int
m_NoOfParams
;
static
const
AliasPair
m_sectionNameAliases
[];
static
const
char
*
m_sectionNames
[];
static
const
int
m_noOfSectionNames
;
public:
static
const
ParamInfo
m_ParamInfo
[];
static
const
int
m_NoOfParams
;
static
const
SectionRule
m_SectionRules
[];
static
const
ConfigRule
m_ConfigRules
[];
static
const
int
m_NoOfRules
;
...
...
ndb/tools/Makefile.am
View file @
5490cdfb
...
...
@@ -9,7 +9,7 @@ ndbtools_PROGRAMS = \
ndb_show_tables
\
ndb_select_all
\
ndb_select_count
\
ndb_restore
ndb_restore
ndb_config
tools_common_sources
=
../test/src/NDBT_ReturnCodes.cpp
\
../test/src/NDBT_Table.cpp
\
...
...
@@ -32,6 +32,16 @@ ndb_restore_SOURCES = restore/restore_main.cpp \
restore/consumer_printer.cpp
\
restore/Restore.cpp
ndb_config_SOURCES
=
config.cpp
\
../src/mgmsrv/Config.cpp
\
../src/mgmsrv/ConfigInfo.cpp
\
../src/mgmsrv/InitConfigFileParser.cpp
ndb_config_CXXFLAGS
=
-I
$(top_srcdir)
/ndb/src/mgmapi
\
-I
$(top_srcdir)
/ndb/src/mgmsrv
\
-I
$(top_srcdir)
/ndb/include/mgmcommon
\
-DMYSQLCLUSTERDIR
=
"
\"\"
"
include
$(top_srcdir)/ndb/config/common.mk.am
include
$(top_srcdir)/ndb/config/type_ndbapitools.mk.am
...
...
@@ -45,6 +55,7 @@ ndb_show_tables_LDFLAGS = @ndb_bin_am_ldflags@
ndb_select_all_LDFLAGS
=
@ndb_bin_am_ldflags@
ndb_select_count_LDFLAGS
=
@ndb_bin_am_ldflags@
ndb_restore_LDFLAGS
=
@ndb_bin_am_ldflags@
ndb_config_LDFLAGS
=
@ndb_bin_am_ldflags@
# Don't update the files from bitkeeper
%
::
SCCS/s.%
...
...
ndb/tools/config.cpp
0 → 100644
View file @
5490cdfb
This diff is collapsed.
Click to expand it.
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