From 566195d0719a5005538dd648105a88fbdd0cee59 Mon Sep 17 00:00:00 2001 From: Denis Protivensky Date: Mon, 25 Nov 2024 17:04:56 +0300 Subject: [PATCH 1/3] Pass proper BF seqno for TOI transactions --- sql/wsrep_thd.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index 1c51d05c56a68..0afb60727a545 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -323,7 +323,7 @@ static bool wsrep_bf_abort_low(THD *bf_thd, THD *victim_thd) };); #endif - wsrep::seqno bf_seqno(bf_thd->wsrep_trx().ws_meta().seqno()); + wsrep::seqno bf_seqno(wsrep_thd_trx_seqno(bf_thd)); bool ret; { From 9dea8c15ca274f400aec0b58c2bbb3ac39b19136 Mon Sep 17 00:00:00 2001 From: Denis Protivensky Date: Tue, 26 Nov 2024 20:14:48 +0300 Subject: [PATCH 2/3] Fix self-abort of SR transactions It's more correct and also allows to properly pass 0 seqno instead of undefined (-1). --- sql/service_wsrep.cc | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc index c131e3c7fb56b..c3dc3ac42ea9a 100644 --- a/sql/service_wsrep.cc +++ b/sql/service_wsrep.cc @@ -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); } } From 2cd52de76ef17e38c3b7398acc093060ccaa8326 Mon Sep 17 00:00:00 2001 From: Denis Protivensky Date: Mon, 2 Dec 2024 16:57:07 +0300 Subject: [PATCH 3/3] Update wsrep-lib to include bf seqno assert --- wsrep-lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wsrep-lib b/wsrep-lib index 1c61b809d1e1d..5321c91e7c56e 160000 --- a/wsrep-lib +++ b/wsrep-lib @@ -1 +1 @@ -Subproject commit 1c61b809d1e1d03771dcad689d3a084e17c6b6c3 +Subproject commit 5321c91e7c56e640762e664514fff0e08556132c