Fix closing of pooled DCBs

DCBs can now have a null session pointer and if they do, they are in the
persistent pool. The no-null-session assertions are no longer valid but
with a reorganization of the pooling code to only use file descriptors,
the assertions can be added back.
This commit is contained in:
Markus Mäkelä 2018-12-28 12:41:18 +02:00
parent 4ab25bcd1c
commit 630165e52b
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -1367,7 +1367,7 @@ static int gw_backend_hangup(DCB* dcb)
*/
static int gw_backend_close(DCB* dcb)
{
mxb_assert(dcb->session);
mxb_assert(dcb->session || dcb->persistentstart);
/** Send COM_QUIT to the backend being closed */
GWBUF* quitbuf = mysql_create_com_quit(NULL, 0);
@ -1376,17 +1376,13 @@ static int gw_backend_close(DCB* dcb)
/** Free protocol data */
mysql_protocol_done(dcb);
MXS_SESSION* session = dcb->session;
/**
* If session state is SESSION_STATE_STOPPING, start closing client session.
* Otherwise only this backend connection is closed.
*/
if (session->client_dcb
&& session->state == SESSION_STATE_STOPPING
&& session->client_dcb->state == DCB_STATE_POLLING)
if (dcb->session && dcb->session->state == SESSION_STATE_STOPPING)
{
poll_fake_hangup_event(session->client_dcb);
poll_fake_hangup_event(dcb->session->client_dcb);
}
return 1;