File: innodb_bug-13628249.test

package info (click to toggle)
percona-xtrabackup 2.2.3-2.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 293,260 kB
  • ctags: 146,881
  • sloc: cpp: 1,051,960; ansic: 570,217; java: 54,595; perl: 53,495; pascal: 44,194; sh: 27,826; yacc: 15,314; python: 12,142; xml: 7,848; sql: 4,125; makefile: 1,459; awk: 785; lex: 758
file content (125 lines) | stat: -rw-r--r-- 4,046 bytes parent folder | download
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# This is the test case for bug#13628249. Make sure that InnoDB starts
# up correctly and is able to shutdown with --innodb-force-recovery >= 3
# after a crash with active user tranactions.

#
# Not supported in embedded
--source include/not_embedded.inc

#
# This test case needs to crash the server. Needs a debug server.
--source include/have_debug.inc
#
# Don't test this under valgrind, memory leaks will occur.
--source include/not_valgrind.inc
#
# This test case needs InnoDB.
-- source include/have_innodb.inc

# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc

call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'"mysql"."slave_master_info"\' in the cache');
call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'"mysql"."slave_relay_log_info"\' in the cache');
call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'"mysql"."slave_worker_info"\' in the cache');
call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'"test"."t1"\' in the cache');
call mtr.add_suppression('InnoDB: Allocated tablespace [0-9]+, old maximum was [0-9]+');

##### Restart the server in force recovery mode
--echo # Stop server

# Write file to make mysql-test-run.pl wait for the server to stop
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

# Request shutdown
-- send_shutdown

# Call script that will poll the server waiting for it to disapear
-- source include/wait_until_disconnected.inc

--echo # Restart server.

# Write file to make mysql-test-run.pl start up the server again, ensure
# that no background threads are started, so that we can check that it
# shuts down properly.
--exec echo "restart:--innodb-force-recovery=2" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

# Turn on reconnect
--enable_reconnect

# Call script that will poll the server waiting for it to be back online again
--source include/wait_until_connected_again.inc

# Turn off reconnect again
--disable_reconnect

##### Restart the server in normal mode
# Write file to make mysql-test-run.pl wait for the server to stop
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

# Send a shutdown request to the server
-- send_shutdown

# Call script that will poll the server waiting for it to disapear
-- source include/wait_until_disconnected.inc

--echo # Restart server.

# Write file to make mysql-test-run.pl start up the server again, ensure
# that no background threads are started, so that we can check that it
# shuts down properly.
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

# Turn on reconnect
--enable_reconnect

# Call script that will poll the server waiting for it to be back online again
--source include/wait_until_connected_again.inc

# Turn off reconnect again
--disable_reconnect


#
# Create test data.
#
CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
BEGIN;
INSERT INTO t1 VALUES(1), (2), (3), (4);

# Request a crash on next execution of commit.
SET SESSION debug="+d,crash_commit_before";

# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart:--innodb-force-recovery=3" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

# Execute the statement that causes the crash.
--error 2013
COMMIT;

--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect

SELECT COUNT(*) IN (0,4) yes FROM t1;

--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--send_shutdown
--source include/wait_until_disconnected.inc

--exec echo "restart:--innodb-force-recovery=5" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect

SELECT COUNT(*) IN (0,4) yes FROM t1;

# Restart the server in normal mode now, otherwise the DROP TABLE t1;
# will cause an assertion failure because essentially it is in read-only
# mode. For -innodb-force-recovery >= 3 a transaction is not assigned a
# rollback segment.
-- source include/restart_mysqld.inc

SELECT COUNT(*) IN (0,4) yes FROM t1;

DROP TABLE t1;