summaryrefslogtreecommitdiff
path: root/mysql-test/suite/binlog/t/binlog_empty_xa_prepared.test
blob: 443feb606278754955fbed6511e8e0c5f597593b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# The test verifies execution and binary logging of user XA that produce empty
# XA-PREPARE group of events.

--source include/have_binlog_format_mixed.inc
--source include/have_innodb.inc


# MDEV-22420 DDL on temporary object is prohibited when XA is in prepare state

# Temporary sequnce may not be created within a transaction
CREATE TEMPORARY SEQUENCE seq_1;

XA START '3';
CREATE TEMPORARY TABLE tmp_1(c INT);
XA END '3';
XA PREPARE '3';
--error ER_XAER_RMFAIL
DROP TEMPORARY TABLE tmp_1;
--error ER_XAER_RMFAIL
ALTER TABLE tmp_1 DROP COLUMN c;
--error ER_XAER_RMFAIL
DROP TEMPORARY SEQUENCE seq_1;
--error ER_XAER_RMFAIL
ALTER SEQUENCE seq_1 INCREMENT BY 1;

--error ER_XAER_RMFAIL
CREATE TEMPORARY TABLE tmp_2(c INT);
--error ER_XAER_RMFAIL
CREATE TEMPORARY SEQUENCE seq_2;

# Cleanup
XA ROLLBACK '3';

--echo # Proof of  correct logging incl empty XA-PREPARE
--source include/show_binlog_events.inc

# The test verifies execution and binary logging of user XA that produce empty
# XA-PREPARE group of events.
#
# MDEV-22757 Assertion `!binlog || exist_hton_without_prepare'
#            in MYSQL_BIN_LOG::unlog_xa_prepare

RESET MASTER;
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
INSERT INTO t2 VALUES (1),(2);

XA START '1';
REPLACE INTO t1 SELECT * FROM t1;
REPLACE INTO t2 SELECT * FROM t2;
XA END '1';
XA PREPARE '1';

# Cleanup
XA ROLLBACK '1';
DROP TABLE t1, t2;

--echo # Proof of  correct logging incl empty XA-PREPARE
--source include/show_binlog_events.inc


# MDEV-22430 Assertion ... in MYSQL_BIN_LOG::unlog_xa_prepare

RESET MASTER;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
CREATE SEQUENCE s ENGINE=InnoDB;

XA START '2';
SELECT NEXT VALUE FOR s;
REPLACE INTO t1 SELECT * FROM t1;
XA END '2';
XA PREPARE '2';

# Cleanup
XA ROLLBACK '2';
DROP SEQUENCE s;
DROP TABLE t1;

--echo # Proof of  correct logging incl empty XA-PREPARE
--source include/show_binlog_events.inc