Simplify logic for when deciding whether to cache

The autocommit state is now included in the result returned
from session_trx_is_active(), so it need not be checked separately.

This is preparatory work for MXS-1136 that will change the approach
so that the cache is used and populated in a non readonly transaction
*until* the first non-read statement is encountered.
This commit is contained in:
Johan Wikman
2017-02-28 13:30:16 +02:00
parent 7bcb60aaa6
commit 7bf7b1a47a

View File

@ -138,8 +138,7 @@ int CacheFilterSession::routeQuery(GWBUF* pPacket)
{
MXS_SESSION *session = m_pSession;
if ((session_is_autocommit(session) && !session_trx_is_active(session)) ||
session_trx_is_read_only(session))
if (!session_trx_is_active(session) || session_trx_is_read_only(session))
{
if (m_pCache->should_store(m_zDefaultDb, pPacket))
{