Skip to content

Commit a125138

Browse files
committed
Fixes for supporting CTAS and native thread BF aborting
This patch will start a transaction in wsrep-lib, to enable rolling back the victim
1 parent 4fdddc2 commit a125138

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
connection node_2;
2+
connection node_1;
13
disconnect node_2;
24
disconnect node_1;
35
# End of test

sql/service_wsrep.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@ extern "C" my_bool wsrep_thd_bf_abort(const void* bf_thd_ptr,
225225
{
226226
const THD* bf_thd= (const THD*)bf_thd_ptr;
227227
THD* victim_thd= (THD*)victim_thd_ptr;
228+
229+
if (!victim_thd->wsrep_trx().active())
230+
{
231+
WSREP_DEBUG("BF abort for non active transaction");
232+
wsrep_start_transaction(victim_thd, victim_thd->wsrep_next_trx_id());
233+
}
228234
my_bool ret= wsrep_bf_abort(bf_thd, victim_thd);
229235
/*
230236
Send awake signal if victim was BF aborted or does not

sql/sql_insert.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4514,8 +4514,14 @@ select_create::binlog_show_create_table(TABLE **tables, uint count)
45144514
errcode);
45154515
}
45164516
#ifdef WITH_WSREP
4517-
// ha_wsrep_fake_trx_id(thd);
4518-
wsrep_start_transaction(thd, thd->wsrep_next_trx_id());
4517+
if (thd->wsrep_trx().active())
4518+
{
4519+
WSREP_DEBUG("transaction already started for CTAS");
4520+
}
4521+
else
4522+
{
4523+
wsrep_start_transaction(thd, thd->wsrep_next_trx_id());
4524+
}
45194525
#endif
45204526
return result;
45214527
}

sql/wsrep_thd.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "mariadb.h"
1717
#include "wsrep_thd.h"
18+
#include "wsrep_trans_observer.h"
1819
#include "wsrep_high_priority_service.h"
1920
#include "wsrep_storage_service.h"
2021
#include "transaction.h"
@@ -420,6 +421,13 @@ bool wsrep_bf_abort(const THD* bf_thd, THD* victim_thd)
420421
WSREP_LOG_THD((THD*)bf_thd, "BF aborter before");
421422
WSREP_LOG_THD(victim_thd, "victim before");
422423
wsrep::seqno bf_seqno(bf_thd->wsrep_trx().ws_meta().seqno());
424+
425+
if (!victim_thd->wsrep_trx().active())
426+
{
427+
WSREP_DEBUG("wsrep_bf_abort, BF abort for non active transaction");
428+
wsrep_start_transaction(victim_thd, victim_thd->wsrep_next_trx_id());
429+
}
430+
423431
bool ret;
424432
if (wsrep_thd_is_toi(bf_thd))
425433
{

0 commit comments

Comments
 (0)