Add result set buffering to MySQLBackend
The backend MySQL protocol module now supports a new routing capability which allows result sets to be gathered into one buffer before they are routed onward. This should not be used by modules that expect large result sets as the result set is buffered in memory. Adding a limit on how large of a result set could be buffered would allow relatively safe use of this routing capability without compromising the stability of the system.
This commit is contained in:
@ -787,6 +787,19 @@ gw_read_and_write(DCB *dcb)
|
||||
|
||||
read_buffer = tmp;
|
||||
|
||||
if (rcap_type_required(capabilities, RCAP_TYPE_RESULTSET_OUTPUT))
|
||||
{
|
||||
if (mxs_mysql_is_result_set(read_buffer))
|
||||
{
|
||||
int more = 0;
|
||||
if (modutil_count_signal_packets(read_buffer, 0, 0, &more) != 2)
|
||||
{
|
||||
dcb->dcb_readqueue = read_buffer;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rcap_type_required(capabilities, RCAP_TYPE_CONTIGUOUS_OUTPUT))
|
||||
{
|
||||
if ((tmp = gwbuf_make_contiguous(read_buffer)))
|
||||
@ -862,7 +875,8 @@ gw_read_and_write(DCB *dcb)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (rcap_type_required(capabilities, RCAP_TYPE_STMT_OUTPUT))
|
||||
else if (rcap_type_required(capabilities, RCAP_TYPE_STMT_OUTPUT) &&
|
||||
!rcap_type_required(capabilities, RCAP_TYPE_RESULTSET_OUTPUT))
|
||||
{
|
||||
stmt = modutil_get_next_MySQL_packet(&read_buffer);
|
||||
}
|
||||
|
Reference in New Issue
Block a user