MXS-2385 Fix the problem with the USE command and tpmfilter

Trying to get the type mask of the QWBUF caused debug assertion in the query
classifier when using some commands. Now type mask is checked only when the
buffer contains MXS_COM_QUERY command.
This commit is contained in:
Marko
2019-05-13 12:31:35 +03:00
parent 32c2724454
commit 17d3beba3b

View File

@ -62,6 +62,7 @@
#include <maxscale/server.hh>
#include <maxbase/atomic.h>
#include <maxscale/query_classifier.hh>
#include <maxscale/protocol/mysql.hh>
/* The maximum size for query statements in a transaction (64MB) */
static size_t sql_size_limit = 64 * 1024 * 1024;
@ -463,6 +464,11 @@ static int routeQuery(MXS_FILTER* instance, MXS_FILTER_SESSION* session, GWBUF*
if (my_session->active)
{
if ((ptr = modutil_get_SQL(queue)) != NULL)
{
uint8_t* data = (uint8_t*) GWBUF_DATA(queue);
uint8_t command = MYSQL_GET_COMMAND(data);
if (command == MXS_COM_QUERY)
{
uint32_t query_type = qc_get_type_mask(queue);
int query_len = strlen(ptr);
@ -538,6 +544,7 @@ static int routeQuery(MXS_FILTER* instance, MXS_FILTER_SESSION* session, GWBUF*
}
}
}
}
retblock: