From dd05b44d3888e80fafa5dc4ee5f9baa6773ba617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 28 Jun 2017 21:57:57 +0300 Subject: [PATCH] Always extract the current command from the buffer As readwritesplit queues queries, it needs to extract the command from the buffer when the queued queries are routed. It cannot rely on the client protocol command when the rerouting is taking place. --- server/modules/routing/readwritesplit/rwsplit_route_stmt.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index dface30fd..ae6f089e5 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -1059,7 +1059,7 @@ bool handle_master_is_target(RWSplit *inst, RWSplitSession *rses, return succp; } -static inline bool query_creates_reply(mysql_server_cmd_t cmd) +static inline bool query_creates_reply(uint8_t cmd) { return cmd != MYSQL_COM_QUIT && cmd != MYSQL_COM_STMT_SEND_LONG_DATA && @@ -1094,7 +1094,7 @@ bool handle_got_target(RWSplit *inst, RWSplitSession *rses, ss_dassert(target->session_command_count() == 0); mxs::Backend::response_type response = mxs::Backend::NO_RESPONSE; - mysql_server_cmd_t cmd = mxs_mysql_current_command(rses->client_dcb->session); + uint8_t cmd = mxs_mysql_get_command(querybuf); if (rses->load_data_state != LOAD_DATA_ACTIVE && query_creates_reply(cmd))