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:
@ -813,6 +813,11 @@ bool RWSplitSession::start_trx_replay()
|
|||||||
m_trx.close();
|
m_trx.close();
|
||||||
m_trx = m_orig_trx;
|
m_trx = m_orig_trx;
|
||||||
m_current_query.copy_from(m_orig_stmt);
|
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())
|
if (m_trx.have_stmts() || m_current_query.get())
|
||||||
|
|||||||
Reference in New Issue
Block a user