MXS-1549: Implement optimistic transaction execution

When the `optimistic_trx` mode is enabled, all transactions are started on
a slave server. If the client executes a query inside the transaction that
is not of a read-only nature, the transaction is rolled back and replayed
on the master.
This commit is contained in:
Markus Mäkelä
2018-06-24 19:46:26 +03:00
parent 391618d53b
commit 12398bfc26
4 changed files with 140 additions and 3 deletions

View File

@ -218,6 +218,16 @@ public:
return m_trx_is_read_only;
}
/**
* Check if current transaction is still a read-only transaction
*
* @return True if no statements have been executed that modify data
*/
bool is_trx_starting() const
{
return qc_query_is_type(m_route_info.type_mask(), QUERY_TYPE_BEGIN_TRX);
}
/**
* @brief Store and process a prepared statement
*