Skip to content

Commit f162704

Browse files
committed
Rewrite the innodb.log_file_size test with DBUG_EXECUTE_IF.
Remove the debug parameter innodb_force_recovery_crash that was introduced into MySQL 5.6 by me in WL#6494 which allowed InnoDB to resize the redo log on startup. Let innodb.log_file_size actually start up the server, but ensure that the InnoDB storage engine refuses to start up in each of the scenarios.
1 parent 20e8347 commit f162704

File tree

12 files changed

+267
-258
lines changed

12 files changed

+267
-258
lines changed

mysql-test/suite/innodb/r/log_file_size.result

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,57 @@ INSERT INTO t1 VALUES (123);
1515
BEGIN;
1616
DELETE FROM t1;
1717
# Kill the server
18-
--innodb-force-recovery-crash=1
19-
--innodb-force-recovery-crash=3
20-
--innodb-force-recovery-crash=4
21-
--innodb-force-recovery-crash=5
22-
--innodb-force-recovery-crash=6
23-
--innodb-force-recovery-crash=7
24-
--innodb-force-recovery-crash=8
25-
--innodb-force-recovery-crash=9
26-
--innodb-force-recovery-crash=10
18+
SELECT * FROM t1;
19+
ERROR 42000: Unknown storage engine 'InnoDB'
20+
FOUND /syntax error in innodb_log_group_home_dir/ in mysqld.1.err
21+
SELECT * FROM t1;
22+
ERROR 42000: Unknown storage engine 'InnoDB'
23+
FOUND /InnoDB: Starting an apply batch of log records/ in mysqld.1.err
24+
SELECT * FROM t1;
25+
ERROR 42000: Unknown storage engine 'InnoDB'
26+
FOUND /InnoDB: Starting an apply batch of log records/ in mysqld.1.err
27+
SELECT * FROM t1;
28+
ERROR 42000: Unknown storage engine 'InnoDB'
29+
FOUND /InnoDB: innodb_read_only prevents crash recovery/ in mysqld.1.err
30+
SELECT * FROM t1;
31+
ERROR 42000: Unknown storage engine 'InnoDB'
32+
FOUND /InnoDB: Starting an apply batch of log records/ in mysqld.1.err
33+
FOUND /InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages/ in mysqld.1.err
34+
SELECT * FROM t1;
35+
ERROR 42000: Unknown storage engine 'InnoDB'
36+
FOUND /InnoDB: Starting an apply batch of log records/ in mysqld.1.err
37+
FOUND /InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages/ in mysqld.1.err
38+
SELECT * FROM t1;
39+
ERROR 42000: Unknown storage engine 'InnoDB'
40+
FOUND /InnoDB: innodb_read_only prevents crash recovery/ in mysqld.1.err
41+
SELECT * FROM t1;
42+
ERROR 42000: Unknown storage engine 'InnoDB'
43+
FOUND /InnoDB: Starting an apply batch of log records/ in mysqld.1.err
44+
FOUND /InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages/ in mysqld.1.err
45+
SELECT * FROM t1;
46+
ERROR 42000: Unknown storage engine 'InnoDB'
47+
SELECT * FROM t1;
48+
ERROR 42000: Unknown storage engine 'InnoDB'
49+
FOUND /InnoDB: Cannot create log files in read-only mode/ in mysqld.1.err
50+
SELECT * FROM t1;
51+
ERROR 42000: Unknown storage engine 'InnoDB'
52+
FOUND /InnoDB: Setting log file .*ib_logfile[0-9]+ size to/ in mysqld.1.err
53+
SELECT * FROM t1;
54+
ERROR 42000: Unknown storage engine 'InnoDB'
55+
FOUND /InnoDB: Setting log file .*ib_logfile[0-9]+ size to/ in mysqld.1.err
56+
SELECT * FROM t1;
57+
ERROR 42000: Unknown storage engine 'InnoDB'
58+
FOUND /InnoDB: Only one log file found/ in mysqld.1.err
59+
SELECT * FROM t1;
60+
ERROR 42000: Unknown storage engine 'InnoDB'
61+
FOUND /InnoDB: Log file .*ib_logfile0 size 7 is not a multiple of innodb_page_size/ in mysqld.1.err
62+
SELECT * FROM t1;
63+
ERROR 42000: Unknown storage engine 'InnoDB'
64+
FOUND /InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files/ in mysqld.1.err
65+
SELECT * FROM t1;
66+
ERROR 42000: Unknown storage engine 'InnoDB'
67+
FOUND /InnoDB: Setting log file .*ib_logfile[0-9]+ size to/ in mysqld.1.err
68+
FOUND /InnoDB: Renaming log file .*ib_logfile101 to .*ib_logfile0/ in mysqld.1.err
2769
SELECT * FROM t1;
2870
a
2971
42

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

