From a59bece94336341d3ee0baa378b6d82609d6d69a Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Mon, 4 Apr 2016 22:01:14 +0300 Subject: [PATCH] MXS-661: Only COM_QUERY packets are parsed Parsing on non-COM_QUERY packets caused errors in the parsing of the queries. Only valid packets should be parsed. --- server/modules/routing/schemarouter/schemarouter.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/modules/routing/schemarouter/schemarouter.c b/server/modules/routing/schemarouter/schemarouter.c index 12493c733..5830d9c97 100644 --- a/server/modules/routing/schemarouter/schemarouter.c +++ b/server/modules/routing/schemarouter/schemarouter.c @@ -1956,6 +1956,8 @@ static int routeQuery(ROUTER* instance, goto retblock; } + qc_query_op_t op = QUERY_OP_UNDEFINED; + switch(packet_type) { case MYSQL_COM_QUIT: /*< 1 QUIT will close all sessions */ @@ -1977,6 +1979,7 @@ static int routeQuery(ROUTER* instance, case MYSQL_COM_QUERY: qtype = qc_get_type(querybuf); + op = qc_get_operation(querybuf); break; case MYSQL_COM_STMT_PREPARE: @@ -2028,8 +2031,6 @@ static int routeQuery(ROUTER* instance, * all of them. */ - qc_query_op_t op = qc_get_operation(querybuf); - if (packet_type == MYSQL_COM_INIT_DB || op == QUERY_OP_CHANGE_DB) { spinlock_acquire(&router_cli_ses->shardmap->lock);