Skip to content

Commit

Permalink
Rewrite the innodb.log_file_size test with DBUG_EXECUTE_IF.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dr-m committed Feb 5, 2017
1 parent 20e8347 commit f162704
Show file tree
Hide file tree
Showing 12 changed files with 267 additions and 258 deletions.
60 changes: 51 additions & 9 deletions mysql-test/suite/innodb/r/log_file_size.result
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,57 @@ INSERT INTO t1 VALUES (123);
BEGIN;
DELETE FROM t1;
# Kill the server
--innodb-force-recovery-crash=1
--innodb-force-recovery-crash=3
--innodb-force-recovery-crash=4
--innodb-force-recovery-crash=5
--innodb-force-recovery-crash=6
--innodb-force-recovery-crash=7
--innodb-force-recovery-crash=8
--innodb-force-recovery-crash=9
--innodb-force-recovery-crash=10
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /syntax error in innodb_log_group_home_dir/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Starting an apply batch of log records/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Starting an apply batch of log records/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: innodb_read_only prevents crash recovery/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Starting an apply batch of log records/ in mysqld.1.err
FOUND /InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Starting an apply batch of log records/ in mysqld.1.err
FOUND /InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: innodb_read_only prevents crash recovery/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Starting an apply batch of log records/ in mysqld.1.err
FOUND /InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Cannot create log files in read-only mode/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Setting log file .*ib_logfile[0-9]+ size to/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Setting log file .*ib_logfile[0-9]+ size to/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Only one log file found/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Log file .*ib_logfile0 size 7 is not a multiple of innodb_page_size/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND /InnoDB: Setting log file .*ib_logfile[0-9]+ size to/ in mysqld.1.err
FOUND /InnoDB: Renaming log file .*ib_logfile101 to .*ib_logfile0/ in mysqld.1.err
SELECT * FROM t1;
a
42
Expand Down
162 changes: 98 additions & 64 deletions mysql-test/suite/innodb/t/log_file_size.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
--source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
# innodb-force-recovery-crash needs debug
# DBUG_EXECUTE_IF is needed
--source include/have_debug.inc

if (`SELECT @@innodb_log_file_size = 1048576`) {
Expand All @@ -17,7 +17,22 @@ if (`SELECT @@innodb_log_file_size = 1048576`) {
call mtr.add_suppression("InnoDB: Resizing redo log");
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
call mtr.add_suppression("InnoDB: New log files created");
# This message is output by 10.0 and 10.1, not by 10.2
call mtr.add_suppression("InnoDB: The log sequence number in the ibdata files is higher than the log sequence number in the ib_logfiles");
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");
call mtr.add_suppression("syntax error in innodb_log_group_home_dir");
call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("InnoDB: innodb_read_only prevents crash recovery");
call mtr.add_suppression("InnoDB: Are you sure you are using the right ib_logfiles");
call mtr.add_suppression("InnoDB: Cannot create log files in read-only mode");
call mtr.add_suppression("InnoDB: Only one log file found");
call mtr.add_suppression("InnoDB: Log file .*ib_logfile[01].* size");
call mtr.add_suppression("InnoDB: Unable to open .*ib_logfile0. to check native AIO read support");
# InnoDB shutdown after refused startup is not clean in 10.0 or 10.1!
call mtr.add_suppression("mysqld got signal 11");
call mtr.add_suppression("Attempting backtrace");
FLUSH TABLES;
--enable_query_log

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

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

BEGIN;
DELETE FROM t1;

--source include/kill_mysqld.inc

--error 2
--exec $MYSQLD_CMD $args --innodb-log-group-home-dir=foo\;bar
--let $restart_parameters= --innodb-log-group-home-dir=foo\;bar
--source include/start_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= syntax error in innodb_log_group_home_dir;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE

--echo --innodb-force-recovery-crash=1
--error 3
--exec $MYSQLD_CMD $crash=1
--let $restart_parameters= --debug=d,innodb_log_abort_1
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=3
--error 3
--exec $MYSQLD_CMD $crash=3

--let $restart_parameters= --debug=d,innodb_log_abort_3
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE

--error 2
--exec $MYSQLD_CMD $args --innodb-read-only
--let $restart_parameters= --innodb-read-only
--source include/restart_mysqld.inc

--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE

--echo --innodb-force-recovery-crash=4
--error 3
--exec $MYSQLD_CMD $crash=4
--let $restart_parameters= --debug=d,innodb_log_abort_4
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=5
--error 3
--exec $MYSQLD_CMD $crash=5

--let $restart_parameters= --debug=d,innodb_log_abort_5
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE

--error 2
--exec $MYSQLD_CMD $args --innodb-read-only
--let $restart_parameters= --innodb-read-only
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE

--echo --innodb-force-recovery-crash=6
--error 3
--exec $MYSQLD_CMD $crash=6
--let $restart_parameters= --debug=d,innodb_log_abort_6
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;

let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=7
--error 3
--exec $MYSQLD_CMD $crash=7
# this crashes right after deleting all log files
--remove_file $SEARCH_FILE

--error 2
--exec $MYSQLD_CMD $args --innodb-read-only
--let $restart_parameters= --debug=d,innodb_log_abort_7
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;

# this aborts right after deleting all log files

--let $restart_parameters= --innodb-read-only
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;

let SEARCH_PATTERN= InnoDB: Cannot create log files in read-only mode;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE

--echo --innodb-force-recovery-crash=8
--error 3
--exec $MYSQLD_CMD $crash=8
--let $restart_parameters= --debug=d,innodb_log_abort_8
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;

let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=9
--error 3
--exec $MYSQLD_CMD $crash=9

--let $restart_parameters= --debug=d,innodb_log_abort_9
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;

let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--source include/shutdown_mysqld.inc

# We should have perfectly synced files here.
# Rename the log files, and trigger an error in recovery.
--move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0
--move_file $MYSQLD_DATADIR/ib_logfile1 $MYSQLD_DATADIR/ib_logfile1_hidden
--error 2
--exec $MYSQLD_CMD $args

--let $restart_parameters=
--source include/start_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;

let SEARCH_PATTERN= InnoDB: Only one log file found;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101

perl;
die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/ib_logfile0");
print FILE "garbage";
close(FILE);
EOF
--error 2
--exec $MYSQLD_CMD $args

--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile0 size 7 is not a multiple of innodb_page_size;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--remove_file $MYSQLD_DATADIR/ib_logfile0
--move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0

Expand All @@ -163,26 +195,28 @@ print FILE "junkfill" x 131072;
close(FILE);
EOF

--error 2
--exec $MYSQLD_CMD $args
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;

let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--remove_file $MYSQLD_DATADIR/ib_logfile1
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101
--move_file $MYSQLD_DATADIR/ib_logfile1_hidden $MYSQLD_DATADIR/ib_logfile1

--echo --innodb-force-recovery-crash=10
--error 3
--exec $MYSQLD_CMD $crash=10
--let $restart_parameters= --debug=d,innodb_log_abort_10
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;

let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Renaming log file .*ib_logfile101 to .*ib_logfile0;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE

--let $restart_parameters=
--source include/start_mysqld.inc
--source include/restart_mysqld.inc

SELECT * FROM t1;
DROP TABLE t1;

This file was deleted.

28 changes: 0 additions & 28 deletions mysql-test/suite/sys_vars/t/innodb_force_recovery_crash_basic.test

This file was deleted.

Loading

0 comments on commit f162704

Please sign in to comment.