Make COMMIT/ROLLBACK a part of the transaction

The transaction tracking now flags the transaction as open even when a
COMMIT/ROLLBACK is received. The next statement after the transaction is
closed resets the transaction state to inactive. This means that the end
of the transaction belongs in the transaction.

This allows all statements that belong to a transaction to be detected
with the transaction tracking functions provided by the core. With this,
the routing modules should have an easier time handling transactions.
This commit is contained in:
Markus Mäkelä
2017-01-24 14:28:09 +02:00
parent c77bb502e9
commit 99f6d4678d
2 changed files with 4 additions and 41 deletions

View File

@ -1521,12 +1521,7 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF
else if ((type & QUERY_TYPE_COMMIT) || (type & QUERY_TYPE_ROLLBACK))
{
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)