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.
This commit is contained in:
Markus Makela
2016-04-04 22:01:14 +03:00
parent fb6b3e6702
commit a59bece943

View File

@ -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);