mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
b8b3ba632b
When MySQL 5.0.3 introduced InnoDB support for two-phase commit, it also introduced the questionable logic to roll back XA PREPARE transactions on startup when innodb_force_recovery is 1 or 2. Remove this logic in order to avoid unwanted side effects when innodb_force_recovery is being set for other reasons. That is, XA PREPARE transactions will always remain in that state until InnoDB receives an explicit XA ROLLBACK or XA COMMIT request from the upper layer. At the time the logic was introduced in MySQL 5.0.3, there already was a startup parameter that is the preferred way of achieving the behaviour: --tc-heuristic-recover=ROLLBACK.
45 lines
1.3 KiB
Text
45 lines
1.3 KiB
Text
--source include/have_innodb.inc
|
|
# Embedded server does not support restarting.
|
|
--source include/not_embedded.inc
|
|
|
|
# MDEV-8841 - close tables opened by previous tests,
|
|
# so they don't get marked crashed when the server gets crashed
|
|
--disable_query_log
|
|
call mtr.add_suppression("Found 1 prepared XA transactions");
|
|
FLUSH TABLES;
|
|
--enable_query_log
|
|
|
|
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1);
|
|
connect (con1,localhost,root);
|
|
XA START 'x'; UPDATE t1 set a=2; XA END 'x'; XA PREPARE 'x';
|
|
connection default;
|
|
|
|
# innodb_force_recovery=2 prevents the purge and tests that the fix of
|
|
# MDEV-13606 XA PREPARE transactions should survive innodb_force_recovery=1 or 2
|
|
# is present.
|
|
--let $restart_parameters= --innodb-force-recovery=2
|
|
--source include/kill_and_restart_mysqld.inc
|
|
--let $restart_parameters=
|
|
|
|
disconnect con1;
|
|
connect (con1,localhost,root);
|
|
--send SELECT * FROM t1 LOCK IN SHARE MODE
|
|
|
|
connection default;
|
|
let $wait_condition=
|
|
select count(*) = 1 from information_schema.processlist
|
|
where state = 'Sending data' and
|
|
info = 'SELECT * FROM t1 LOCK IN SHARE MODE';
|
|
--source include/wait_condition.inc
|
|
|
|
--source include/restart_mysqld.inc
|
|
|
|
disconnect con1;
|
|
|
|
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
|
SELECT * FROM t1;
|
|
XA ROLLBACK 'x';
|
|
SELECT * FROM t1;
|
|
|
|
DROP TABLE t1;
|