mariadb/mysql-test/suite/binlog/t/binlog_empty_xa_prepared.test
Andrei Elkin 675c22c065 MDEV-22757 Assertion !binlog || exist_hton_without_prepare' failed in MYSQL_BIN_LOG::unlog_xa_prepare
The assert fired falsely having not captured two more not apparent
possiblities in its condition.

They are masked out hton error out of REPLACE execution (so at later xa-prepare
that engine is still present as read-write) and a prepare-capable engine
which also may not be an actual participant in the xa transation. That
engine, such as SEQUENCE, though does create its own event block.
2021-04-19 20:34:17 +03:00

82 lines
2 KiB
Text

# 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