Debian Codegraph @

mysql-test/suite/innodb/t/recovery_shutdown.test

raw
1 --source include/have_innodb.inc
2 --source include/not_embedded.inc
3 --source include/no_valgrind_without_big.inc
4 --source include/have_sequence.inc
5
6 # Flush any open myisam tables from previous tests
7 FLUSH TABLES;
8 call mtr.add_suppression("Found 1 prepared XA transactions");
9 call mtr.add_suppression("InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0 or XA PREPARE transactions exist");
10
11 --echo #
12 --echo # MDEV-13797 InnoDB may hang if shutdown is initiated soon after startup
13 --echo # while rolling back recovered incomplete transactions
14 --echo #
15
16 let $size = 100;
17 let $trx = 8;
18
19 let $c = $trx;
20 connect (con$c,localhost,root,,);
21 eval CREATE TABLE t$c (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB;
22 XA START 'x';
23 eval INSERT INTO t$c (a) SELECT NULL FROM seq_1_to_$size;
24 eval UPDATE t$c SET a=a+$size, b=a;
25 eval DELETE FROM t$c;
26 XA END 'x';
27 XA PREPARE 'x';
28 dec $c;
29 while ($c)
30 {
31 connect (con$c,localhost,root,,);
32 eval CREATE TABLE t$c (a SERIAL, b INT UNIQUE, c INT UNIQUE) ENGINE=InnoDB;
33 BEGIN;
34 eval INSERT INTO t$c (a) SELECT NULL FROM seq_1_to_$size;
35 eval UPDATE t$c SET a=a+$size, b=a;
36 eval DELETE FROM t$c;
37 dec $c;
38 }
39
40 INSERT INTO t1(a) SELECT NULL FROM seq_1_to_1600;
41
42 --connection default
43 SET GLOBAL innodb_flush_log_at_trx_commit=1;
44 CREATE TABLE MDEV_29559 (a TINYINT UNSIGNED PRIMARY KEY, KEY(a)) ENGINE=InnoDB;
45 INSERT INTO MDEV_29559 VALUES (0x69);
46
47 FLUSH TABLES;
48
49 --let $shutdown_timeout=0
50 --source include/restart_mysqld.inc
51 --let $shutdown_timeout=60
52
53 # Perform a slow shutdown in order to roll back all recovered transactions
54 # and to avoid locking conflicts with the DROP TABLE below.
55 XA RECOVER;
56 --disable_query_log
57 SET GLOBAL innodb_fast_shutdown=0;
58 --source include/restart_mysqld.inc
59
60 --disable_query_log
61 let $c = $trx;
62 disconnect con$c;
63 XA ROLLBACK 'x';
64 eval DROP TABLE t$c;
65 dec $c;
66 while ($c)
67 {
68 disconnect con$c;
69 eval DROP TABLE t$c;
70 dec $c;
71 }
72 --enable_query_log
73
74 DROP TABLE MDEV_29559;