From c43db43a7cea2dca028093e10012e5ab8293172f Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Thu, 22 Feb 2024 09:17:29 +0100 Subject: [PATCH] MENT-2038 Assert WSREP(thd) fails in wsrep_restore_kill_after_commit Fix wrong assertion: function wsrep_restore_kill_after_commit() asserts `WSREP(thd)`, however for the caller (wsrep_after_statement()) it is enough that the THD has an active transaction. Fixed the assertion accordingly. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera_sr/r/MENT-2038.result | 7 +++++++ mysql-test/suite/galera_sr/t/MENT-2038.test | 12 ++++++++++++ sql/wsrep_thd.cc | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/galera_sr/r/MENT-2038.result create mode 100644 mysql-test/suite/galera_sr/t/MENT-2038.test diff --git a/mysql-test/suite/galera_sr/r/MENT-2038.result b/mysql-test/suite/galera_sr/r/MENT-2038.result new file mode 100644 index 00000000000..bbd7c568925 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/MENT-2038.result @@ -0,0 +1,7 @@ +connection node_2; +connection node_1; +SET SESSION wsrep_on=OFF; +BEGIN; +BEGIN; +COMMIT; +SET SESSION wsrep_on=ON; diff --git a/mysql-test/suite/galera_sr/t/MENT-2038.test b/mysql-test/suite/galera_sr/t/MENT-2038.test new file mode 100644 index 00000000000..311b0d3a36f --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MENT-2038.test @@ -0,0 +1,12 @@ +# +# MENT-2038: Assertion `(thd && (WSREP_PROVIDER_EXISTS_ && thd->variables.wsrep_on))' +# failed in void wsrep_restore_kill_after_commit(THD*) +# + +--source include/galera_cluster.inc + +SET SESSION wsrep_on=OFF; +BEGIN; +BEGIN; # If bug is present, assertion triggers during implicit commit +COMMIT; +SET SESSION wsrep_on=ON; diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index 1c51d05c56a..2c2e3a0e44d 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -496,7 +496,7 @@ void wsrep_backup_kill_for_commit(THD *thd) void wsrep_restore_kill_after_commit(THD *thd) { - DBUG_ASSERT(WSREP(thd)); + DBUG_ASSERT(wsrep_is_active(thd)); mysql_mutex_assert_owner(&thd->LOCK_thd_kill); thd->killed= thd->wsrep_abort_by_kill; my_free(thd->killed_err);