MXS-1810: Add transaction checksums
Readwritesplit now calculates checksums for all successful and failed transactions. This checksum is not of any practical use until the transaction replaying is implemented.
This commit is contained in:
@ -399,6 +399,16 @@ void RWSplitSession::clientReply(GWBUF *writebuf, DCB *backend_dcb)
|
||||
|
||||
m_current_query.reset();
|
||||
|
||||
if (session_trx_is_ending(m_client->session))
|
||||
{
|
||||
m_trx_checksum.finalize(writebuf);
|
||||
MXS_INFO("Transaction checksum: %s", m_trx_checksum.hex().c_str());
|
||||
}
|
||||
else if (session_trx_is_active(m_client->session))
|
||||
{
|
||||
m_trx_checksum.update(writebuf);
|
||||
}
|
||||
|
||||
if (backend->reply_is_complete(writebuf))
|
||||
{
|
||||
/** Got a complete reply, acknowledge the write and decrement expected response count */
|
||||
@ -548,6 +558,8 @@ void RWSplitSession::handleError(GWBUF *errmsgbuf, DCB *problem_dcb,
|
||||
if (session_trx_is_active(session))
|
||||
{
|
||||
// We have an open transaction, we can't continue
|
||||
m_trx_checksum.finalize();
|
||||
MXS_INFO("Checksum of failed transaction: %s", m_trx_checksum.hex().c_str());
|
||||
can_continue = false;
|
||||
}
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
|
||||
#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)
|
||||
@ -136,6 +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 */
|
||||
|
||||
private:
|
||||
RWSplitSession(RWSplit* instance, MXS_SESSION* session,
|
||||
|
||||
Reference in New Issue
Block a user