MXS-3915: Never cache autocommit queries

As both `SET autocommit=1` and `SET autocommit=0` share the same canonical
query form but do not have the same types, they should not be stored in
the cache.
This commit is contained in:
Markus Mäkelä 2021-12-14 13:59:58 +02:00
parent e9da486c95
commit 01dbcd8372
No known key found for this signature in database
GPG Key ID: 5CE746D557ACC499

View File

@ -399,7 +399,7 @@ public:
~QCInfoCacheScope()
{
if (!m_canonical.empty())
if (store_in_cache())
{
void* pData = gwbuf_get_buffer_object_data(m_pStmt, GWBUF_PARSING_INFO);
mxb_assert(pData);
@ -412,6 +412,12 @@ public:
private:
GWBUF* m_pStmt;
std::string m_canonical;
bool store_in_cache() const
{
constexpr const int is_autocommit = QUERY_TYPE_ENABLE_AUTOCOMMIT | QUERY_TYPE_DISABLE_AUTOCOMMIT;
return !m_canonical.empty() && (qc_get_type_mask(m_pStmt) & is_autocommit) == 0;
}
};
}