1# The test verifies execution and binary logging of user XA that produce empty
2# XA-PREPARE group of events.
3
4--source include/have_binlog_format_mixed.inc
5--source include/have_innodb.inc
6
7
8# MDEV-22420 DDL on temporary object is prohibited when XA is in prepare state
9
10# Temporary sequnce may not be created within a transaction
11CREATE TEMPORARY SEQUENCE seq_1;
12
13XA START '3';
14CREATE TEMPORARY TABLE tmp_1(c INT);
15XA END '3';
16XA PREPARE '3';
17--error ER_XAER_RMFAIL
18DROP TEMPORARY TABLE tmp_1;
19--error ER_XAER_RMFAIL
20ALTER TABLE tmp_1 DROP COLUMN c;
21--error ER_XAER_RMFAIL
22DROP TEMPORARY SEQUENCE seq_1;
23--error ER_XAER_RMFAIL
24ALTER SEQUENCE seq_1 INCREMENT BY 1;
25
26--error ER_XAER_RMFAIL
27CREATE TEMPORARY TABLE tmp_2(c INT);
28--error ER_XAER_RMFAIL
29CREATE TEMPORARY SEQUENCE seq_2;
30
31# Cleanup
32XA ROLLBACK '3';
33
34--echo # Proof of  correct logging incl empty XA-PREPARE
35--source include/show_binlog_events.inc
36
37# The test verifies execution and binary logging of user XA that produce empty
38# XA-PREPARE group of events.
39#
40# MDEV-22757 Assertion `!binlog || exist_hton_without_prepare'
41#            in MYSQL_BIN_LOG::unlog_xa_prepare
42
43RESET MASTER;
44CREATE TABLE t1 (a INT) ENGINE=MyISAM;
45CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB;
46INSERT INTO t1 VALUES (1),(2);
47INSERT INTO t2 VALUES (1),(2);
48
49XA START '1';
50REPLACE INTO t1 SELECT * FROM t1;
51REPLACE INTO t2 SELECT * FROM t2;
52XA END '1';
53XA PREPARE '1';
54
55# Cleanup
56XA ROLLBACK '1';
57DROP TABLE t1, t2;
58
59--echo # Proof of  correct logging incl empty XA-PREPARE
60--source include/show_binlog_events.inc
61
62
63# MDEV-22430 Assertion ... in MYSQL_BIN_LOG::unlog_xa_prepare
64
65RESET MASTER;
66CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
67INSERT INTO t1 VALUES (1);
68CREATE SEQUENCE s ENGINE=InnoDB;
69
70XA START '2';
71SELECT NEXT VALUE FOR s;
72REPLACE INTO t1 SELECT * FROM t1;
73XA END '2';
74XA PREPARE '2';
75
76# Cleanup
77XA ROLLBACK '2';
78DROP SEQUENCE s;
79DROP TABLE t1;
80
81--echo # Proof of  correct logging incl empty XA-PREPARE
82--source include/show_binlog_events.inc
83