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:
@ -399,7 +399,7 @@ public:
|
|||||||
|
|
||||||
~QCInfoCacheScope()
|
~QCInfoCacheScope()
|
||||||
{
|
{
|
||||||
if (!m_canonical.empty())
|
if (store_in_cache())
|
||||||
{
|
{
|
||||||
void* pData = gwbuf_get_buffer_object_data(m_pStmt, GWBUF_PARSING_INFO);
|
void* pData = gwbuf_get_buffer_object_data(m_pStmt, GWBUF_PARSING_INFO);
|
||||||
mxb_assert(pData);
|
mxb_assert(pData);
|
||||||
@ -412,6 +412,12 @@ public:
|
|||||||
private:
|
private:
|
||||||
GWBUF* m_pStmt;
|
GWBUF* m_pStmt;
|
||||||
std::string m_canonical;
|
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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user