summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-06-29 16:58:33 +0200
committerSergei Golubchik <serg@mariadb.org>2023-03-20 11:28:50 +0100
commitab573d4fa39e8c03329222f8dc0a2a6d7b19fee1 (patch)
treee979946cdccbc6a95cf66619081138f515a5cef0
parentdc11447a3677d1fdf2d3a1d9cdd3ac28560d01de (diff)
downloadmariadb-git-ab573d4fa39e8c03329222f8dc0a2a6d7b19fee1.tar.gz
MDEV-28944 XA assertions failing in binlog_rollback and binlog_commit
-rw-r--r--mysql-test/main/alter_table_online.result19
-rw-r--r--mysql-test/main/alter_table_online.test22
-rw-r--r--sql/sql_table.cc2
3 files changed, 43 insertions, 0 deletions
diff --git a/mysql-test/main/alter_table_online.result b/mysql-test/main/alter_table_online.result
index 5015b4cb5b7..903fa86de94 100644
--- a/mysql-test/main/alter_table_online.result
+++ b/mysql-test/main/alter_table_online.result
@@ -54,3 +54,22 @@ c c2 stamp
5 5 0000-00-00 00:00:00
drop table t;
set sql_mode=default;
+#
+# MDEV-28944 XA assertions failing in binlog_rollback and binlog_commit
+#
+CREATE TABLE t (a INT) ENGINE=MyISAM;
+INSERT INTO t VALUES (1);
+connect con1,localhost,root,,test;
+XA START 'xid';
+SELECT * FROM t;
+a
+1
+connection default;
+ALTER TABLE t NOWAIT ADD KEY (a);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection con1;
+UPDATE t SET a = 2;
+XA END 'xid';
+XA COMMIT 'xid' ONE PHASE;
+DROP TABLE t;
+disconnect con1;
diff --git a/mysql-test/main/alter_table_online.test b/mysql-test/main/alter_table_online.test
index a9e20fa05f6..92710f46cbf 100644
--- a/mysql-test/main/alter_table_online.test
+++ b/mysql-test/main/alter_table_online.test
@@ -33,3 +33,25 @@ alter table t modify c date;
select * from t;
drop table t;
set sql_mode=default;
+
+--echo #
+--echo # MDEV-28944 XA assertions failing in binlog_rollback and binlog_commit
+--echo #
+CREATE TABLE t (a INT) ENGINE=MyISAM;
+INSERT INTO t VALUES (1);
+
+--connect (con1,localhost,root,,test)
+XA START 'xid';
+SELECT * FROM t;
+
+--connection default
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t NOWAIT ADD KEY (a);
+
+--connection con1
+UPDATE t SET a = 2;
+XA END 'xid';
+XA COMMIT 'xid' ONE PHASE;
+
+DROP TABLE t;
+--disconnect con1
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 7a9da196272..92bcea5e193 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -12009,6 +12009,8 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
thd_progress_next_stage(thd);
error= online_alter_read_from_binlog(thd, &rgi, binlog);
}
+ if (error)
+ from->s->tdc->flush_unused(1); // to free the binlog
}
else if (online) // error was on copy stage
{