MXS-1825: Fix PS output parameter tracking for MySQL variants

The resultset processing for MySQL requires some extra work as it lacks
the proper SERVER_MORE_RESULTS_EXIST flag in the last EOF packet. Instead,
the first EOF packet has the SERVER_PS_OUT_PARAMS flag which needs to be
interpreted as a SERVER_MORE_RESULTS_EXIST flag for the second EOF packet.

Also corrected the EOF packet handling to do the flag checks in the code
that deals with the EOF packets.

As the modutil_state parameter is now used for more than large packet
tracking, the correct solution is to store this state object in the
readwritesplit session instead of interpreting it to a boolean value.
This commit is contained in:
Markus Mäkelä
2018-04-26 09:22:17 +03:00
parent 260fcf85ec
commit c97d2c94eb
4 changed files with 43 additions and 24 deletions

View File

@ -523,9 +523,9 @@ bool reply_is_complete(SRWBackend& backend, GWBUF *buffer)
if (backend->current_command() == MXS_COM_STMT_FETCH)
{
bool more = false;
modutil_state state = {backend->is_large_packet()};
modutil_state state = backend->get_modutil_state();
int n_eof = modutil_count_signal_packets(buffer, 0, &more, &state);
backend->set_large_packet(state.state);
backend->set_modutil_state(state);
// If the server responded with an error, n_eof > 0
if (n_eof > 0 || backend->consume_fetched_rows(buffer))
@ -569,10 +569,10 @@ bool reply_is_complete(SRWBackend& backend, GWBUF *buffer)
else
{
bool more = false;
modutil_state state = {backend->is_large_packet()};
modutil_state state = backend->get_modutil_state();
int n_old_eof = backend->get_reply_state() == REPLY_STATE_RSET_ROWS ? 1 : 0;
int n_eof = modutil_count_signal_packets(buffer, n_old_eof, &more, &state);
backend->set_large_packet(state.state);
backend->set_modutil_state(state);
if (n_eof > 2)
{