Only extract successful PS responses

If a prepared statement fails to execute on a backend server, no prepared
statement ID is returned. As the connection to the slave backend will be
closed when the result of a session command differs from the master's
response, there's no need to even attempt extracting the response.

This change avoids the triggering of a false positive in
mxs_mysql_extract_ps_response when an attempt to extract a
COM_STMT_PREPARE response is made on a response that isn't a
COM_STMT_PREPARE response.
This commit is contained in:
Markus Mäkelä 2017-09-24 11:31:56 +03:00
parent 9f31b746a0
commit 944a5bd9c1

View File

@ -40,7 +40,7 @@ void process_sescmd_response(RWSplitSession* rses, SRWBackend& backend,
uint64_t id = backend->complete_session_command();
MXS_PS_RESPONSE resp = {};
if (command == MXS_COM_STMT_PREPARE)
if (command == MXS_COM_STMT_PREPARE && cmd != MYSQL_REPLY_ERR)
{
// This should never fail or the backend protocol is broken
ss_debug(bool b = )mxs_mysql_extract_ps_response(*ppPacket, &resp);