From 710e5df27ba5412db6912dc3309d239c0bda9e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 5 Mar 2019 18:09:01 +0200 Subject: [PATCH] MXS-2365: Fix classification of queued queries Queries in the query queue need to be explicitly parsed since they are stored in a single buffer and thus share the query classification information. In the next major version this should be changed into an array of individual buffers instead of a shared buffer. --- server/modules/routing/readwritesplit/rwsplitsession.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/modules/routing/readwritesplit/rwsplitsession.cc b/server/modules/routing/readwritesplit/rwsplitsession.cc index 76d53d293..c0627f75c 100644 --- a/server/modules/routing/readwritesplit/rwsplitsession.cc +++ b/server/modules/routing/readwritesplit/rwsplitsession.cc @@ -223,7 +223,7 @@ bool RWSplitSession::route_stored_query() * to wait for a response before attempting another reroute */ while (m_query_queue) { - MXS_INFO("Routing stored queries"); + MXS_INFO(">>> Routing stored queries"); GWBUF* query_queue = modutil_get_next_MySQL_packet(&m_query_queue); query_queue = gwbuf_make_contiguous(query_queue); mxb_assert(query_queue); @@ -241,6 +241,9 @@ 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); @@ -252,6 +255,8 @@ bool RWSplitSession::route_stored_query() MXS_ERROR("Failed to route queued query."); } + MXS_INFO("<<< Stored queries routed"); + if (m_query_queue == NULL) { /** Query successfully routed and no responses are expected */