MXS-1507: Add initial implementation of transaction replay

Added the initial implementation of transaction replay. Transactions are
only replayed if the master fails when no statement is being executed.

The validity of the replayed transaction is done by verifying that the
checksums of the returned results are equal.

Added a close function into the Trx class to make resetting its state
easier. Also changed the return type of the pop_stmt to GWBUF* as the
places where it is used expect a raw GWBUF pointer.
This commit is contained in:
Markus Mäkelä
2018-04-19 15:36:14 +03:00
parent daecb6980b
commit 01bf5cc8b0
4 changed files with 102 additions and 32 deletions

View File

@ -138,6 +138,8 @@ public:
uint64_t m_retry_duration; /**< Total time spent retrying queries */
mxs::Buffer m_current_query; /**< Current query being executed */
Trx m_trx; /**< Current transaction */
bool m_is_replay_active; /**< Whether we are actively replaying a transaction */
Trx m_replayed_trx; /**< The transaction we are replaying */
private:
RWSplitSession(RWSplit* instance, MXS_SESSION* session,
@ -181,8 +183,8 @@ private:
void handle_error_reply_client(DCB *backend_dcb, GWBUF *errmsg);
bool handle_error_new_connection(DCB *backend_dcb, GWBUF *errmsg);
// Currently only for diagnostic purposes
void close_transaction();
void handle_trx_replay();
void start_trx_replay();
private:
// QueryClassifier::Handler