Prevent checksum mismatch on second trx replay

If a transaction replay has to be executed twice due to a failure of the
original candidate master, the query queue could contain replayed
queries. The replayed queries would be placed into the queue if a new
connection needs to be created before the transaction replay can start.
This commit is contained in:
Markus Mäkelä 2019-04-04 17:20:04 +03:00
parent 6421af1bb4
commit ec890b33cd
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -813,6 +813,11 @@ bool RWSplitSession::start_trx_replay()
m_trx.close();
m_trx = m_orig_trx;
m_current_query.copy_from(m_orig_stmt);
// Erase all replayed queries from the query queue to prevent checksum mismatches
m_query_queue.erase(std::remove_if(m_query_queue.begin(), m_query_queue.end(), [](mxs::Buffer b) {
return GWBUF_IS_REPLAYED(b.get());
}), m_query_queue.end());
}
if (m_trx.have_stmts() || m_current_query.get())