Commit 41a961d8 authored by sjaakola's avatar sjaakola Committed by Jan Lindström

MDEV-24327 wsrep XID checkpointing order violation with cert failures

Handling of write sets, which fail in certification happens differently than
with write sets which pass certification. When certification fails, the
write set applying can be skipped and applier needs only to take care of
wsrep XID checkpointing. With current implementation, this can rush ahead
of wsrep XID checkpointing of successful write sets.

The fix in this PR registers wsrep XID checkpointing of certification failure cases in group commit,
which guarantees that XID ceckpointing order is synchronized with real committing transactions.
Reviewed-by: default avatarJan Lindström <jan.lindstrom@mariadb.com>
parent 87fa6d2c
...@@ -358,7 +358,7 @@ void wsrep_register_for_group_commit(THD *thd) ...@@ -358,7 +358,7 @@ void wsrep_register_for_group_commit(THD *thd)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
DBUG_ASSERT(thd->wsrep_trx().state() == wsrep::transaction::s_committing); DBUG_ASSERT(thd->wsrep_trx().ordered());
wait_for_commit *wfc= thd->wait_for_commit_ptr= &thd->wsrep_wfc; wait_for_commit *wfc= thd->wait_for_commit_ptr= &thd->wsrep_wfc;
...@@ -381,7 +381,7 @@ void wsrep_register_for_group_commit(THD *thd) ...@@ -381,7 +381,7 @@ void wsrep_register_for_group_commit(THD *thd)
void wsrep_unregister_from_group_commit(THD *thd) void wsrep_unregister_from_group_commit(THD *thd)
{ {
DBUG_ASSERT(thd->wsrep_trx().state() == wsrep::transaction::s_ordered_commit); DBUG_ASSERT(thd->wsrep_trx().ordered());
wait_for_commit *wfc= thd->wait_for_commit_ptr; wait_for_commit *wfc= thd->wait_for_commit_ptr;
if (wfc) if (wfc)
......
...@@ -443,8 +443,24 @@ int Wsrep_high_priority_service::log_dummy_write_set(const wsrep::ws_handle& ws_ ...@@ -443,8 +443,24 @@ int Wsrep_high_priority_service::log_dummy_write_set(const wsrep::ws_handle& ws_
cs.before_rollback(); cs.before_rollback();
cs.after_rollback(); cs.after_rollback();
} }
if (!WSREP_EMULATE_BINLOG(m_thd))
{
wsrep_register_for_group_commit(m_thd);
ret = ret || cs.provider().commit_order_leave(ws_handle, ws_meta, err);
m_thd->wait_for_prior_commit();
}
wsrep_set_SE_checkpoint(ws_meta.gtid()); wsrep_set_SE_checkpoint(ws_meta.gtid());
if (!WSREP_EMULATE_BINLOG(m_thd))
{
wsrep_unregister_from_group_commit(m_thd);
}
else
{
ret= ret || cs.provider().commit_order_leave(ws_handle, ws_meta, err); ret= ret || cs.provider().commit_order_leave(ws_handle, ws_meta, err);
}
cs.after_applying(); cs.after_applying();
} }
DBUG_RETURN(ret); DBUG_RETURN(ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment