MXS-2052: Log error on failed routing of session command

If no server receives the session command, an error is now logged.
This commit is contained in:
Markus Mäkelä
2018-09-15 23:15:05 +03:00
parent af2546a3bd
commit 97a4cdcd49

View File

@ -357,6 +357,7 @@ bool route_session_write(RWSplitSession *rses, GWBUF *querybuf,
} }
MXS_INFO("Session write, routing to all servers."); MXS_INFO("Session write, routing to all servers.");
bool attempted_write = false;
for (SRWBackendList::iterator it = rses->backends.begin(); for (SRWBackendList::iterator it = rses->backends.begin();
it != rses->backends.end(); it++) it != rses->backends.end(); it++)
@ -365,6 +366,7 @@ bool route_session_write(RWSplitSession *rses, GWBUF *querybuf,
if (backend->in_use()) if (backend->in_use())
{ {
attempted_write = true;
backend->append_session_command(sescmd); backend->append_session_command(sescmd);
uint64_t current_pos = backend->next_session_command()->get_position(); uint64_t current_pos = backend->next_session_command()->get_position();
@ -433,6 +435,11 @@ bool route_session_write(RWSplitSession *rses, GWBUF *querybuf,
rses->recv_sescmd++; rses->recv_sescmd++;
} }
} }
else
{
MXS_ERROR("Could not route session command: %s", attempted_write ? "Write to all backends failed" :
"All connections have failed");
}
return nsucc; return nsucc;
} }