Fix to MXS-212: https://mariadb.atlassian.net/browse/MXS-212
The listener DCB is now properly closed instead of just being removed from the poll set.
This commit is contained in:
@ -1949,13 +1949,15 @@ dcb_close(DCB *dcb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ss_dassert(dcb->state == DCB_STATE_POLLING ||
|
ss_dassert(dcb->state == DCB_STATE_POLLING ||
|
||||||
|
dcb->state == DCB_STATE_LISTENING ||
|
||||||
dcb->state == DCB_STATE_NOPOLLING ||
|
dcb->state == DCB_STATE_NOPOLLING ||
|
||||||
dcb->state == DCB_STATE_ZOMBIE);
|
dcb->state == DCB_STATE_ZOMBIE);
|
||||||
|
|
||||||
/*<
|
/*<
|
||||||
* Stop dcb's listening and modify state accordingly.
|
* Stop dcb's listening and modify state accordingly.
|
||||||
*/
|
*/
|
||||||
if (dcb->state == DCB_STATE_POLLING)
|
if (dcb->state == DCB_STATE_POLLING ||
|
||||||
|
dcb->state == DCB_STATE_LISTENING)
|
||||||
{
|
{
|
||||||
rc = poll_remove_dcb(dcb);
|
rc = poll_remove_dcb(dcb);
|
||||||
|
|
||||||
@ -2428,6 +2430,10 @@ static bool dcb_set_state_nomutex(
|
|||||||
case DCB_STATE_POLLING: /*< ok to try but state can't change */
|
case DCB_STATE_POLLING: /*< ok to try but state can't change */
|
||||||
succp = true;
|
succp = true;
|
||||||
break;
|
break;
|
||||||
|
case DCB_STATE_LISTENING:
|
||||||
|
dcb->state = new_state;
|
||||||
|
succp = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
ss_dassert(old_state != NULL);
|
ss_dassert(old_state != NULL);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -330,7 +330,8 @@ poll_remove_dcb(DCB *dcb)
|
|||||||
CHK_DCB(dcb);
|
CHK_DCB(dcb);
|
||||||
|
|
||||||
/*< It is possible that dcb has already been removed from the set */
|
/*< It is possible that dcb has already been removed from the set */
|
||||||
if (dcb->state != DCB_STATE_POLLING)
|
if (dcb->state != DCB_STATE_POLLING &&
|
||||||
|
dcb->state != DCB_STATE_LISTENING)
|
||||||
{
|
{
|
||||||
if (dcb->state == DCB_STATE_NOPOLLING ||
|
if (dcb->state == DCB_STATE_NOPOLLING ||
|
||||||
dcb->state == DCB_STATE_ZOMBIE)
|
dcb->state == DCB_STATE_ZOMBIE)
|
||||||
|
|||||||
@ -534,11 +534,13 @@ int listeners = 0;
|
|||||||
port = service->ports;
|
port = service->ports;
|
||||||
while (port)
|
while (port)
|
||||||
{
|
{
|
||||||
poll_remove_dcb(port->listener);
|
if(port->listener)
|
||||||
port->listener->session->state = SESSION_STATE_LISTENER_STOPPED;
|
{
|
||||||
|
dcb_close(port->listener);
|
||||||
|
port->listener = NULL;
|
||||||
listeners++;
|
listeners++;
|
||||||
|
}
|
||||||
port = port->next;
|
port = port->next;
|
||||||
}
|
}
|
||||||
service->state = SERVICE_STATE_STOPPED;
|
service->state = SERVICE_STATE_STOPPED;
|
||||||
|
|
||||||
@ -562,13 +564,10 @@ int listeners = 0;
|
|||||||
port = service->ports;
|
port = service->ports;
|
||||||
while (port)
|
while (port)
|
||||||
{
|
{
|
||||||
if (poll_add_dcb(port->listener) == 0) {
|
listeners += serviceStartPort(service,port);
|
||||||
port->listener->session->state = SESSION_STATE_LISTENER;
|
port = port->next;
|
||||||
listeners++;
|
|
||||||
}
|
|
||||||
port = port->next;
|
|
||||||
}
|
}
|
||||||
|
service->state = SERVICE_STATE_STARTED;
|
||||||
return listeners;
|
return listeners;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1771,7 +1771,7 @@ gw_client_close(DCB *dcb)
|
|||||||
dcb->state == DCB_STATE_NOPOLLING ||
|
dcb->state == DCB_STATE_NOPOLLING ||
|
||||||
dcb->state == DCB_STATE_ZOMBIE)
|
dcb->state == DCB_STATE_ZOMBIE)
|
||||||
{
|
{
|
||||||
if (!DCB_IS_CLONE(dcb)) CHK_PROTOCOL(protocol);
|
if (!DCB_IS_CLONE(dcb) && protocol) CHK_PROTOCOL(protocol);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
LOGIF(LD, (skygw_log_write(LOGFILE_DEBUG,
|
LOGIF(LD, (skygw_log_write(LOGFILE_DEBUG,
|
||||||
|
|||||||
@ -128,7 +128,10 @@ void mysql_protocol_done (
|
|||||||
MySQLProtocol* p;
|
MySQLProtocol* p;
|
||||||
server_command_t* scmd;
|
server_command_t* scmd;
|
||||||
server_command_t* scmd2;
|
server_command_t* scmd2;
|
||||||
|
|
||||||
|
if(dcb->protocol == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
p = (MySQLProtocol *)dcb->protocol;
|
p = (MySQLProtocol *)dcb->protocol;
|
||||||
|
|
||||||
spinlock_acquire(&p->protocol_lock);
|
spinlock_acquire(&p->protocol_lock);
|
||||||
|
|||||||
Reference in New Issue
Block a user