diff --git a/mysql-test/suite/galera/r/galera_concurrent_ctas.result b/mysql-test/suite/galera/r/galera_concurrent_ctas.result index 8a3ac1ae0d368..39c55277c522f 100644 --- a/mysql-test/suite/galera/r/galera_concurrent_ctas.result +++ b/mysql-test/suite/galera/r/galera_concurrent_ctas.result @@ -1,3 +1,5 @@ +connection node_2; +connection node_1; disconnect node_2; disconnect node_1; # End of test diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc index 6706f147b871f..29f70d211e001 100644 --- a/sql/service_wsrep.cc +++ b/sql/service_wsrep.cc @@ -225,6 +225,12 @@ extern "C" my_bool wsrep_thd_bf_abort(const void* bf_thd_ptr, { const THD* bf_thd= (const THD*)bf_thd_ptr; THD* victim_thd= (THD*)victim_thd_ptr; + + if (WSREP(victim_thd) && !victim_thd->wsrep_trx().active()) + { + WSREP_DEBUG("BF abort for non active transaction"); + wsrep_start_transaction(victim_thd, victim_thd->wsrep_next_trx_id()); + } my_bool ret= wsrep_bf_abort(bf_thd, victim_thd); /* Send awake signal if victim was BF aborted or does not diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 16bfcd9036071..b20dded94300d 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -4543,8 +4543,14 @@ select_create::binlog_show_create_table(TABLE **tables, uint count) errcode); } #ifdef WITH_WSREP - // ha_wsrep_fake_trx_id(thd); - wsrep_start_transaction(thd, thd->wsrep_next_trx_id()); + if (thd->wsrep_trx().active()) + { + WSREP_DEBUG("transaction already started for CTAS"); + } + else + { + wsrep_start_transaction(thd, thd->wsrep_next_trx_id()); + } #endif return result; } diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index c5411e8fe511d..c399fe6a23d4d 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -15,6 +15,7 @@ #include "mariadb.h" #include "wsrep_thd.h" +#include "wsrep_trans_observer.h" #include "wsrep_high_priority_service.h" #include "wsrep_storage_service.h" #include "transaction.h" @@ -420,6 +421,13 @@ bool wsrep_bf_abort(const THD* bf_thd, THD* victim_thd) WSREP_LOG_THD((THD*)bf_thd, "BF aborter before"); WSREP_LOG_THD(victim_thd, "victim before"); wsrep::seqno bf_seqno(bf_thd->wsrep_trx().ws_meta().seqno()); + + if (WSREP(victim_thd) && !victim_thd->wsrep_trx().active()) + { + WSREP_DEBUG("wsrep_bf_abort, BF abort for non active transaction"); + wsrep_start_transaction(victim_thd, victim_thd->wsrep_next_trx_id()); + } + bool ret; if (wsrep_thd_is_toi(bf_thd)) { diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 8bf64c284419e..7ef5c624707d6 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -579,8 +579,8 @@ struct trx_lock_t { serving the running transaction. */ #ifdef WITH_WSREP bool was_chosen_as_wsrep_victim; - /*!< high priority wsrep thread has - marked this trx to abort */ + /*!< high priority wsrep thread has marked + this trx to abort */ #endif /* WITH_WSREP */ /** Pre-allocated record locks */