Move fake events to a thread-specific queue
The fake poll events are now stored in thread specific queues. This removes the need for the poll event queue.
This commit is contained in:
@ -599,10 +599,8 @@ gw_read_backend_event(DCB *dcb)
|
||||
if (proto->protocol_auth_state == MXS_AUTH_STATE_COMPLETE)
|
||||
{
|
||||
/** Authentication completed successfully */
|
||||
spinlock_acquire(&dcb->authlock);
|
||||
GWBUF *localq = dcb->delayq;
|
||||
dcb->delayq = NULL;
|
||||
spinlock_release(&dcb->authlock);
|
||||
|
||||
if (localq)
|
||||
{
|
||||
@ -746,9 +744,9 @@ gw_read_and_write(DCB *dcb)
|
||||
{
|
||||
GWBUF *tmp = modutil_get_complete_packets(&read_buffer);
|
||||
/* Put any residue into the read queue */
|
||||
spinlock_acquire(&dcb->authlock);
|
||||
|
||||
dcb->dcb_readqueue = read_buffer;
|
||||
spinlock_release(&dcb->authlock);
|
||||
|
||||
if (tmp == NULL)
|
||||
{
|
||||
/** No complete packets */
|
||||
@ -1012,7 +1010,7 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
|
||||
|
||||
gwbuf_free(queue);
|
||||
rc = 0;
|
||||
spinlock_release(&dcb->authlock);
|
||||
|
||||
break;
|
||||
|
||||
case MXS_AUTH_STATE_COMPLETE:
|
||||
@ -1027,7 +1025,7 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
|
||||
dcb->fd,
|
||||
STRPROTOCOLSTATE(backend_protocol->protocol_auth_state));
|
||||
|
||||
spinlock_release(&dcb->authlock);
|
||||
|
||||
/**
|
||||
* Statement type is used in readwrite split router.
|
||||
* Command is *not* set for readconn router.
|
||||
@ -1082,7 +1080,7 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
|
||||
* connected with auth ok
|
||||
*/
|
||||
backend_set_delayqueue(dcb, queue);
|
||||
spinlock_release(&dcb->authlock);
|
||||
|
||||
rc = 1;
|
||||
}
|
||||
break;
|
||||
@ -1807,9 +1805,9 @@ static GWBUF* process_response_data(DCB* dcb,
|
||||
|
||||
/** Store the already read data into the readqueue of the DCB
|
||||
* and restore the response status to the initial number of packets */
|
||||
spinlock_acquire(&dcb->authlock);
|
||||
|
||||
dcb->dcb_readqueue = gwbuf_append(outbuf, dcb->dcb_readqueue);
|
||||
spinlock_release(&dcb->authlock);
|
||||
|
||||
protocol_set_response_status(p, initial_packets, initial_bytes);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -433,19 +433,19 @@ int gw_read_client_event(DCB* dcb)
|
||||
* will be changed to MYSQL_IDLE (see below).
|
||||
*
|
||||
*/
|
||||
case MXS_AUTH_STATE_MESSAGE_READ:
|
||||
/* After this call read_buffer will point to freed data */
|
||||
if (nbytes_read < 3 || (0 == max_bytes && nbytes_read <
|
||||
(MYSQL_GET_PACKET_LEN((uint8_t *) GWBUF_DATA(read_buffer)) + 4)) ||
|
||||
(0 != max_bytes && nbytes_read < max_bytes))
|
||||
{
|
||||
spinlock_acquire(&dcb->authlock);
|
||||
dcb->dcb_readqueue = read_buffer;
|
||||
spinlock_release(&dcb->authlock);
|
||||
return 0;
|
||||
}
|
||||
return_code = gw_read_do_authentication(dcb, read_buffer, nbytes_read);
|
||||
break;
|
||||
case MXS_AUTH_STATE_MESSAGE_READ:
|
||||
/* After this call read_buffer will point to freed data */
|
||||
if (nbytes_read < 3 || (0 == max_bytes && nbytes_read <
|
||||
(MYSQL_GET_PACKET_LEN((uint8_t *) GWBUF_DATA(read_buffer)) + 4)) ||
|
||||
(0 != max_bytes && nbytes_read < max_bytes))
|
||||
{
|
||||
|
||||
dcb->dcb_readqueue = read_buffer;
|
||||
|
||||
return 0;
|
||||
}
|
||||
return_code = gw_read_do_authentication(dcb, read_buffer, nbytes_read);
|
||||
break;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -861,9 +861,9 @@ gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read)
|
||||
if (nbytes_read < 3 || nbytes_read <
|
||||
(MYSQL_GET_PACKET_LEN((uint8_t *) GWBUF_DATA(read_buffer)) + 4))
|
||||
{
|
||||
spinlock_acquire(&dcb->authlock);
|
||||
|
||||
dcb->dcb_readqueue = read_buffer;
|
||||
spinlock_release(&dcb->authlock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
gwbuf_set_type(read_buffer, GWBUF_TYPE_MYSQL);
|
||||
@ -904,9 +904,9 @@ gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint64_t capabilities)
|
||||
{
|
||||
/* Must have been data left over */
|
||||
/* Add incomplete mysql packet to read queue */
|
||||
spinlock_acquire(&dcb->authlock);
|
||||
|
||||
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
||||
spinlock_release(&dcb->authlock);
|
||||
|
||||
}
|
||||
}
|
||||
else if (NULL != session->router_session || (rcap_type_required(capabilities, RCAP_TYPE_NO_RSESSION)))
|
||||
|
@ -1039,9 +1039,9 @@ bool read_complete_packet(DCB *dcb, GWBUF **readbuf)
|
||||
if (localbuf)
|
||||
{
|
||||
/** Store any extra data in the DCB's readqueue */
|
||||
spinlock_acquire(&dcb->authlock);
|
||||
|
||||
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, localbuf);
|
||||
spinlock_release(&dcb->authlock);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1061,7 +1061,6 @@ bool gw_get_shared_session_auth_info(DCB* dcb, MYSQL_session* session)
|
||||
CHK_DCB(dcb);
|
||||
CHK_SESSION(dcb->session);
|
||||
|
||||
spinlock_acquire(&dcb->session->ses_lock);
|
||||
|
||||
if (dcb->session->state != SESSION_STATE_ALLOC &&
|
||||
dcb->session->state != SESSION_STATE_DUMMY)
|
||||
@ -1076,7 +1075,7 @@ bool gw_get_shared_session_auth_info(DCB* dcb, MYSQL_session* session)
|
||||
pthread_self(), dcb->session->state);
|
||||
rval = false;
|
||||
}
|
||||
spinlock_release(&dcb->session->ses_lock);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user