Commit c5038819 authored by unknown's avatar unknown

BUG#10950 Occational 'Error in mgm protocol parser' error on mysqld startup

Display the (more commonly accurate) message that the mgm server closed our connection
and that we'll retry connecting to it.


ndb/src/common/transporter/TransporterRegistry.cpp:
  Fix error message in case of mgm disconnecting before we finished asking it for dynamic ports
ndb/src/mgmapi/mgmapi.cpp:
  Only display a mgm protocol error in the case of the mgm server having disconnected.
  
  Change ndb_mgm_is_connected to actually poll the socket to see if it's still open.
parent fd34694d
...@@ -1284,11 +1284,17 @@ TransporterRegistry::start_clients_thread() ...@@ -1284,11 +1284,17 @@ TransporterRegistry::start_clients_thread()
if (server_port) if (server_port)
t->set_s_port(server_port); t->set_s_port(server_port);
} }
else else if(ndb_mgm_is_connected(m_mgm_handle))
{ {
ndbout_c("Failed to get dynamic port to connect to: %d", res); ndbout_c("Failed to get dynamic port to connect to: %d", res);
ndb_mgm_disconnect(m_mgm_handle); ndb_mgm_disconnect(m_mgm_handle);
} }
else
{
ndbout_c("Management server closed connection early. "
"It is probably being shut down (or has crashed). "
"We will retry the connection.");
}
} }
/** else /** else
* We will not be able to get a new port unless * We will not be able to get a new port unless
......
...@@ -323,16 +323,22 @@ ndb_mgm_call(NdbMgmHandle handle, const ParserRow<ParserDummy> *command_reply, ...@@ -323,16 +323,22 @@ ndb_mgm_call(NdbMgmHandle handle, const ParserRow<ParserDummy> *command_reply,
const Properties* p = parser.parse(ctx, session); const Properties* p = parser.parse(ctx, session);
if (p == NULL){ if (p == NULL){
/** if(!ndb_mgm_is_connected(handle)) {
* Print some info about why the parser returns NULL return NULL;
*/ }
ndbout << "Error in mgm protocol parser. " else
<< "cmd: '" << cmd {
<< "' status=" << (Uint32)ctx.m_status /**
<< ", curr=" << ctx.m_currentToken * Print some info about why the parser returns NULL
*/
ndbout << "Error in mgm protocol parser. "
<< "cmd: '" << cmd
<< "' status=" << (Uint32)ctx.m_status
<< ", curr=" << ctx.m_currentToken
<< endl; << endl;
DBUG_PRINT("info",("parser.parse returned NULL")); DBUG_PRINT("info",("parser.parse returned NULL"));
} }
}
#ifdef MGMAPI_LOG #ifdef MGMAPI_LOG
else { else {
/** /**
...@@ -350,8 +356,24 @@ ndb_mgm_call(NdbMgmHandle handle, const ParserRow<ParserDummy> *command_reply, ...@@ -350,8 +356,24 @@ ndb_mgm_call(NdbMgmHandle handle, const ParserRow<ParserDummy> *command_reply,
extern "C" extern "C"
int ndb_mgm_is_connected(NdbMgmHandle handle) int ndb_mgm_is_connected(NdbMgmHandle handle)
{ {
struct pollfd pfd[1];
int r;
if(!handle) if(!handle)
return 0; return 0;
if(handle->connected)
{
pfd[0].fd= handle->socket;
pfd[0].events= POLLHUP | POLLIN | POLLOUT | POLLNVAL;
pfd[0].revents= 0;
r= poll(pfd,1,0);
if(pfd[0].revents & POLLHUP)
{
handle->connected= 0;
NDB_CLOSE_SOCKET(handle->socket);
}
}
return handle->connected; return handle->connected;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment