MXS-1137: Do not cache when [user|system] vars are used
If user or system variables are used in a SELECT statement, then the result will not be cached. That ensures that the wrong result will not be returned.
This commit is contained in:
@ -707,14 +707,22 @@ bool CacheFilterSession::should_consult_cache(GWBUF* pPacket)
|
||||
|
||||
if (consult_cache)
|
||||
{
|
||||
// We do not care whether the query was fully parsed or not.
|
||||
// If a query cannot be fully parsed, the worst thing that can
|
||||
// happen is that caching is not used, even though it would be
|
||||
// possible.
|
||||
if (qc_get_operation(pPacket) != QUERY_OP_SELECT)
|
||||
if (qc_query_is_type(type_mask, QUERY_TYPE_USERVAR_READ) ||
|
||||
qc_query_is_type(type_mask, QUERY_TYPE_SYSVAR_READ))
|
||||
{
|
||||
consult_cache = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We do not care whether the query was fully parsed or not.
|
||||
// If a query cannot be fully parsed, the worst thing that can
|
||||
// happen is that caching is not used, even though it would be
|
||||
// possible.
|
||||
if (qc_get_operation(pPacket) != QUERY_OP_SELECT)
|
||||
{
|
||||
consult_cache = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return consult_cache;
|
||||
|
Reference in New Issue
Block a user