Discard connections on interrupted COM_CHANGE_USER

Close the connection if a COM_QUIT is received while the COM_CHANGE_USER
is in progress.
This commit is contained in:
Markus Mäkelä
2017-09-20 10:19:51 +03:00
parent b2d53a963a
commit eb3a9667fc

View File

@ -1027,12 +1027,11 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
if (MYSQL_IS_COM_QUIT((uint8_t*)GWBUF_DATA(queue))) if (MYSQL_IS_COM_QUIT((uint8_t*)GWBUF_DATA(queue)))
{ {
/** The COM_CHANGE_USER was already sent but the session is already /** The COM_CHANGE_USER was already sent but the session is already
* closing. We ignore the COM_QUIT in the hopes that the response * closing. */
* to the COM_CHANGE_USER comes before the DCB is closed. If the MXS_INFO("COM_QUIT received while COM_CHANGE_USER is in progress, closing pooled connection");
* DCB is closed before the response arrives, the connection will
* not qualify the persistent connection pool. */
MXS_INFO("COM_QUIT received while COM_CHANGE_USER is in progress, ignoring");
gwbuf_free(queue); gwbuf_free(queue);
poll_fake_hangup_event(dcb);
rc = 0;
} }
else else
{ {
@ -1044,8 +1043,9 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
*/ */
MXS_INFO("COM_CHANGE_USER in progress, appending query to queue"); MXS_INFO("COM_CHANGE_USER in progress, appending query to queue");
backend_protocol->stored_query = gwbuf_append(backend_protocol->stored_query, queue); backend_protocol->stored_query = gwbuf_append(backend_protocol->stored_query, queue);
rc = 1;
} }
return 1; return rc;
} }
/** /**