Lines changed: 98 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
--source include/not_embedded.inc
77
# Avoid CrashReporter popup on Mac
88
--source include/not_crashrep.inc
9-
# innodb-force-recovery-crash needs debug
9+
# DBUG_EXECUTE_IF is needed
1010
--source include/have_debug.inc
1111

1212
if (`SELECT @@innodb_log_file_size = 1048576`) {
@@ -17,7 +17,22 @@ if (`SELECT @@innodb_log_file_size = 1048576`) {
1717
call mtr.add_suppression("InnoDB: Resizing redo log");
1818
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
1919
call mtr.add_suppression("InnoDB: New log files created");
20+
# This message is output by 10.0 and 10.1, not by 10.2
21+
call mtr.add_suppression("InnoDB: The log sequence number in the ibdata files is higher than the log sequence number in the ib_logfiles");
2022
call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles");
23+
call mtr.add_suppression("syntax error in innodb_log_group_home_dir");
24+
call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
25+
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
26+
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
27+
call mtr.add_suppression("InnoDB: innodb_read_only prevents crash recovery");
28+
call mtr.add_suppression("InnoDB: Are you sure you are using the right ib_logfiles");
29+
call mtr.add_suppression("InnoDB: Cannot create log files in read-only mode");
30+
call mtr.add_suppression("InnoDB: Only one log file found");
31+
call mtr.add_suppression("InnoDB: Log file .*ib_logfile[01].* size");
32+
call mtr.add_suppression("InnoDB: Unable to open .*ib_logfile0. to check native AIO read support");
33+
# InnoDB shutdown after refused startup is not clean in 10.0 or 10.1!
34+
call mtr.add_suppression("mysqld got signal 11");
35+
call mtr.add_suppression("Attempting backtrace");
2136
FLUSH TABLES;
2237
--enable_query_log
2338

@@ -42,118 +57,135 @@ SELECT * FROM t1;
4257
INSERT INTO t1 VALUES (123);
4358

4459
let MYSQLD_DATADIR= `select @@datadir`;
45-
let SEARCH_ABORT = NOT FOUND;
46-
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
47-
let $args=--innodb --unknown-option --loose-console --core-file > $SEARCH_FILE 2>&1;
48-
let $crash=--innodb --unknown-option --loose-console > $SEARCH_FILE 2>&1 --innodb-force-recovery-crash;
60+
let SEARCH_RANGE= -50000;
61+
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
4962

5063
BEGIN;
5164
DELETE FROM t1;
5265

5366
--source include/kill_mysqld.inc
5467

55-
--error 2
56-
--exec $MYSQLD_CMD $args --innodb-log-group-home-dir=foo\;bar
68+
--let $restart_parameters= --innodb-log-group-home-dir=foo\;bar
69+
--source include/start_mysqld.inc
70+
--error ER_UNKNOWN_STORAGE_ENGINE
71+
SELECT * FROM t1;
5772
let SEARCH_PATTERN= syntax error in innodb_log_group_home_dir;
5873
--source include/search_pattern_in_file.inc
59-
--remove_file $SEARCH_FILE
6074

61-
--echo --innodb-force-recovery-crash=1
62-
--error 3
63-
--exec $MYSQLD_CMD $crash=1
75+
--let $restart_parameters= --debug=d,innodb_log_abort_1
76+
--source include/restart_mysqld.inc
77+
--error ER_UNKNOWN_STORAGE_ENGINE
78+
SELECT * FROM t1;
6479
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
6580
--source include/search_pattern_in_file.inc
66-
--remove_file $SEARCH_FILE
67-
--echo --innodb-force-recovery-crash=3
68-
--error 3
69-
--exec $MYSQLD_CMD $crash=3
81+
82+
--let $restart_parameters= --debug=d,innodb_log_abort_3
83+
--source include/restart_mysqld.inc
84+
--error ER_UNKNOWN_STORAGE_ENGINE
85+
SELECT * FROM t1;
7086
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
7187
--source include/search_pattern_in_file.inc
72-
--remove_file $SEARCH_FILE
7388

74-
--error 2
75-
--exec $MYSQLD_CMD $args --innodb-read-only
89+
--let $restart_parameters= --innodb-read-only
90+
--source include/restart_mysqld.inc
91+
92+
--error ER_UNKNOWN_STORAGE_ENGINE
93+
SELECT * FROM t1;
7694
let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
7795
--source include/search_pattern_in_file.inc
78-
--remove_file $SEARCH_FILE
7996

80-
--echo --innodb-force-recovery-crash=4
81-
--error 3
82-
--exec $MYSQLD_CMD $crash=4
97+
--let $restart_parameters= --debug=d,innodb_log_abort_4
98+
--source include/restart_mysqld.inc
99+
--error ER_UNKNOWN_STORAGE_ENGINE
100+
SELECT * FROM t1;
83101
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
84102
--source include/search_pattern_in_file.inc
85103
let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
86104
--source include/search_pattern_in_file.inc
87-
--remove_file $SEARCH_FILE
88-
--echo --innodb-force-recovery-crash=5
89-
--error 3
90-
--exec $MYSQLD_CMD $crash=5
105+
106+
--let $restart_parameters= --debug=d,innodb_log_abort_5
107+
--source include/restart_mysqld.inc
108+
--error ER_UNKNOWN_STORAGE_ENGINE
109+
SELECT * FROM t1;
91110
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
92111
--source include/search_pattern_in_file.inc
93112
let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
94113
--source include/search_pattern_in_file.inc
95-
--remove_file $SEARCH_FILE
96114

97-
--error 2
98-
--exec $MYSQLD_CMD $args --innodb-read-only
115+
--let $restart_parameters= --innodb-read-only
116+
--source include/restart_mysqld.inc
117+
--error ER_UNKNOWN_STORAGE_ENGINE
118+
SELECT * FROM t1;
99119
let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
100120
--source include/search_pattern_in_file.inc
101-
--remove_file $SEARCH_FILE
102121

103-
--echo --innodb-force-recovery-crash=6
104-
--error 3
105-
--exec $MYSQLD_CMD $crash=6
122+
--let $restart_parameters= --debug=d,innodb_log_abort_6
123+
--source include/restart_mysqld.inc
124+
--error ER_UNKNOWN_STORAGE_ENGINE
125+
SELECT * FROM t1;
126+
106127
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
107128
--source include/search_pattern_in_file.inc
108129
let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
109130
--source include/search_pattern_in_file.inc
110-
--remove_file $SEARCH_FILE
111-
--echo --innodb-force-recovery-crash=7
112-
--error 3
113-
--exec $MYSQLD_CMD $crash=7
114-
# this crashes right after deleting all log files
115-
--remove_file $SEARCH_FILE
116131

117-
--error 2
118-
--exec $MYSQLD_CMD $args --innodb-read-only
132+
--let $restart_parameters= --debug=d,innodb_log_abort_7
133+
--source include/restart_mysqld.inc
134+
--error ER_UNKNOWN_STORAGE_ENGINE
135+
SELECT * FROM t1;
136+
137+
# this aborts right after deleting all log files
138+
139+
--let $restart_parameters= --innodb-read-only
140+
--source include/restart_mysqld.inc
141+
--error ER_UNKNOWN_STORAGE_ENGINE
142+
SELECT * FROM t1;
143+
119144
let SEARCH_PATTERN= InnoDB: Cannot create log files in read-only mode;
120145
--source include/search_pattern_in_file.inc
121-
--remove_file $SEARCH_FILE
122146

123-
--echo --innodb-force-recovery-crash=8
124-
--error 3
125-
--exec $MYSQLD_CMD $crash=8
147+
--let $restart_parameters= --debug=d,innodb_log_abort_8
148+
--source include/restart_mysqld.inc
149+
--error ER_UNKNOWN_STORAGE_ENGINE
150+
SELECT * FROM t1;
151+
126152
let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
127153
--source include/search_pattern_in_file.inc
128-
--remove_file $SEARCH_FILE
129-
--echo --innodb-force-recovery-crash=9
130-
--error 3
131-
--exec $MYSQLD_CMD $crash=9
154+
155+
--let $restart_parameters= --debug=d,innodb_log_abort_9
156+
--source include/restart_mysqld.inc
157+
--error ER_UNKNOWN_STORAGE_ENGINE
158+
SELECT * FROM t1;
159+
132160
let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
133161
--source include/search_pattern_in_file.inc
134-
--remove_file $SEARCH_FILE
162+
--source include/shutdown_mysqld.inc
135163

136164
# We should have perfectly synced files here.
137165
# Rename the log files, and trigger an error in recovery.
138166
--move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0
139167
--move_file $MYSQLD_DATADIR/ib_logfile1 $MYSQLD_DATADIR/ib_logfile1_hidden
140-
--error 2
141-
--exec $MYSQLD_CMD $args
168+
169+
--let $restart_parameters=
170+
--source include/start_mysqld.inc
171+
--error ER_UNKNOWN_STORAGE_ENGINE
172+
SELECT * FROM t1;
173+
142174
let SEARCH_PATTERN= InnoDB: Only one log file found;
143175
--source include/search_pattern_in_file.inc
144-
--remove_file $SEARCH_FILE
145176
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101
146177

147178
perl;
148179
die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/ib_logfile0");
149180
print FILE "garbage";
150181
close(FILE);
151182
EOF
152-
--error 2
153-
--exec $MYSQLD_CMD $args
183+
184+
--source include/restart_mysqld.inc
185+
--error ER_UNKNOWN_STORAGE_ENGINE
186+
SELECT * FROM t1;
154187
let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile0 size 7 is not a multiple of innodb_page_size;
155188
--source include/search_pattern_in_file.inc
156-
--remove_file $SEARCH_FILE
157189
--remove_file $MYSQLD_DATADIR/ib_logfile0
158190
--move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0
159191

@@ -163,26 +195,28 @@ print FILE "junkfill" x 131072;
163195
close(FILE);
164196
EOF
165197

166-
--error 2
167-
--exec $MYSQLD_CMD $args
198+
--source include/restart_mysqld.inc
199+
--error ER_UNKNOWN_STORAGE_ENGINE
200+
SELECT * FROM t1;
201+
168202
let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files;
169203
--source include/search_pattern_in_file.inc
170-
--remove_file $SEARCH_FILE
171204
--remove_file $MYSQLD_DATADIR/ib_logfile1
172205
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101
173206
--move_file $MYSQLD_DATADIR/ib_logfile1_hidden $MYSQLD_DATADIR/ib_logfile1
174207

175-
--echo --innodb-force-recovery-crash=10
176-
--error 3
177-
--exec $MYSQLD_CMD $crash=10
208+
--let $restart_parameters= --debug=d,innodb_log_abort_10
209+
--source include/restart_mysqld.inc
210+
--error ER_UNKNOWN_STORAGE_ENGINE
211+
SELECT * FROM t1;
212+
178213
let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
179214
--source include/search_pattern_in_file.inc
180215
let SEARCH_PATTERN= InnoDB: Renaming log file .*ib_logfile101 to .*ib_logfile0;
181216
--source include/search_pattern_in_file.inc
182-
--remove_file $SEARCH_FILE
183217

184218
--let $restart_parameters=
185-
--source include/start_mysqld.inc
219+
--source include/restart_mysqld.inc
186220

187221
SELECT * FROM t1;
188222
DROP TABLE t1;

mysql-test/suite/sys_vars/r/innodb_force_recovery_crash_basic.result

Lines changed: 0 additions & 33 deletions
This file was deleted.

mysql-test/suite/sys_vars/t/innodb_force_recovery_crash_basic.test

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)