From b537176248af5897e383f42485d29f6a8212ebe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 13 Mar 2019 15:44:02 +0200 Subject: [PATCH] Fix parsing of non-query packets Packets that do not contain SQL should not be parsed. --- server/modules/routing/readwritesplit/rwsplitsession.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/modules/routing/readwritesplit/rwsplitsession.cc b/server/modules/routing/readwritesplit/rwsplitsession.cc index c0627f75c..8cb24701b 100644 --- a/server/modules/routing/readwritesplit/rwsplitsession.cc +++ b/server/modules/routing/readwritesplit/rwsplitsession.cc @@ -241,14 +241,17 @@ bool RWSplitSession::route_stored_query() GWBUF* temp_storage = m_query_queue; m_query_queue = NULL; - // The query needs to be explicitly parsed as it was processed multiple times - qc_parse(query_queue, QC_COLLECT_ALL); - // TODO: Move the handling of queued queries to the client protocol // TODO: module where the command tracking is done automatically. uint8_t cmd = mxs_mysql_get_command(query_queue); mysql_protocol_set_current_command(m_client, (mxs_mysql_cmd_t)cmd); + if (cmd == MXS_COM_QUERY || cmd == MXS_COM_STMT_PREPARE) + { + // The query needs to be explicitly parsed as it was processed multiple times + qc_parse(query_queue, QC_COLLECT_ALL); + } + if (!routeQuery(query_queue)) { rval = false;