Fix crash on trx replay with session command
Readwritesplit would crash with the following transaction: BEGIN; SET @a = 1; -- This is where it would crash COMMIT; When a session command was a part of the transaction, empty queries (i.e. NULL GWBUFs) would be added to the transaction. If the transaction were to be replayed, MaxScale would crash when these NULL queries were executed. Once the empty responses were fixed, the replaying of the transaction would fail with a checksum mismatch. This was caused by the wrong order of processing in RWSplitSession::clientReply. The response processing for session commands was done after the response processing for replayed transactions. This would trigger a checksum comparison too early for the transaction in question.
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
|
||||
#include <maxscale/buffer.hh>
|
||||
#include <maxscale/utils.hh>
|
||||
#include <maxscale/modutil.hh>
|
||||
|
||||
// A transaction
|
||||
class Trx
|
||||
@ -38,6 +39,13 @@ public:
|
||||
*/
|
||||
void add_stmt(GWBUF* buf)
|
||||
{
|
||||
ss_info_dassert(buf, "Trx::add_stmt: Buffer must not be empty");
|
||||
|
||||
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
||||
{
|
||||
MXS_INFO("Adding to trx: %s", mxs::extract_sql(buf, 512).c_str());
|
||||
}
|
||||
|
||||
m_size += gwbuf_length(buf);
|
||||
m_log.emplace_back(buf);
|
||||
}
|
||||
@ -123,6 +131,7 @@ public:
|
||||
*/
|
||||
void close()
|
||||
{
|
||||
MXS_INFO("Transaction is complete");
|
||||
m_checksum.reset();
|
||||
m_log.clear();
|
||||
m_size = 0;
|
||||
|
Reference in New Issue
Block a user