Skip to content

Commit 13f1e97

Browse files
committed
MDEV-28944 XA assertions failing in binlog_rollback and binlog_commit
1 parent 8f6f219 commit 13f1e97

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

mysql-test/main/alter_table_online.result

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,22 @@ c c2 stamp
5454
5 5 0000-00-00 00:00:00
5555
drop table t;
5656
set sql_mode=default;
57+
#
58+
# MDEV-28944 XA assertions failing in binlog_rollback and binlog_commit
59+
#
60+
CREATE TABLE t (a INT) ENGINE=MyISAM;
61+
INSERT INTO t VALUES (1);
62+
connect con1,localhost,root,,test;
63+
XA START 'xid';
64+
SELECT * FROM t;
65+
a
66+
1
67+
connection default;
68+
ALTER TABLE t NOWAIT ADD KEY (a);
69+
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
70+
connection con1;
71+
UPDATE t SET a = 2;
72+
XA END 'xid';
73+
XA COMMIT 'xid' ONE PHASE;
74+
DROP TABLE t;
75+
disconnect con1;

mysql-test/main/alter_table_online.test

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,25 @@ alter table t modify c date;
3333
select * from t;
3434
drop table t;
3535
set sql_mode=default;
36+
37+
--echo #
38+
--echo # MDEV-28944 XA assertions failing in binlog_rollback and binlog_commit
39+
--echo #
40+
CREATE TABLE t (a INT) ENGINE=MyISAM;
41+
INSERT INTO t VALUES (1);
42+
43+
--connect (con1,localhost,root,,test)
44+
XA START 'xid';
45+
SELECT * FROM t;
46+
47+
--connection default
48+
--error ER_LOCK_WAIT_TIMEOUT
49+
ALTER TABLE t NOWAIT ADD KEY (a);
50+
51+
--connection con1
52+
UPDATE t SET a = 2;
53+
XA END 'xid';
54+
XA COMMIT 'xid' ONE PHASE;
55+
56+
DROP TABLE t;
57+
--disconnect con1

sql/sql_table.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12011,6 +12011,8 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
1201112011
thd_progress_next_stage(thd);
1201212012
error= online_alter_read_from_binlog(thd, &rgi, binlog);
1201312013
}
12014+
if (error)
12015+
from->s->tdc->flush_unused(1); // to free the binlog
1201412016
}
1201512017
else if (online) // error was on copy stage
1201612018
{

0 commit comments

Comments
 (0)