Commit c2421d3f authored by unknown's avatar unknown

BUG#15215 mysqld fails at start-up because of illegal reply from mgmd

In the rare circumstance where a mysqld connects to a mgm server, then the
mgm server goes away before a node id can be allocated, it was possible to get
an Error in mgm protocol parser error message.


ndb/src/common/mgmcommon/ConfigRetriever.cpp:
  When allocating node id, retry connecting to a management server if it goes away.
ndb/src/mgmapi/mgmapi.cpp:
  Treat Eof and NoLine results from the parser as a sign that we should disconnect
  from this management server. It's up to the caller to work out if they want
  to try again.
parent 57ad6b20
...@@ -341,9 +341,15 @@ ConfigRetriever::allocNodeId(int no_retries, int retry_delay_in_seconds) ...@@ -341,9 +341,15 @@ ConfigRetriever::allocNodeId(int no_retries, int retry_delay_in_seconds)
{ {
while (1) while (1)
{ {
if(!ndb_mgm_is_connected(m_handle))
if(!ndb_mgm_connect(m_handle, 0, 0, 0))
goto next;
int res= ndb_mgm_alloc_nodeid(m_handle, m_version, m_node_type); int res= ndb_mgm_alloc_nodeid(m_handle, m_version, m_node_type);
if(res >= 0) if(res >= 0)
return _ownNodeId= (Uint32)res; return _ownNodeId= (Uint32)res;
next:
if (no_retries == 0) if (no_retries == 0)
break; break;
no_retries--; no_retries--;
......
...@@ -336,10 +336,16 @@ ndb_mgm_call(NdbMgmHandle handle, const ParserRow<ParserDummy> *command_reply, ...@@ -336,10 +336,16 @@ 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)) { if(!ndb_mgm_is_connected(handle)) {
return NULL; DBUG_RETURN(NULL);
} }
else else
{ {
if(ctx.m_status==Parser_t::Eof
|| ctx.m_status==Parser_t::NoLine)
{
ndb_mgm_disconnect(handle);
DBUG_RETURN(NULL);
}
/** /**
* Print some info about why the parser returns NULL * Print some info about why the parser returns NULL
*/ */
......
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