Store transaction type bit on transaction end

When the transaction ends, it's good to know what type of a transaction
just ended. Currently, this will be used by readwritesplit to detect when
a read-only transaction ends.
This commit is contained in:
Markus Mäkelä
2017-01-24 11:33:15 +02:00
parent 81be935fa9
commit c77bb502e9
3 changed files with 54 additions and 10 deletions

View File

@ -1520,7 +1520,14 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF
}
else if ((type & QUERY_TYPE_COMMIT) || (type & QUERY_TYPE_ROLLBACK))
{
session_set_trx_state(session, SESSION_TRX_ENDING);
mxs_session_trx_state_t trx_state = session_get_trx_state(session);
/** Remove the active transaction bit and set the end
* of transaction bit */
trx_state &= ~SESSION_TRX_ACTIVE_BIT;
trx_state |= SESSION_TRX_ENDING_BIT;
session_set_trx_state(session, trx_state);
if (type & QUERY_TYPE_ENABLE_AUTOCOMMIT)
{