MXS-1810: Create Trx class

The class encapsulates the relevant information of a transaction.
This commit is contained in:
Markus Mäkelä
2018-04-19 11:31:56 +03:00
parent 94038933d8
commit 050af8fb52
4 changed files with 126 additions and 24 deletions

View File

@ -14,13 +14,12 @@
#include "readwritesplit.hh"
#include "rwbackend.hh"
#include "trx.hh"
#include <string>
#include <deque>
#include <maxscale/buffer.hh>
#include <maxscale/modutil.h>
#include <maxscale/utils.hh>
#include <maxscale/queryclassifier.hh>
#define TARGET_IS_MASTER(t) maxscale::QueryClassifier::target_is_master(t)
@ -40,9 +39,6 @@ typedef std::list< std::pair<mxs::SRWBackend, uint8_t> > SlaveResponseList;
/** Map of COM_STMT_EXECUTE targets by internal ID */
typedef std::tr1::unordered_map<uint32_t, mxs::SRWBackend> ExecMap;
// A log of executed queries, for transaction replay
typedef std::deque<mxs::Buffer> TrxLog;
/**
* The client session of a RWSplit instance
*/
@ -141,8 +137,7 @@ public:
mxs::QueryClassifier m_qc; /**< The query classifier. */
uint64_t m_retry_duration; /**< Total time spent retrying queries */
mxs::Buffer m_current_query; /**< Current query being executed */
mxs::SHA1Checksum m_trx_checksum; /**< Transaction checksum */
TrxLog m_trx_log; /**< Log of executed queries in the current transaction */
Trx m_trx; /**< Current transaction */
private:
RWSplitSession(RWSplit* instance, MXS_SESSION* session,