diff options
author | unknown <stewart@willster.(none)> | 2006-10-05 18:51:13 +1000 |
---|---|---|
committer | unknown <stewart@willster.(none)> | 2006-10-05 18:51:13 +1000 |
commit | db16cae578dd32ee2e66d8746444613c34b1e3e8 (patch) | |
tree | b95cd7b958b532ad93aa61c6d5a0e2408297c383 /ndb/src/mgmapi | |
parent | 81526834b5c4f3c1672bcfc3759592798d68b72e (diff) | |
download | mariadb-git-db16cae578dd32ee2e66d8746444613c34b1e3e8.tar.gz |
BUG#13987 Cluster: Loss of data nodes can cause high CPU usage from ndb_mgmd
smaller patch for 5.0.
complete patch going to 5.1 due to more intrusiveness for 'list sessions' etc
ndb/include/mgmapi/mgmapi.h:
add internal get_fd to use in test
ndb/include/util/InputStream.hpp:
- add this weird startover member to SocketInputStream
- this helps work out if we've read a newline yet and should start inserting
into buffer from the start
ndb/src/common/util/InputStream.cpp:
remove evil, add more.
keep track internally we've retrieved a newline yet (m_startover)
ndb/src/common/util/Parser.cpp:
change way detecting of NoLine
remove some trailing whitespace that was uglying the place up a bit
ndb/src/common/util/socket_io.cpp:
Always retrieve data from the OS so that we instantly get EOF on disconnect
and don't end up spinning looking for a newline.
ndb/src/mgmapi/mgmapi.cpp:
add internal ndb_mgm_get_fd() for internal testing
handle 'node status' a bit better
ndb/test/ndbapi/testMgm.cpp:
Add test for MgmApiSession disconnection (mgmd at 100%)
not fully automated due to smaller patch for 5.0
will be complete in 5.1
Diffstat (limited to 'ndb/src/mgmapi')
-rw-r--r-- | ndb/src/mgmapi/mgmapi.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp index 9bf19dda3a4..12222f25eb8 100644 --- a/ndb/src/mgmapi/mgmapi.cpp +++ b/ndb/src/mgmapi/mgmapi.cpp @@ -503,6 +503,18 @@ ndb_mgm_connect(NdbMgmHandle handle, int no_retries, } /** + * Only used for low level testing + * Never to be used by end user. + * Or anybody who doesn't know exactly what they're doing. + */ +extern "C" +int +ndb_mgm_get_fd(NdbMgmHandle handle) +{ + return handle->socket; +} + +/** * Disconnect from a mgm server */ extern "C" @@ -692,22 +704,16 @@ ndb_mgm_get_status(NdbMgmHandle handle) SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY, "Probably disconnected"); return NULL; } - if(buf[strlen(buf)-1] == '\n') - buf[strlen(buf)-1] = '\0'; - - if(strcmp("node status", buf) != 0) { + if(strcmp("node status\n", buf) != 0) { SET_ERROR(handle, NDB_MGM_ILLEGAL_NODE_STATUS, buf); return NULL; } - if(!in.gets(buf, sizeof(buf))) { SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY, "Probably disconnected"); return NULL; } - if(buf[strlen(buf)-1] == '\n') - buf[strlen(buf)-1] = '\0'; - + BaseString tmp(buf); Vector<BaseString> split; tmp.split(split, ":"); @@ -715,7 +721,7 @@ ndb_mgm_get_status(NdbMgmHandle handle) SET_ERROR(handle, NDB_MGM_ILLEGAL_NODE_STATUS, buf); return NULL; } - + if(!(split[0].trim() == "nodes")){ SET_ERROR(handle, NDB_MGM_ILLEGAL_NODE_STATUS, buf); return NULL; @@ -2280,7 +2286,6 @@ ndb_mgm_check_connection(NdbMgmHandle handle){ 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; @@ -2490,7 +2495,6 @@ int ndb_mgm_end_session(NdbMgmHandle handle) SocketInputStream in(handle->socket, handle->read_timeout); char buf[32]; - in.gets(buf, sizeof(buf)); DBUG_RETURN(0); |