From 869effc3528796f973f3d88e664757c0a8f9f681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 3 Oct 2019 22:17:44 +0300 Subject: [PATCH] MXS-2707: Retain commands that respond Only commands that return a response should to be retained. Otherwise the bookkeeping of m_current_query will be wrong. --- server/modules/protocol/MySQL/mariadbclient/mysql_client.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc index 7b8ea6b30..b4ffc89d0 100644 --- a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc +++ b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc @@ -1735,7 +1735,6 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF { // TODO: Do this only when RCAP_TYPE_CONTIGUOUS_INPUT is requested packetbuf = gwbuf_make_contiguous(packetbuf); - session_retain_statement(session, packetbuf); MySQLProtocol* proto = (MySQLProtocol*)session->client_dcb->protocol; @@ -1745,6 +1744,11 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF if (!proto->changing_user && !session_is_load_active(session)) { update_current_command(session->client_dcb, packetbuf); + + if (mxs_mysql_command_will_respond(proto->current_command)) + { + session_retain_statement(session, packetbuf); + } } if (rcap_type_required(capabilities, RCAP_TYPE_CONTIGUOUS_INPUT))