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

Pass victim context for provider on BF abort

This change is needed for custom provider implementations to
have a way to access the victim in the application context.

Helper interface operation_context to pass caller context for
service/provider callbacks in more type safe way.
This commit is contained in:
Teemu Ollakka
2022-05-01 16:37:24 +03:00
parent bfc5a8f6ee
commit b3f0e05da4
9 changed files with 87 additions and 11 deletions

View File

@ -964,7 +964,8 @@ void wsrep::transaction::after_applying()
bool wsrep::transaction::bf_abort(
wsrep::unique_lock<wsrep::mutex>& lock,
wsrep::seqno bf_seqno)
wsrep::seqno bf_seqno,
wsrep::operation_context& victim_ctx)
{
bool ret(false);
const enum wsrep::transaction::state state_at_enter(state());
@ -989,7 +990,7 @@ bool wsrep::transaction::bf_abort(
wsrep::seqno victim_seqno;
enum wsrep::provider::status
status(client_state_.provider().bf_abort(
bf_seqno, id_, victim_seqno));
bf_seqno, id_, victim_ctx, victim_seqno));
switch (status)
{
case wsrep::provider::success:
@ -1077,9 +1078,10 @@ bool wsrep::transaction::bf_abort(
bool wsrep::transaction::total_order_bf_abort(
wsrep::unique_lock<wsrep::mutex>& lock WSREP_UNUSED,
wsrep::seqno bf_seqno)
wsrep::seqno bf_seqno,
wsrep::operation_context& victim_ctx)
{
bool ret(bf_abort(lock, bf_seqno));
bool ret(bf_abort(lock, bf_seqno, victim_ctx));
if (ret)
{
bf_aborted_in_total_order_ = true;

View File

@ -895,6 +895,7 @@ enum wsrep::provider::status
wsrep::wsrep_provider_v26::bf_abort(
wsrep::seqno bf_seqno,
wsrep::transaction_id victim_id,
wsrep::operation_context& /* Ignored here */,
wsrep::seqno& victim_seqno)
{
wsrep_seqno_t wsrep_victim_seqno;

View File

@ -63,6 +63,7 @@ namespace wsrep
enum wsrep::provider::status
bf_abort(wsrep::seqno,
wsrep::transaction_id,
wsrep::operation_context&,
wsrep::seqno&) WSREP_OVERRIDE;
enum wsrep::provider::status
rollback(const wsrep::transaction_id) WSREP_OVERRIDE;