Fix to bug #541, http://bugs.skysql.com/show_bug.cgi?id=541
Long ~0.5MB queries blocked MaxScale. mysql_client.c:gw_read_client_event: Fixed packet reading logic. Reading didn't work when packet exceeded read buffer size. mysql_common.c:gw_MySQL_get_next_packet: number of bytes to be copied to continuous buffer was calculated wrong, thus resulting in broken packet. readwritesplit.c:disabled creation of canonical query in debug build because it slows down the processing too much with long queries
This commit is contained in:
@ -552,15 +552,17 @@ int gw_read_client_event(
|
||||
*/
|
||||
if (dcb->dcb_readqueue)
|
||||
{
|
||||
uint8_t* data = (uint8_t *)GWBUF_DATA(read_buffer);
|
||||
uint8_t* data;
|
||||
|
||||
read_buffer = gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
||||
nbytes_read = gwbuf_length(read_buffer);
|
||||
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
||||
nbytes_read = gwbuf_length(dcb->dcb_readqueue);
|
||||
data = (uint8_t *)GWBUF_DATA(dcb->dcb_readqueue);
|
||||
|
||||
if (nbytes_read < 3 || nbytes_read < MYSQL_GET_PACKET_LEN(data))
|
||||
{
|
||||
rc = 0;
|
||||
goto return_rc;
|
||||
size_t nread = MYSQL_GET_PACKET_LEN(data);
|
||||
rc = 0;
|
||||
goto return_rc;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -578,7 +580,8 @@ int gw_read_client_event(
|
||||
|
||||
if (nbytes_read < 3 || nbytes_read < MYSQL_GET_PACKET_LEN(data)+4)
|
||||
{
|
||||
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
||||
size_t nread = MYSQL_GET_PACKET_LEN(data);
|
||||
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
||||
rc = 0;
|
||||
goto return_rc;
|
||||
}
|
||||
@ -789,7 +792,7 @@ int gw_read_client_event(
|
||||
if (read_buffer != NULL)
|
||||
{
|
||||
/** add incomplete mysql packet to read queue */
|
||||
gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
||||
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1443,7 +1446,11 @@ static int route_by_statement(
|
||||
do
|
||||
{
|
||||
ss_dassert(GWBUF_IS_TYPE_MYSQL((*p_readbuf)));
|
||||
|
||||
|
||||
/**
|
||||
* Collect incoming bytes to a buffer until complete packet has
|
||||
* arrived and then return the buffer.
|
||||
*/
|
||||
packetbuf = gw_MySQL_get_next_packet(p_readbuf);
|
||||
|
||||
if (packetbuf != NULL)
|
||||
|
Reference in New Issue
Block a user