Fix handling of collected results

The result collection did not reset properly when a non-resultset was
returned for a request. As collected result need to be distinguishable
from single packet responses, a new buffer type was added.

The new buffer type is used by readwritesplit which uses result collection
for preparation of prepared statements.

Moved the current command tracking to the RWBackend class as the command
tracked by the protocol is can change before a response to the executed
command is received.

Removed a false debug assertion in the mxs_mysql_extract_ps_response
function that was triggered when a very large prepared statement response
was processed in multiple parts.
This commit is contained in:
Markus Mäkelä
2017-10-06 03:06:50 +03:00
committed by Johan Wikman
parent 948f66f918
commit a6eeed98fe
6 changed files with 50 additions and 35 deletions

View File

@ -758,14 +758,16 @@ gw_read_and_write(DCB *dcb)
if (collecting_resultset(proto, capabilities))
{
if (expecting_resultset(proto) &&
mxs_mysql_is_result_set(read_buffer))
if (expecting_resultset(proto))
{
bool more = false;
if (modutil_count_signal_packets(read_buffer, 0, &more, NULL) != 2)
if (mxs_mysql_is_result_set(read_buffer))
{
dcb_readq_prepend(dcb, read_buffer);
return 0;
bool more = false;
if (modutil_count_signal_packets(read_buffer, 0, &more, NULL) != 2)
{
dcb_readq_prepend(dcb, read_buffer);
return 0;
}
}
// Collected the complete result
@ -937,6 +939,12 @@ gw_read_and_write(DCB *dcb)
if (session_ok_to_route(dcb))
{
if (result_collected)
{
// Mark that this is a buffer containing a collected result
gwbuf_set_type(stmt, GWBUF_TYPE_RESULT);
}
session->service->router->clientReply(session->service->router_instance,
session->router_session,
stmt, dcb);