From 30f92ebb4bca037133bf4cdb2048cba2af3e3897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 22 Sep 2017 09:39:17 +0300 Subject: [PATCH] Only pre-process the current statement If a statement is about to be queued, there's no need to fully parse it when it will be done again once the current command being executed finishes. --- server/modules/routing/readwritesplit/readwritesplit.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/modules/routing/readwritesplit/readwritesplit.cc b/server/modules/routing/readwritesplit/readwritesplit.cc index 85e37e63a..41e08b235 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.cc +++ b/server/modules/routing/readwritesplit/readwritesplit.cc @@ -889,15 +889,15 @@ static int routeQuery(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, } else { - /** Gather the information required to make routing decisions */ - RouteInfo info(rses, querybuf); - if (rses->query_queue == NULL && (rses->expected_responses == 0 || - info.command == MXS_COM_STMT_FETCH || + mxs_mysql_get_command(querybuf) == MXS_COM_STMT_FETCH || rses->load_data_state == LOAD_DATA_ACTIVE || rses->large_query)) { + /** Gather the information required to make routing decisions */ + RouteInfo info(rses, querybuf); + /** No active or pending queries */ if (route_single_stmt(inst, rses, querybuf, info)) {