From d55c07dc2ef1364413a40f9a53eb2876612e21ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 21 Sep 2018 10:26:30 +0300 Subject: [PATCH] MXS-2066: Reset resultset collection by default The collection of resultsets needs to be disabled by default when a response is received to cover the cases where an error is returned. The collection of results should also not be set for queries that do not generate any responses. --- .../protocol/MySQL/mariadbbackend/mysql_backend.c | 14 +++++++------- .../routing/readwritesplit/rwsplit_route_stmt.cc | 6 +++++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c index 16df96206..448d1da71 100644 --- a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c @@ -836,14 +836,14 @@ gw_read_and_write(DCB *dcb) result_collected = true; } else if (expecting_ps_response(proto) && - mxs_mysql_is_prep_stmt_ok(read_buffer)) + mxs_mysql_is_prep_stmt_ok(read_buffer) && + !complete_ps_response(read_buffer)) + { + dcb_readq_prepend(dcb, read_buffer); + return 0; + } + else { - if (!complete_ps_response(read_buffer)) - { - dcb_readq_prepend(dcb, read_buffer); - return 0; - } - // Collected the complete result proto->collect_result = false; result_collected = true; diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index b8296790f..7eba4e858 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -344,7 +344,11 @@ bool route_session_write(RWSplitSession *rses, GWBUF *querybuf, bool expecting_response = mxs_mysql_command_will_respond(command); int nsucc = 0; uint64_t lowest_pos = id; - gwbuf_set_type(querybuf, GWBUF_TYPE_COLLECT_RESULT); + + if (expecting_response) + { + gwbuf_set_type(querybuf, GWBUF_TYPE_COLLECT_RESULT); + } if (qc_query_is_type(type, QUERY_TYPE_PREPARE_NAMED_STMT) || qc_query_is_type(type, QUERY_TYPE_PREPARE_STMT))