summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/xa_recovery.test
blob: 32373d63d14324ac5f5c1549814c8ff1fa0fadf6 (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
if (`select plugin_auth_version <= "5.6.24" from information_schema.plugins where plugin_name='innodb'`)
{
  --skip Not fixed in InnoDB as of 5.6.24 or earlier
}
--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
FLUSH TABLES;
--enable_query_log

#
# We kill server belown with timeout 0 that is not fully safe
#
call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");

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;

call mtr.add_suppression("Found 1 prepared XA transactions");

# Kill and restart the server.
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server 0
-- source include/wait_until_disconnected.inc

-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
-- disable_reconnect

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;