1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-30 07:23:07 +03:00

Cache rollback events that failed to replicate for later retry

This patch introduces a queue to store ids of transactions that failed
to send a rollback fragment in streaming_rollback(). This is to avoid
potentially  missed rollback fragments when a cluster splits and then
later reforms. Rollback fragments would be missing if a node rolled
back a transaction locally (either BFed or voluntary rollback) while
non-primary, and the attempt to send rollback fragment failed in
transaction::streaming_rollback().
Transaction that fail to send rollback fragment can proceed to
rollback locally.  However we must ensure that rollback fragments for
those transactions are eventually delivered by the cluster. This must
be done before a potentially conflicting writeset causes BF-BF
conflicts in the rest of the cluster.
This commit is contained in:
Daniele Sciascia
2021-09-24 10:45:34 +02:00
parent efb4aab090
commit 22921e7082
7 changed files with 443 additions and 28 deletions

View File

@ -51,6 +51,7 @@ int wsrep::mock_high_priority_service::apply_write_set(
{
assert(client_state_->toi_meta().seqno().is_undefined());
assert(client_state_->transaction().state() == wsrep::transaction::s_executing ||
client_state_->transaction().state() == wsrep::transaction::s_prepared ||
client_state_->transaction().state() == wsrep::transaction::s_replaying);
if (fail_next_applying_)
{
@ -62,7 +63,18 @@ int wsrep::mock_high_priority_service::apply_write_set(
}
else
{
return 0;
int ret(0);
if (!(meta.flags() & wsrep::provider::flag::commit))
{
client_state_->fragment_applied(meta.seqno());
}
if ((meta.flags() & wsrep::provider::flag::prepare))
{
client_state_->assign_xid(wsrep::xid(1, 3, 1, "xid"));
ret = client_state_->before_prepare() ||
client_state_->after_prepare();
}
return ret;
};
}
@ -77,9 +89,19 @@ int wsrep::mock_high_priority_service::commit(
ret = client_state_->before_prepare() ||
client_state_->after_prepare();
}
return (ret || client_state_->before_commit() ||
client_state_->ordered_commit() ||
client_state_->after_commit());
const bool is_ordered= !ws_meta.seqno().is_undefined();
if (!is_ordered)
{
client_state_->before_rollback();
client_state_->after_rollback();
return 0;
}
else
{
return (ret || client_state_->before_commit() ||
client_state_->ordered_commit() ||
client_state_->after_commit());
}
}
int wsrep::mock_high_priority_service::rollback(