MXS-1677: Don't assume all queries are in text form

After a temporary table is created, readwritesplit will check whether a
query drops or targets that temporary table. The check for query type was
missing from the table dropping part of the code. The temporary table read
part was checking that the query is a text form query.

Added a debug assertion to the query parsing function in qc_sqlite to
catch this type of interface misuse.
This commit is contained in:
Johan Wikman 2018-02-24 17:02:51 +02:00
parent 351f574e01
commit 9b36ba5e0a
2 changed files with 3 additions and 2 deletions

View File

@ -3544,6 +3544,7 @@ static bool parse_query(GWBUF* query, uint32_t collect)
{
MXS_ERROR("The provided buffer does not contain a COM_QUERY, but a %s.",
STRPACKETTYPE(MYSQL_GET_COMMAND(data)));
ss_dassert(!true);
}
}
else

View File

@ -834,10 +834,10 @@ handle_multi_temp_and_load(RWSplitSession *rses, GWBUF *querybuf,
/**
* Check if the query has anything to do with temporary tables.
*/
if (rses->have_tmp_tables)
if (rses->have_tmp_tables && is_packet_a_query(packet_type))
{
check_drop_tmp_table(rses, querybuf);
if (is_packet_a_query(packet_type) && is_read_tmp_table(rses, querybuf, *qtype))
if (is_read_tmp_table(rses, querybuf, *qtype))
{
*qtype |= QUERY_TYPE_MASTER_READ;
}