| 1 |
--source include/have_innodb.inc |
| 2 |
# Embedded server does not support restarting. |
| 3 |
--source include/not_embedded.inc |
| 4 |
--source include/no_valgrind_without_big.inc |
| 5 |
|
| 6 |
# MDEV-8841 - close tables opened by previous tests, |
| 7 |
# so they don't get marked crashed when the server gets crashed |
| 8 |
--disable_query_log |
| 9 |
call mtr.add_suppression("Found [12] prepared XA transactions"); |
| 10 |
FLUSH TABLES; |
| 11 |
--enable_query_log |
| 12 |
|
| 13 |
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; |
| 14 |
INSERT INTO t1 VALUES (1); |
| 15 |
connect (con1,localhost,root); |
| 16 |
XA START 'x'; UPDATE t1 set a=2; XA END 'x'; XA PREPARE 'x'; |
| 17 |
connect (con2,localhost,root); |
| 18 |
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; |
| 19 |
XA START 'y'; INSERT INTO t2 VALUES (1); XA END 'y'; XA PREPARE 'y'; |
| 20 |
connection default; |
| 21 |
|
| 22 |
# innodb_force_recovery=2 prevents the purge and tests that the fix of |
| 23 |
# MDEV-13606 XA PREPARE transactions should survive innodb_force_recovery=1 or 2 |
| 24 |
# is present. |
| 25 |
--let $restart_parameters= --innodb-force-recovery=2 |
| 26 |
--let $shutdown_timeout=0 |
| 27 |
--source include/restart_mysqld.inc |
| 28 |
--let $restart_parameters= |
| 29 |
--let $shutdown_timeout= |
| 30 |
|
| 31 |
disconnect con1; |
| 32 |
disconnect con2; |
| 33 |
connect (con1,localhost,root); |
| 34 |
send |
| 35 |
SET STATEMENT innodb_lock_wait_timeout=1 FOR # work around MDEV-38741 |
| 36 |
SELECT * FROM t1 LOCK IN SHARE MODE; |
| 37 |
|
| 38 |
connection default; |
| 39 |
let $wait_condition= |
| 40 |
select count(*) = 1 from information_schema.processlist |
| 41 |
where state = 'Sending data' and |
| 42 |
info LIKE 'SET STATEMENT innodb_lock_wait_timeout%'; |
| 43 |
--source include/wait_condition.inc |
| 44 |
|
| 45 |
SET innodb_lock_wait_timeout=1; |
| 46 |
--error ER_LOCK_WAIT_TIMEOUT |
| 47 |
DROP TABLE t2; |
| 48 |
|
| 49 |
disconnect con1; |
| 50 |
|
| 51 |
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; |
| 52 |
--disable_ps2_protocol |
| 53 |
SELECT * FROM t1; |
| 54 |
--enable_ps2_protocol |
| 55 |
XA ROLLBACK 'x'; |
| 56 |
SELECT * FROM t1; |
| 57 |
|
| 58 |
--error ER_LOCK_WAIT_TIMEOUT |
| 59 |
DROP TABLE t2; |
| 60 |
XA ROLLBACK 'y'; |
| 61 |
DROP TABLE t2; |
| 62 |
CREATE TABLE t3(a INT PRIMARY KEY REFERENCES t1(a)) ENGINE=InnoDB; |
| 63 |
XA START 'a'; |
| 64 |
INSERT INTO t3 SET a=1; |
| 65 |
--error ER_NO_REFERENCED_ROW_2 |
| 66 |
INSERT INTO t3 SET a=42; |
| 67 |
XA END 'a'; |
| 68 |
XA PREPARE 'a'; |
| 69 |
|
| 70 |
SET GLOBAL innodb_fast_shutdown=0; |
| 71 |
--source include/restart_mysqld.inc |
| 72 |
|
| 73 |
XA COMMIT 'a'; |
| 74 |
SELECT * FROM t3; |
| 75 |
DROP TABLE t3,t1; |