summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Malyavin <nikitamalyavin@gmail.com>2022-07-19 01:19:11 +0300
committerNikita Malyavin <nikitamalyavin@gmail.com>2022-08-23 16:36:27 +0300
commit2dd74a60401b847bde83fe951deb5c7b39b4fbba (patch)
treefd6f54432d8b5d893c8d2df7296627d1cdb2443a
parenteb62ee883463537c4844a9a818737cbcc11d3f8f (diff)
downloadmariadb-git-2dd74a60401b847bde83fe951deb5c7b39b4fbba.tar.gz
MDEV-29038 XA assertions failing in binlog_rollback and binlog_commit
ONLINE ALTER TABLE adds binlog handlerton into ha_list, so any rollback command can end up calling binlog_rollback having no cache_mngr, if binlog is not enabled. The assertion should be fixed in the same manner as DBUG_ASSERT(WSREP(thd))
-rw-r--r--mysql-test/main/alter_table_online_debug.result17
-rw-r--r--mysql-test/main/alter_table_online_debug.test25
-rw-r--r--sql/log.cc2
3 files changed, 43 insertions, 1 deletions
diff --git a/mysql-test/main/alter_table_online_debug.result b/mysql-test/main/alter_table_online_debug.result
index a7c1cb91f73..18b552ca53a 100644
--- a/mysql-test/main/alter_table_online_debug.result
+++ b/mysql-test/main/alter_table_online_debug.result
@@ -1055,5 +1055,22 @@ set debug_sync= reset;
set debug_dbug= @old_debug;
connection default;
#
+# MDEV-29038 XA assertions failing in binlog_rollback and binlog_commit
+#
+create table t (a int);
+insert into t values (1);
+xa begin 'xid';
+set debug_sync= 'now wait_for downgraded';
+connect con1,localhost,root,,test;
+set debug_sync= 'alter_table_online_downgraded signal downgraded wait_for goforit';
+alter table t force, algorithm=copy, lock=none;
+connection default;
+insert into t values (2);
+set debug_sync= 'now signal goforit';
+xa end 'xid';
+xa rollback 'xid';
+drop table t;
+set debug_sync= reset;
+#
# End of 10.10 tests
#
diff --git a/mysql-test/main/alter_table_online_debug.test b/mysql-test/main/alter_table_online_debug.test
index 4fef70a7224..719eb4c477d 100644
--- a/mysql-test/main/alter_table_online_debug.test
+++ b/mysql-test/main/alter_table_online_debug.test
@@ -1227,5 +1227,30 @@ set debug_dbug= @old_debug;
--connection default
--echo #
+--echo # MDEV-29038 XA assertions failing in binlog_rollback and binlog_commit
+--echo #
+create table t (a int);
+insert into t values (1);
+xa begin 'xid';
+--send
+set debug_sync= 'now wait_for downgraded';
+
+--connect (con1,localhost,root,,test)
+set debug_sync= 'alter_table_online_downgraded signal downgraded wait_for goforit';
+--send
+alter table t force, algorithm=copy, lock=none;
+
+--connection default
+--reap
+insert into t values (2);
+set debug_sync= 'now signal goforit';
+xa end 'xid';
+xa rollback 'xid';
+
+# Cleanup
+drop table t;
+set debug_sync= reset;
+
+--echo #
--echo # End of 10.10 tests
--echo #
diff --git a/sql/log.cc b/sql/log.cc
index d614d2e456a..27478fd2c1d 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2408,7 +2408,7 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
if (!cache_mngr)
{
DBUG_ASSERT(WSREP(thd) || rollback_online);
- DBUG_ASSERT(thd->lex->sql_command != SQLCOM_XA_ROLLBACK);
+ DBUG_ASSERT(thd->lex->sql_command != SQLCOM_XA_ROLLBACK || rollback_online);
DBUG_RETURN(0);
}