Skip to content

Commit

Permalink
Fix self-abort of SR transactions
Browse files Browse the repository at this point in the history
It's more correct and also allows to properly pass 0 seqno instead of
undefined (-1).
  • Loading branch information
denis-protivensky committed Dec 2, 2024
1 parent a6b78f7 commit 2f47ddb
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions sql/service_wsrep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,25 +201,21 @@ extern "C" void wsrep_handle_SR_rollback(THD *bf_thd,
victim_thd->wsrep_sr().fragments_certified(),
wsrep_thd_transaction_state_str(victim_thd));

/* Note: do not store/reset globals before wsrep_bf_abort() call
to avoid losing BF thd context. */
if (!(bf_thd && bf_thd != victim_thd))
const bool self_abort= (!bf_thd || bf_thd == victim_thd);
if (self_abort)
{
/* Don't hold the lock in sync wait. wsrep_thd_self_abort() grabs
the same lock again before performing BF abort. */
wsrep_thd_UNLOCK(victim_thd);
DEBUG_SYNC(victim_thd, "wsrep_before_SR_rollback");
}
if (bf_thd)
{
wsrep_bf_abort(bf_thd, victim_thd);
}
else
{
wsrep_thd_self_abort(victim_thd);
}

wsrep_thd_UNLOCK(victim_thd);

if (bf_thd)
else
{
/* Note: do not store/reset globals before wsrep_bf_abort() call
to avoid losing BF thd context. */
wsrep_bf_abort(bf_thd, victim_thd);
wsrep_thd_UNLOCK(victim_thd);
wsrep_store_threadvars(bf_thd);
}
}
Expand Down

0 comments on commit 2f47ddb

Please sign in to comment.