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
e5d03d1b
Commit
e5d03d1b
authored
Nov 30, 2004
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added check connection mgmapi method
added ndb_mgm_check_connection when error is printed
parent
d209371a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
3 deletions
+51
-3
ndb/include/mgmapi/mgmapi.h
ndb/include/mgmapi/mgmapi.h
+1
-0
ndb/src/mgmapi/mgmapi.cpp
ndb/src/mgmapi/mgmapi.cpp
+34
-0
ndb/src/mgmclient/CommandInterpreter.cpp
ndb/src/mgmclient/CommandInterpreter.cpp
+4
-3
ndb/src/mgmsrv/Services.cpp
ndb/src/mgmsrv/Services.cpp
+11
-0
ndb/src/mgmsrv/Services.hpp
ndb/src/mgmsrv/Services.hpp
+1
-0
No files found.
ndb/include/mgmapi/mgmapi.h
View file @
e5d03d1b
...
...
@@ -746,6 +746,7 @@ extern "C" {
int
ndb_mgm_get_string_parameter
(
const
ndb_mgm_configuration_iterator
*
,
int
param
,
const
char
**
value
);
int
ndb_mgm_purge_stale_sessions
(
NdbMgmHandle
handle
,
char
**
);
int
ndb_mgm_check_connection
(
NdbMgmHandle
handle
);
#ifdef __cplusplus
}
#endif
...
...
ndb/src/mgmapi/mgmapi.cpp
View file @
e5d03d1b
...
...
@@ -1934,4 +1934,38 @@ ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **purged){
return
res
;
}
extern
"C"
int
ndb_mgm_check_connection
(
NdbMgmHandle
handle
){
CHECK_HANDLE
(
handle
,
0
);
CHECK_CONNECTED
(
handle
,
0
);
SocketOutputStream
out
(
handle
->
socket
);
SocketInputStream
in
(
handle
->
socket
,
handle
->
read_timeout
);
char
buf
[
32
];
if
(
out
.
println
(
"check connection"
))
goto
ndb_mgm_check_connection_error
;
if
(
out
.
println
(
""
))
goto
ndb_mgm_check_connection_error
;
in
.
gets
(
buf
,
sizeof
(
buf
));
if
(
strcmp
(
"check connection reply
\n
"
,
buf
))
goto
ndb_mgm_check_connection_error
;
in
.
gets
(
buf
,
sizeof
(
buf
));
if
(
strcmp
(
"result: Ok
\n
"
,
buf
))
goto
ndb_mgm_check_connection_error
;
in
.
gets
(
buf
,
sizeof
(
buf
));
if
(
strcmp
(
"
\n
"
,
buf
))
goto
ndb_mgm_check_connection_error
;
return
0
;
ndb_mgm_check_connection_error:
ndb_mgm_disconnect
(
handle
);
return
-
1
;
}
template
class
Vector
<
const
ParserRow
<
ParserDummy
>
*>
;
ndb/src/mgmclient/CommandInterpreter.cpp
View file @
e5d03d1b
...
...
@@ -429,6 +429,8 @@ emptyString(const char* s)
void
CommandInterpreter
::
printError
()
{
if
(
ndb_mgm_check_connection
(
m_mgmsrv
))
connected
=
false
;
ndbout_c
(
"* %5d: %s"
,
ndb_mgm_get_latest_error
(
m_mgmsrv
),
ndb_mgm_get_latest_error_msg
(
m_mgmsrv
));
...
...
@@ -1030,9 +1032,6 @@ CommandInterpreter::executeShow(char* parameters)
{
int
i
;
if
(
emptyString
(
parameters
))
{
ndbout
<<
"Cluster Configuration"
<<
endl
<<
"---------------------"
<<
endl
;
ndb_mgm_cluster_state
*
state
=
ndb_mgm_get_status
(
m_mgmsrv
);
if
(
state
==
NULL
)
{
ndbout_c
(
"Could not get status"
);
...
...
@@ -1092,6 +1091,8 @@ CommandInterpreter::executeShow(char* parameters)
}
}
ndbout
<<
"Cluster Configuration"
<<
endl
<<
"---------------------"
<<
endl
;
print_nodes
(
state
,
it
,
"ndbd"
,
ndb_nodes
,
NDB_MGM_NODE_TYPE_NDB
,
master_id
);
print_nodes
(
state
,
it
,
"ndb_mgmd"
,
mgm_nodes
,
NDB_MGM_NODE_TYPE_MGM
,
0
);
print_nodes
(
state
,
it
,
"mysqld"
,
api_nodes
,
NDB_MGM_NODE_TYPE_API
,
0
);
...
...
ndb/src/mgmsrv/Services.cpp
View file @
e5d03d1b
...
...
@@ -244,6 +244,8 @@ ParserRow<MgmApiSession> commands[] = {
MGM_CMD
(
"purge stale sessions"
,
&
MgmApiSession
::
purge_stale_sessions
,
""
),
MGM_CMD
(
"check connection"
,
&
MgmApiSession
::
check_connection
,
""
),
MGM_END
()
};
...
...
@@ -1454,6 +1456,15 @@ MgmApiSession::purge_stale_sessions(Parser_t::Context &ctx,
m_output
->
println
(
""
);
}
void
MgmApiSession
::
check_connection
(
Parser_t
::
Context
&
ctx
,
const
class
Properties
&
args
)
{
m_output
->
println
(
"check connection reply"
);
m_output
->
println
(
"result: Ok"
);
m_output
->
println
(
""
);
}
template
class
MutexVector
<
int
>;
template
class
Vector
<
ParserRow
<
MgmApiSession
>
const
*>
;
template
class
Vector
<
unsigned
short
>;
ndb/src/mgmsrv/Services.hpp
View file @
e5d03d1b
...
...
@@ -91,6 +91,7 @@ public:
void
listen_event
(
Parser_t
::
Context
&
ctx
,
const
class
Properties
&
args
);
void
purge_stale_sessions
(
Parser_t
::
Context
&
ctx
,
const
class
Properties
&
args
);
void
check_connection
(
Parser_t
::
Context
&
ctx
,
const
class
Properties
&
args
);
void
repCommand
(
Parser_t
::
Context
&
ctx
,
const
class
Properties
&
args
);
};
...
...
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