From 2de0e42af577eb803278187e3b82a5bb17ac3b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 25 Jan 2017 15:11:46 +0200 Subject: [PATCH] Import and adjust the InnoDB redo log tests from MySQL 5.7. --- .../suite/innodb/include/log_file_cleanup.inc | 16 + .../suite/innodb/r/log_corruption.result | 19 + mysql-test/suite/innodb/r/log_file.result | 344 ++++++++++++++++++ .../suite/innodb/r/log_file_name.result | 77 ++++ .../suite/innodb/r/log_file_name_debug.result | 8 + .../innodb/r/log_file_size_checkpoint.result | 4 + mysql-test/suite/innodb/t/log_corruption.test | 148 ++++++++ mysql-test/suite/innodb/t/log_corruption.zip | Bin 0 -> 94694 bytes mysql-test/suite/innodb/t/log_corruption0.zip | Bin 0 -> 1211 bytes mysql-test/suite/innodb/t/log_corruption1.zip | Bin 0 -> 1257 bytes mysql-test/suite/innodb/t/log_corruption2.zip | Bin 0 -> 1304 bytes mysql-test/suite/innodb/t/log_corruption3.zip | Bin 0 -> 1304 bytes mysql-test/suite/innodb/t/log_corruption4.zip | Bin 0 -> 1308 bytes .../suite/innodb/t/log_corruption4a.zip | Bin 0 -> 1310 bytes mysql-test/suite/innodb/t/log_corruption5.zip | Bin 0 -> 1308 bytes mysql-test/suite/innodb/t/log_corruption6.zip | Bin 0 -> 1311 bytes mysql-test/suite/innodb/t/log_file.test | 261 +++++++++++++ mysql-test/suite/innodb/t/log_file_name.test | 268 ++++++++++++++ .../suite/innodb/t/log_file_name_debug.test | 31 ++ .../innodb/t/log_file_size_checkpoint.test | 32 ++ storage/innobase/handler/ha_innodb.cc | 10 +- storage/innobase/srv/srv0start.cc | 2 + 22 files changed, 1214 insertions(+), 6 deletions(-) create mode 100644 mysql-test/suite/innodb/include/log_file_cleanup.inc create mode 100644 mysql-test/suite/innodb/r/log_corruption.result create mode 100644 mysql-test/suite/innodb/r/log_file.result create mode 100644 mysql-test/suite/innodb/r/log_file_name.result create mode 100644 mysql-test/suite/innodb/r/log_file_name_debug.result create mode 100644 mysql-test/suite/innodb/r/log_file_size_checkpoint.result create mode 100644 mysql-test/suite/innodb/t/log_corruption.test create mode 100644 mysql-test/suite/innodb/t/log_corruption.zip create mode 100644 mysql-test/suite/innodb/t/log_corruption0.zip create mode 100644 mysql-test/suite/innodb/t/log_corruption1.zip create mode 100644 mysql-test/suite/innodb/t/log_corruption2.zip create mode 100644 mysql-test/suite/innodb/t/log_corruption3.zip create mode 100644 mysql-test/suite/innodb/t/log_corruption4.zip create mode 100644 mysql-test/suite/innodb/t/log_corruption4a.zip create mode 100644 mysql-test/suite/innodb/t/log_corruption5.zip create mode 100644 mysql-test/suite/innodb/t/log_corruption6.zip create mode 100644 mysql-test/suite/innodb/t/log_file.test create mode 100644 mysql-test/suite/innodb/t/log_file_name.test create mode 100644 mysql-test/suite/innodb/t/log_file_name_debug.test create mode 100644 mysql-test/suite/innodb/t/log_file_size_checkpoint.test diff --git a/mysql-test/suite/innodb/include/log_file_cleanup.inc b/mysql-test/suite/innodb/include/log_file_cleanup.inc new file mode 100644 index 00000000000..ef57d58b788 --- /dev/null +++ b/mysql-test/suite/innodb/include/log_file_cleanup.inc @@ -0,0 +1,16 @@ +# Remove ibtmp* which are re-generated after each mysqld invocation +# skip auto generated auto.cnf from list_files +--remove_files_wildcard $bugdir ibtmp* +--remove_files_wildcard $bugdir auto.cnf +--list_files $bugdir +--remove_files_wildcard $bugdir ibdata* +--remove_files_wildcard $bugdir ib_logfile* +--remove_files_wildcard $bugdir undo00* +--copy_file $bugdir/bak_ibdata1 $bugdir/ibdata1 +--copy_file $bugdir/bak_ibdata2 $bugdir/ibdata2 +--copy_file $bugdir/bak_ib_logfile0 $bugdir/ib_logfile0 +--copy_file $bugdir/bak_ib_logfile1 $bugdir/ib_logfile1 +--copy_file $bugdir/bak_ib_logfile2 $bugdir/ib_logfile2 +--copy_file $bugdir/bak_undo001 $bugdir/undo001 +--copy_file $bugdir/bak_undo002 $bugdir/undo002 +--copy_file $bugdir/bak_undo003 $bugdir/undo003 diff --git a/mysql-test/suite/innodb/r/log_corruption.result b/mysql-test/suite/innodb/r/log_corruption.result new file mode 100644 index 00000000000..64a8824189f --- /dev/null +++ b/mysql-test/suite/innodb/r/log_corruption.result @@ -0,0 +1,19 @@ +# redo log from before MySQL 5.7.9 +# redo log from before MySQL 5.7.9, with corrupted log checkpoint +# redo log from before MySQL 5.7.9, with corrupted log block +# redo log from "after" MySQL 5.7.9, but with invalid header checksum +# distant future redo log format, with valid header checksum +# valid header, but old-format checkpoint blocks +# valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block checksum +# --innodb-force-recovery=6 (skip the entire redo log) +# valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block number +# --innodb-force-recovery=6 (skip the entire redo log) +# Test a corrupted MLOG_FILE_NAME record. +# valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2 +# Test a corrupted MLOG_FILE_NAME record. +# valid header, invalid checkpoint 1, valid checkpoint 2 +ib_logfile0 +ib_logfile1 +ibdata1 +my.cnf +my_restart.err diff --git a/mysql-test/suite/innodb/r/log_file.result b/mysql-test/suite/innodb/r/log_file.result new file mode 100644 index 00000000000..a1ebdf037fa --- /dev/null +++ b/mysql-test/suite/innodb/r/log_file.result @@ -0,0 +1,344 @@ +# Testcase for the following bugs +# Bug#16691130 - ASSERT WHEN INNODB_LOG_GROUP_HOME_DIR DOES NOT EXIST +# Bug#16418661 - CHANGING NAME IN FOR INNODB_DATA_FILE_PATH SHOULD NOT SUCCEED WITH LOG FILES +# Write tmp/log_file/my.cnf +# Start mysqld without the possibility to create innodb_undo_tablespaces +# Remove undo001,undo002,ibdata1,ibdata2,ib_logfile1,ib_logfile2,ib_logfile101 +my.cnf +my_restart.err +# Start mysqld with non existent innodb_log_group_home_dir +# Remove ibdata1 & ibdata2 +my.cnf +my_restart.err +# Start mysqld to create tablespaces according to my.cnf +# Backup tmp/logfile/* +# 1. With ibdata2, Without ibdata1 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ib_logfile1 +ib_logfile2 +ibdata2 +my.cnf +my_restart.err +undo001 +undo002 +undo003 +# 2. With ibdata1, without ibdata2 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ib_logfile1 +ib_logfile2 +ibdata1 +ibdata2 +my.cnf +my_restart.err +undo001 +undo002 +undo003 +# 3. Without ibdata1 & ibdata2 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ib_logfile1 +ib_logfile2 +my.cnf +my_restart.err +undo001 +undo002 +undo003 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ib_logfile1 +ib_logfile2 +my.cnf +my_restart.err +undo001 +undo002 +undo003 +# 4. Without ibdata*, ib_logfile* and with undo00* +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +my.cnf +my_restart.err +undo001 +undo002 +undo003 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +my.cnf +my_restart.err +undo001 +undo002 +undo003 +# 5. Without ibdata*,ib_logfile* files & Without undo002 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +my.cnf +my_restart.err +undo001 +undo003 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +my.cnf +my_restart.err +undo001 +undo003 +# 6. Without ibdata*,ib_logfile* files & Without undo001, undo002 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +my.cnf +my_restart.err +undo003 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +my.cnf +my_restart.err +undo003 +# 7. With ibdata files & Without undo002 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ib_logfile1 +ib_logfile2 +ibdata1 +ibdata2 +my.cnf +my_restart.err +undo001 +undo003 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ib_logfile1 +ib_logfile2 +ibdata1 +ibdata2 +my.cnf +my_restart.err +undo001 +undo003 +# 8. With ibdata files & Without undo001, undo002 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ib_logfile1 +ib_logfile2 +ibdata1 +ibdata2 +my.cnf +my_restart.err +undo003 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ib_logfile1 +ib_logfile2 +ibdata1 +ibdata2 +my.cnf +my_restart.err +undo003 +# 9. Without ibdata*, without undo*, Without ib_logfile1 and with ib_logfile2 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ib_logfile2 +my.cnf +my_restart.err +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ib_logfile2 +my.cnf +my_restart.err +# 11. With ibdata*, without ib_logfile1 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ib_logfile2 +ibdata1 +ibdata2 +my.cnf +my_restart.err +undo001 +undo002 +undo003 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ib_logfile2 +ibdata1 +ibdata2 +my.cnf +my_restart.err +undo001 +undo002 +undo003 +# 12. With ibdata*, without ib_logfile2 +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ib_logfile1 +ibdata1 +ibdata2 +my.cnf +my_restart.err +undo001 +undo002 +undo003 +# Cleanup +bak_ib_logfile0 +bak_ib_logfile1 +bak_ib_logfile2 +bak_ibdata1 +bak_ibdata2 +bak_undo001 +bak_undo002 +bak_undo003 +ib_buffer_pool +ib_logfile0 +ib_logfile1 +ib_logfile2 +ibdata1 +ibdata2 +my.cnf +my_restart.err +undo001 +undo002 +undo003 diff --git a/mysql-test/suite/innodb/r/log_file_name.result b/mysql-test/suite/innodb/r/log_file_name.result new file mode 100644 index 00000000000..84107403cf2 --- /dev/null +++ b/mysql-test/suite/innodb/r/log_file_name.result @@ -0,0 +1,77 @@ +SET GLOBAL innodb_file_per_table=ON; +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t3(a INT PRIMARY KEY) ENGINE=InnoDB; +BEGIN; +INSERT INTO t3 VALUES (33101),(347); +INSERT INTO t1 VALUES (42),(9),(101); +RENAME TABLE t1 TO t2; +UPDATE t2 SET a=347 where a=42; +COMMIT; +# Kill the server +# Fault 0 (no real fault): Orphan file with duplicate space_id. +# Fault 1: Two dirty files with the same space_id. +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +# Fault 2: Wrong space_id in a dirty file, and a missing file. +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +# Fault 3: Wrong space_id in a dirty file, and no missing file. +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +# Fault 4: Missing data file +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +# Fault 5: Wrong type of data file +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +SELECT * FROM t2; +a +9 +101 +347 +SELECT * FROM t3; +a +347 +33101 +SHOW TABLES; +Tables_in_test +t2 +t3 +DROP TABLE t2,t3; +CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB; +ERROR HY000: Tablespace for table '`test`.`t0`' exists. Please DISCARD the tablespace before IMPORT +CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB; +DROP TABLE t0; +CREATE TABLE u1(a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE u2(a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE u3(a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE u4(a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO u4 VALUES(1); +RENAME TABLE u4 TO u5; +RENAME TABLE u5 TO u6; +INSERT INTO u6 VALUES(2); +# Kill the server +# Fault 6: All-zero data file and innodb_force_recovery +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +# Fault 7: Missing or wrong data file and innodb_force_recovery +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +DROP TABLE u1,u2,u3,u6; +# List of files: +SHOW TABLES; +Tables_in_test diff --git a/mysql-test/suite/innodb/r/log_file_name_debug.result b/mysql-test/suite/innodb/r/log_file_name_debug.result new file mode 100644 index 00000000000..e82feef870c --- /dev/null +++ b/mysql-test/suite/innodb/r/log_file_name_debug.result @@ -0,0 +1,8 @@ +# +# Bug#19685095 DO NOT CARE ABOUT UNRESOLVED MLOG_FILE_NAME +# IF THERE ARE NO OPERATIONS TO APPLY +# +SET GLOBAL DEBUG_DBUG='+d,fil_names_write_bogus'; +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; +# Kill the server +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/log_file_size_checkpoint.result b/mysql-test/suite/innodb/r/log_file_size_checkpoint.result new file mode 100644 index 00000000000..068b1368e1e --- /dev/null +++ b/mysql-test/suite/innodb/r/log_file_size_checkpoint.result @@ -0,0 +1,4 @@ +CREATE DATABASE logtest; +USE logtest; +# Kill and restart: --innodb-log-files-in-group=2 --innodb-log-file-size=4M --innodb-buffer-pool-size=50M +DROP DATABASE logtest; diff --git a/mysql-test/suite/innodb/t/log_corruption.test b/mysql-test/suite/innodb/t/log_corruption.test new file mode 100644 index 00000000000..725c8db6360 --- /dev/null +++ b/mysql-test/suite/innodb/t/log_corruption.test @@ -0,0 +1,148 @@ +--source include/have_innodb.inc +--source include/have_innodb_16k.inc + +let bugdir= $MYSQLTEST_VARDIR/tmp/log_corruption; +--mkdir $bugdir +--let SEARCH_RANGE = -50000 +--let SEARCH_FILE = $bugdir/my_restart.err +--let SEARCH_ABORT=NOT FOUND +--let $args=--defaults-file=$bugdir/my.cnf --loose-console >> $SEARCH_FILE 2>&1 + +perl; +die unless open IN, "<", "$ENV{MYSQLTEST_VARDIR}/my.cnf"; +my $found; +while () { $found=$1 if /^(lc-messages-dir=.*)/ } +close IN; + +die unless defined $found; +die unless open OUT, ">", "$ENV{bugdir}/my.cnf"; +print OUT "[mysqld] +$found +innodb_data_home_dir = $ENV{bugdir} +datadir = $ENV{bugdir} +secure_file_priv= +skip_aria +core_file +"; +EOF + +--echo # redo log from before MySQL 5.7.9 +--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption.zip -d $bugdir > $SEARCH_FILE +--error 1 +--exec $MYSQLD $args +let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported. This redo log was created before MySQL 5\\.7\\.9\\.; +--source include/search_pattern_in_file.inc + +--echo # redo log from before MySQL 5.7.9, with corrupted log checkpoint +--remove_file $bugdir/ib_logfile0 +--copy_file $bugdir/ib_logfile1 $bugdir/ib_logfile0 +--error 1 +--exec $MYSQLD $args +let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported. This redo log was created before MySQL 5\\.7\\.9, and we did not find a valid checkpoint; +--source include/search_pattern_in_file.inc + +--echo # redo log from before MySQL 5.7.9, with corrupted log block +--remove_file $bugdir/ib_logfile0 +--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption0.zip -d $bugdir > $SEARCH_FILE +--error 1 +--exec $MYSQLD $args +let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported. This redo log was created before MySQL 5\\.7\\.9, and it appears corrupted; +--source include/search_pattern_in_file.inc + +--echo # redo log from "after" MySQL 5.7.9, but with invalid header checksum +--remove_file $bugdir/ib_logfile0 +--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption1.zip -d $bugdir > $SEARCH_FILE +--error 1 +--exec $MYSQLD $args +let SEARCH_PATTERN=InnoDB: Invalid redo log header checksum; +--source include/search_pattern_in_file.inc + +--echo # distant future redo log format, with valid header checksum +--remove_file $bugdir/ib_logfile0 +--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption2.zip -d $bugdir > $SEARCH_FILE +--error 1 +--exec $MYSQLD $args +let SEARCH_PATTERN=InnoDB: Unsupported redo log format. The redo log was created with malicious intentions, or perhaps\. Please follow the instructions at http://dev.mysql.com/doc/refman/5.7/en/upgrading-downgrading.html; +--source include/search_pattern_in_file.inc + +--echo # valid header, but old-format checkpoint blocks +--remove_file $bugdir/ib_logfile0 +--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption3.zip -d $bugdir > $SEARCH_FILE +--error 1 +--exec $MYSQLD $args +let SEARCH_PATTERN=InnoDB: No valid checkpoint found .corrupted redo log; +--source include/search_pattern_in_file.inc + +--echo # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block checksum +--remove_file $bugdir/ib_logfile0 +--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption4.zip -d $bugdir > $SEARCH_FILE +# Anything below innodb_force_recovery=6 must find a valid redo log. +# Missing tablespace files are tolerated already with innodb_force_recovery=1. +--error 1 +--exec $MYSQLD $args --innodb-force-recovery=5 +let SEARCH_PATTERN=InnoDB: Log block 2372 at lsn 1213952 has valid header, but checksum field contains 144444122, should be 3362026715; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 1213964 and the end 1213952\.; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=Plugin 'InnoDB' registration as a STORAGE ENGINE failed; +--source include/search_pattern_in_file.inc +--echo # --innodb-force-recovery=6 (skip the entire redo log) +--error 1 +--exec $MYSQLD $args --innodb-force-recovery=6 +let SEARCH_PATTERN=InnoDB: Cannot create sys_virtual system tables. running in read-only mode; +--source include/search_pattern_in_file.inc + +--echo # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block number +--remove_file $bugdir/ib_logfile0 +--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption4a.zip -d $bugdir > $SEARCH_FILE +# Anything below innodb_force_recovery=6 must find a valid redo log. +# Missing tablespace files are tolerated already with innodb_force_recovery=1. +--error 1 +--exec $MYSQLD $args --innodb-force-recovery=5 +let SEARCH_PATTERN=InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 1213964 and the end 1213952\.; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=Plugin 'InnoDB' registration as a STORAGE ENGINE failed; +--source include/search_pattern_in_file.inc +--echo # --innodb-force-recovery=6 (skip the entire redo log) +--error 1 +--exec $MYSQLD $args --innodb-force-recovery=6 +let SEARCH_PATTERN=InnoDB: Cannot create sys_virtual system tables. running in read-only mode; +--source include/search_pattern_in_file.inc + +--echo # Test a corrupted MLOG_FILE_NAME record. +--echo # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2 +--remove_file $bugdir/ib_logfile0 +--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption5.zip -d $bugdir > $SEARCH_FILE +--error 1 +--exec $MYSQLD $args +let SEARCH_PATTERN=InnoDB: Log scan progressed past the checkpoint lsn 1213964; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=InnoDB: ############### CORRUPT LOG RECORD FOUND ##################; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=InnoDB: Log record type 55, page 151:488\. Log parsing proceeded successfully up to 1213973\. Previous log record type 56, is multi 0 Recv offset 9, prev 0; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN= len 22. hex 38000000000012860cb7809781e80006626f67757300. asc 8 bogus ; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=InnoDB: Set innodb_force_recovery to ignore this error; +--source include/search_pattern_in_file.inc + +--echo # Test a corrupted MLOG_FILE_NAME record. +--echo # valid header, invalid checkpoint 1, valid checkpoint 2 +--remove_file $bugdir/ib_logfile0 +--exec unzip $MYSQL_TEST_DIR/suite/innodb/t/log_corruption6.zip -d $bugdir > $SEARCH_FILE +--error 1 +--exec $MYSQLD $args +let SEARCH_PATTERN=InnoDB: ############### CORRUPT LOG RECORD FOUND ##################; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=InnoDB: Log record type 55, page 151:488\. Log parsing proceeded successfully up to 1213973\. Previous log record type 56, is multi 0 Recv offset 9, prev 0; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=InnoDB: Hex dump starting 0 bytes before and ending 13 bytes after the corrupted record; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN= len 22. hex 38000000000012860cb7809781e80006626f67757300. asc 8 bogus ; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=InnoDB: Set innodb_force_recovery to ignore this error; +--source include/search_pattern_in_file.inc + +--list_files $bugdir +--remove_files_wildcard $bugdir +--rmdir $bugdir diff --git a/mysql-test/suite/innodb/t/log_corruption.zip b/mysql-test/suite/innodb/t/log_corruption.zip new file mode 100644 index 0000000000000000000000000000000000000000..6f126c2edf0e70634b468b6bad53633e1a127d22 GIT binary patch literal 94694 zcmeI5c~n!^`uFX%b*L4r16XCKbwEWxMMTCp0arl~QBeYTI$~qG^t9nmj>+BoiZo2ynas^S!{f8K`TBF1xAztcniC5WSzl{Tdf=kOo@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eJ%MlW7k-q+0t_IX^Zx6tfd)VVkN_kA2|xmn03-kjKmw2eBmfCO0+0YC z00}?>kN_kA2|xmn03-kjKmw2eBmfCO0+7JQvFDehu>jW*x7GI{4@dwKfCL}`NB|Om z1Rw!O01|)%AOT1K5`Y9C0Z0H6fCL}`NB|Om1Rw!O01|)%AOT1K68Ntt@cZ1k|B?g) z>=fr*yYpXf4Kx4}fCL}`NB|Om1Rw!O01|)%AOT1K5`Y9C0Z0H6fCL}`NB|Om1Rw!O z01|)%AOT1K5`Y9+RFoD=VgcsykB(Del79M;9z_1x*r zpC{b!zQIiC!;Z}PGbFro={ETGQ^GBuCv0=A-21Y!caHv&yb=G6*nm1If&!_?-Oow9K4TgSY4Q@;U@aI9yyG za$$x;vPN&BNIpaH42M)9;~5A1k8n(yUf@@JTl(XQ%X6Oz{Ry6Xs$)@)?xTt)ai`X< zewHbJTk$*lf!otc-xb?~j2{J~Aut*OBPjcm8RGcw6B<1TGr!Lgwc#6l{20=!w- PKthZ_XbGfqz(o`QQjt1H literal 0 HcmV?d00001 diff --git a/mysql-test/suite/innodb/t/log_corruption1.zip b/mysql-test/suite/innodb/t/log_corruption1.zip new file mode 100644 index 0000000000000000000000000000000000000000..35a02adaa6db6c1805ea49cd1fbf974796af5f58 GIT binary patch literal 1257 zcmWIWW@Zs#U|`^2@K=;`*YZ4gw~z(MWe{NC29lXc@j3bFX_+~x25+x!@~ literal 0 HcmV?d00001 diff --git a/mysql-test/suite/innodb/t/log_corruption2.zip b/mysql-test/suite/innodb/t/log_corruption2.zip new file mode 100644 index 0000000000000000000000000000000000000000..4e4180ac4a31d7dd963241584c3becde4627b5fe GIT binary patch literal 1304 zcmWIWW@Zs#U|`^2Xi$}NU*Hg)wtxl5We{NC29lXc@j3bFX_+~x25+w#dNBtIG(6lm zQDdWL_GXSUxdY5kgr)^H>Al!D;qKe;ZjotbW^xCE1Z=w0H+*5K>^yiZE|T;9bsnFu z;l`HFW#Zks&+eERGhIA2>-C~FvofzvS-Hx;%S1oz^3SU&Vd9}#O=}D4e_Z+((Ia-a z+`Rqy)59NQ@5?gmU)#O6Q0C~bcgN4YOxs+?wEphnx9)G|EkC{O zoq4~#NyV-D_q!QEjvoc1Aut*OBPRqJ-fm$E@MdI^W5!*S!9rt0BZ!4mumyOtvVnvc MfzT32p9GhG04y7C1^@s6 literal 0 HcmV?d00001 diff --git a/mysql-test/suite/innodb/t/log_corruption3.zip b/mysql-test/suite/innodb/t/log_corruption3.zip new file mode 100644 index 0000000000000000000000000000000000000000..2337c81a80be9d91138f115b0996e0d55b3f1849 GIT binary patch literal 1304 zcmWIWW@Zs#U|`^2*rqJ!t~X=a*99y| z!;B3NS)_%n-r6>pZ`kDGR3Ln3{s!-UF`0(8W2bJ-Ybg#WWb*b`P}sQf`WnUerjvcX zh8hcA?9hLEGts83y;9$QveD`8Rq-K}TBlCy^llEU|8qfhYUIRK4>Z=S&x^0uxwSdW zWwWTf;O%_VrGKT%pReA2zVi9bcYF=^&3Z4--qG>*ZvU~biJR-0PQQHg($??Y<%FPX zvyaPX?VFSPDi7rLQ7{?;qaiSYLg0bLTZRB{MkYCC+(j8II5sqbSV#q1fHx}}NQe;# LErIk&aQO!Sz;kUU literal 0 HcmV?d00001 diff --git a/mysql-test/suite/innodb/t/log_corruption4.zip b/mysql-test/suite/innodb/t/log_corruption4.zip new file mode 100644 index 0000000000000000000000000000000000000000..86002d7d42a9bc013d7881798e051dfe28e734ea GIT binary patch literal 1308 zcmWIWW@Zs#U|`^2IHw}#-e0V3w1fr7We{NC29lXc@j3bFX_+~x25+w#`Y{CxG(22r zn6cp@i?p!SOIrqB)2XUbO0!?s9n!N6DqxV7*3PaL&KA~Bc*<$h8o1#T!xPC*wP*ME zd=3Asv`AF??$@$AJ?l@OHqw2yXw59ot5a64^6xg$Pn-O+#AbE3mg&K`iue6;|8;h~ zKKFj{-IEhO>(7ev98-ey23Z1EXLx1V%$(1cks2|N8;nj7)OOxQjDbXl!T%v5*S40B=?{ PkPssfS_0{_;4%;Z+WTw1 literal 0 HcmV?d00001 diff --git a/mysql-test/suite/innodb/t/log_corruption4a.zip b/mysql-test/suite/innodb/t/log_corruption4a.zip new file mode 100644 index 0000000000000000000000000000000000000000..6d072f3029fece328f659bfa7b1d2fe22d00a6a0 GIT binary patch literal 1310 zcmWIWW@Zs#U|`^2IF+m6K3i|!mt`zKE`tCAH;~LsiqFYUPs_|nHF$e{vTv_r?4dbMPZ-OmYh4~NgCGU^_ zd2Zhq|NESZR}O_$ZHEMm`JUzMKa+yQ!%fHXt#pv<;ZFa5fxx?S?UEj6)?0xkQRsa8d zkbQNy!dU6_1A;RShN6pV(zXb6m;5SX(pKERuiNsbwJfd&hW4UHfcQt=kx S&B_K6Vgy1h?+ literal 0 HcmV?d00001 diff --git a/mysql-test/suite/innodb/t/log_corruption5.zip b/mysql-test/suite/innodb/t/log_corruption5.zip new file mode 100644 index 0000000000000000000000000000000000000000..bbf0238efc993e3eae7d692c12013d3c8978b9ea GIT binary patch literal 1308 zcmWIWW@Zs#U|`^2c(GRA-Ti$5+Y%NamqCDm8%Sm*#pmRwr)B1(8oa$~=*JW&(C~1f z;jDzioMviem#P`0v$VZLnr6SSJEUhDRKOrzon0-QEo93uSNwyB+rd-J6Vgw7H~nmM zHU4aOM_5kDwA+Q|J9O8dHd)=hDa$Q1c-bmD?Mqu`^ei)P_KXc#$@%TjuIis((l17C ztCw$o%VYUJ=>LzeKVLsAnYcSy{NAp;q3_rf=2yzZ9`Ve1SNpnV_s^d!anJg{&o3;P zdTg^*zMSyjj^m OLX1FY38c@0%Rm6UUTix6 literal 0 HcmV?d00001 diff --git a/mysql-test/suite/innodb/t/log_corruption6.zip b/mysql-test/suite/innodb/t/log_corruption6.zip new file mode 100644 index 0000000000000000000000000000000000000000..04dd687e7c9324b6bcb6288deb939163ec9d3c09 GIT binary patch literal 1311 zcmWIWW@Zs#U|`^2=&sRlSI)m5vYZ9TWe{NC29lXc@j3bFX_+~x25&DL`Y{CxG(22r zIAaa3dV;5p?i(H5B@4E0PMNx5>hfy#Z0;3@?f $SEARCH_FILE 2>&1 + +--echo # Write tmp/log_file/my.cnf + +perl; +die unless open IN, "<", "$ENV{MYSQLTEST_VARDIR}/my.cnf"; +my $found; +while () { $found=$1 if /^(lc-messages-dir=.*)/ } +close IN; + +die unless defined $found; +die unless open OUT, ">", "$ENV{bugdir}/my.cnf"; +print OUT "[mysqld] +$found +innodb_data_home_dir = $ENV{bugdir} +datadir = $ENV{bugdir} +secure_file_priv= +skip_aria +#core_file # MDEV-11689 FIXME: add this back, and remove all ,134 below +innodb_data_file_path = ibdata1:10M;ibdata2:10M:autoextend +innodb_undo_logs = 20 +innodb_undo_tablespaces = 3 +innodb_log_files_in_group = 3 +"; +close(OUT); +EOF + +--echo # Start mysqld without the possibility to create innodb_undo_tablespaces +--mkdir $bugdir/undo002 +--error 1,134 +--exec $MYSQLD $args +let SEARCH_PATTERN=\[ERROR\] InnoDB: Could not create undo tablespace '.*undo002'; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=\[ERROR\] Aborting; +--source include/search_pattern_in_file.inc + +--echo # Remove undo001,undo002,ibdata1,ibdata2,ib_logfile1,ib_logfile2,ib_logfile101 +--remove_file $bugdir/undo001 +--rmdir $bugdir/undo002 +--remove_file $bugdir/ibdata1 +--remove_file $bugdir/ibdata2 +--remove_file $bugdir/ib_logfile1 +--remove_file $bugdir/ib_logfile2 +--remove_file $bugdir/ib_logfile101 +--list_files $bugdir + +--echo # Start mysqld with non existent innodb_log_group_home_dir +--error 1,134 +--exec $MYSQLD $args --innodb_log_group_home_dir=/path/to/non-existent/ +let SEARCH_PATTERN=File .path.to.non-existent.*ib_logfile101: 'create' returned OS error \d+; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=\[ERROR\] Aborting; +--source include/search_pattern_in_file.inc + +--echo # Remove ibdata1 & ibdata2 +--remove_file $bugdir/ibdata1 +--remove_file $bugdir/ibdata2 +--list_files $bugdir + +# Innodb creates system tablespaces according to my.cnf and aborts +# complaining about mysql.* tables. This is sufficient for testing +# missing tablespaces. +--echo # Start mysqld to create tablespaces according to my.cnf +--error 2,134 +--exec $MYSQLD $args --skip-grant-tables --innodb-unknown-parameter +let SEARCH_PATTERN=unknown option '--innodb-unknown-parameter'; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=\[ERROR\] Aborting; +--source include/search_pattern_in_file.inc + +--echo # Backup tmp/logfile/* +--copy_file $bugdir/ibdata1 $bugdir/bak_ibdata1 +--copy_file $bugdir/ibdata2 $bugdir/bak_ibdata2 +--copy_file $bugdir/ib_logfile0 $bugdir/bak_ib_logfile0 +--copy_file $bugdir/ib_logfile1 $bugdir/bak_ib_logfile1 +--copy_file $bugdir/ib_logfile2 $bugdir/bak_ib_logfile2 +--copy_file $bugdir/undo001 $bugdir/bak_undo001 +--copy_file $bugdir/undo002 $bugdir/bak_undo002 +--copy_file $bugdir/undo003 $bugdir/bak_undo003 + +--echo # 1. With ibdata2, Without ibdata1 +--remove_file $bugdir/ibdata1 +--error 1,134 +--exec $MYSQLD $args +let SEARCH_PATTERN=The innodb_system data file 'ibdata1' was not found but one of the other data files 'ibdata2' exists; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=\[ERROR\] Aborting; +--source include/search_pattern_in_file.inc + +# clean up & Restore +--source ../include/log_file_cleanup.inc + +--echo # 2. With ibdata1, without ibdata2 +--remove_file $bugdir/ibdata2 +--error 1,134 +--exec $MYSQLD $args +let SEARCH_PATTERN=Tablespace size stored in header is \d+ pages, but; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=\[ERROR\] Aborting; +--source include/search_pattern_in_file.inc + +# clean up & Restore +--source ../include/log_file_cleanup.inc + +--echo # 3. Without ibdata1 & ibdata2 +--remove_file $bugdir/ibdata1 +--remove_file $bugdir/ibdata2 +--list_files $bugdir +--error 1,134 +--exec $MYSQLD $args +let SEARCH_PATTERN=undo tablespace .*undo001.* exists\. Creating system tablespace with existing undo tablespaces is not supported\. Please delete all undo tablespaces before creating new system tablespace\.; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=\[ERROR\] Aborting; +--source include/search_pattern_in_file.inc + +# clean up & Restore +--source ../include/log_file_cleanup.inc + +--echo # 4. Without ibdata*, ib_logfile* and with undo00* +--remove_files_wildcard $bugdir ibdata* +--remove_files_wildcard $bugdir ib_logfile* +--list_files $bugdir +--error 1,134 +--exec $MYSQLD $args +let SEARCH_PATTERN=undo tablespace .*undo001.* exists\. Creating system tablespace with existing undo tablespaces is not supported\. Please delete all undo tablespaces before creating new system tablespace\.; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=\[ERROR\] Aborting; +--source include/search_pattern_in_file.inc + +# clean up & Restore +--source ../include/log_file_cleanup.inc + + +--echo # 5. Without ibdata*,ib_logfile* files & Without undo002 +--remove_files_wildcard $bugdir ibdata* +--remove_files_wildcard $bugdir ib_logfile* +--remove_file $bugdir/undo002 +--list_files $bugdir +--error 1,134 +--exec $MYSQLD $args +let SEARCH_PATTERN=undo tablespace .*undo001.* exists\. Creating system tablespace with existing undo tablespaces is not supported\. Please delete all undo tablespaces before creating new system tablespace\.; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=\[ERROR\] Aborting; +--source include/search_pattern_in_file.inc + +# clean up & Restore +--source ../include/log_file_cleanup.inc + +--echo # 6. Without ibdata*,ib_logfile* files & Without undo001, undo002 +# and with undo003 +--remove_files_wildcard $bugdir ibdata* +--remove_files_wildcard $bugdir ib_logfile* +--remove_file $bugdir/undo001 +--remove_file $bugdir/undo002 +--list_files $bugdir +--error 1,134 +--exec $MYSQLD $args +let SEARCH_PATTERN=undo tablespace .*undo003.* exists\. Creating system tablespace with existing undo tablespaces is not supported\. Please delete all undo tablespaces before creating new system tablespace\.; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=\[ERROR\] Aborting; +--source include/search_pattern_in_file.inc + +# clean up & Restore +--source ../include/log_file_cleanup.inc + +--echo # 7. With ibdata files & Without undo002 +--remove_file $bugdir/undo002 +--list_files $bugdir +--error 1,134 +--exec $MYSQLD $args +let SEARCH_PATTERN=Expected to open 3 undo tablespaces but was able; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=to find only 1 undo tablespaces; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=\[ERROR\] Aborting; +--source include/search_pattern_in_file.inc +# clean up & Restore +--source ../include/log_file_cleanup.inc + +--echo # 8. With ibdata files & Without undo001, undo002 +--remove_file $bugdir/undo001 +--remove_file $bugdir/undo002 +--list_files $bugdir +--error 1,134 +--exec $MYSQLD $args +let SEARCH_PATTERN=Expected to open 3 undo tablespaces but was able; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=to find only 0 undo tablespaces; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=\[ERROR\] Aborting; +--source include/search_pattern_in_file.inc + +# clean up & Restore +--source ../include/log_file_cleanup.inc + +--echo # 9. Without ibdata*, without undo*, Without ib_logfile1 and with ib_logfile2 +--remove_files_wildcard $bugdir ibdata* +--remove_files_wildcard $bugdir undo00* +--remove_file $bugdir/ib_logfile1 +--list_files $bugdir +--error 1,134 +--exec $MYSQLD $args +let SEARCH_PATTERN=redo log file .*ib_logfile0.* exists\. Creating system tablespace with existing redo log files is not recommended\. Please delete all redo log files before creating new system tablespace\.; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=\[ERROR\] Aborting; +--source include/search_pattern_in_file.inc + +# clean up & Restore +--source ../include/log_file_cleanup.inc + +# 10. With ibdata*, without ib_logfile0 +#--remove_file $bugdir/ib_logfile0 +# The below would start the server. Since we cannot start a parallel +# server, do not test the below case +#--error 1,134 +#--exec $MYSQLD $args + +# clean up & Restore +#--source ../include/log_file_cleanup.inc + +--echo # 11. With ibdata*, without ib_logfile1 +--remove_file $bugdir/ib_logfile1 +--list_files $bugdir +--error 1,134 +--exec $MYSQLD $args +let SEARCH_PATTERN=Only one log file found; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=\[ERROR\] Aborting; +--source include/search_pattern_in_file.inc + +# clean up & Restore +--source ../include/log_file_cleanup.inc + +--echo # 12. With ibdata*, without ib_logfile2 +--remove_file $bugdir/ib_logfile2 +--list_files $bugdir +--error 1,134 +--exec $MYSQLD $args +let SEARCH_PATTERN=Resizing redo log from \d+\*\d+ to \d+\*\d+ pages, LSN=\d+; +--source include/search_pattern_in_file.inc + +--echo # Cleanup +# Remove ibtmp* which are re-generated after each mysqld invocation +# skip auto generated auto.cnf from list_files +--remove_files_wildcard $bugdir auto.cnf +--remove_files_wildcard $bugdir ibtmp* +--list_files $bugdir +--remove_files_wildcard $bugdir +--rmdir $bugdir diff --git a/mysql-test/suite/innodb/t/log_file_name.test b/mysql-test/suite/innodb/t/log_file_name.test new file mode 100644 index 00000000000..c55005c0e58 --- /dev/null +++ b/mysql-test/suite/innodb/t/log_file_name.test @@ -0,0 +1,268 @@ +# WL#7142 InnoDB: Simplify tablespace discovery during crash recovery +# Test the detection of duplicate tablespaces. + +--source include/have_innodb.inc + +# Embedded server does not support crashing +--source include/not_embedded.inc + +SET GLOBAL innodb_file_per_table=ON; + +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; + +--source include/no_checkpoint_start.inc +CREATE TABLE t3(a INT PRIMARY KEY) ENGINE=InnoDB; + +BEGIN; +INSERT INTO t3 VALUES (33101),(347); +INSERT INTO t1 VALUES (42),(9),(101); +RENAME TABLE t1 TO t2; +UPDATE t2 SET a=347 where a=42; +COMMIT; + +--let CLEANUP_IF_CHECKPOINT=DROP TABLE t2,t3; +--source include/no_checkpoint_end.inc + +--echo # Fault 0 (no real fault): Orphan file with duplicate space_id. +--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t0.ibd + +--echo # Fault 1: Two dirty files with the same space_id. +--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t1.ibd + +let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; +let SEARCH_RANGE= -50000; +let SEARCH_ABORT= NOT FOUND; +let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); + +# This could fail to refuse InnoDB startup, in case there was a log +# checkpoint after the INSERT. That is what we checked above. +--source include/start_mysqld.inc +eval $check_no_innodb; +let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t2.ibd' with space ID \d+. Another data file called .*t1.ibd exists with the same space ID; +--source include/search_pattern_in_file.inc + +--source include/shutdown_mysqld.inc + +--remove_file $MYSQLD_DATADIR/test/t1.ibd +--remove_file $SEARCH_FILE + +# This could fail to refuse InnoDB startup, in case there was a log +# checkpoint after the CREATE TABLE t3. That is what we checked above. +--echo # Fault 2: Wrong space_id in a dirty file, and a missing file. +--move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t1.ibd + +--source include/start_mysqld.inc +eval $check_no_innodb; + +let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t1.ibd' with space ID; +--source include/search_pattern_in_file.inc + +let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at.*t3.ibd; +--source include/search_pattern_in_file.inc + +--source include/shutdown_mysqld.inc + +--move_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t3.ibd + +--echo # Fault 3: Wrong space_id in a dirty file, and no missing file. +# Swap t2.ibd and t3.ibd. +--move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t.ibd +--move_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t3.ibd +--move_file $MYSQLD_DATADIR/test/t.ibd $MYSQLD_DATADIR/test/t2.ibd + +--source include/start_mysqld.inc +eval $check_no_innodb; + +let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t[23].ibd' with space ID; +--source include/search_pattern_in_file.inc + +let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t1.ibd; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t3.ibd; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN= InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace; +--source include/search_pattern_in_file.inc + +--source include/shutdown_mysqld.inc + +# Swap back t3.ibd, but hide t2.ibd (which the redo log also knows as t1.ibd). +--move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t.ibd +--move_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t3.ibd + +--echo # Fault 4: Missing data file + +--source include/start_mysqld.inc +eval $check_no_innodb; + +let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t[12].ibd. +.*InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace; +--source include/search_pattern_in_file.inc + +--source include/shutdown_mysqld.inc + +--echo # Fault 5: Wrong type of data file + +# TODO: Test the following as well once +# Bug#18131883 IMPROVE INNODB ERROR MESSAGES REGARDING FILES +# has been fixed: +# A file containing 16384 zero bytes. +# --mkdir $MYSQLD_DATADIR/test/t2.ibd + +# Create a short file. +--exec echo "" > $MYSQLD_DATADIR/test/t2.ibd + +--source include/start_mysqld.inc +eval $check_no_innodb; + +let SEARCH_PATTERN= \[ERROR\] InnoDB: Datafile .*t2.*\. Cannot determine the space ID from the first 64 pages; +--source include/search_pattern_in_file.inc + +--source include/shutdown_mysqld.inc + +# Restore t2.ibd +--remove_file $MYSQLD_DATADIR/test/t2.ibd +--move_file $MYSQLD_DATADIR/test/t.ibd $MYSQLD_DATADIR/test/t2.ibd + +--source include/start_mysqld.inc + +SELECT * FROM t2; +SELECT * FROM t3; +SHOW TABLES; +DROP TABLE t2,t3; + +--error ER_TABLESPACE_EXISTS +CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB; + +# Remove the orphan file from fault 0. +--remove_file $MYSQLD_DATADIR/test/t0.ibd + +CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB; +DROP TABLE t0; + +--disable_query_log +# The following are for the orphan file t0.ibd: +call mtr.add_suppression("InnoDB: Operating system error number [0-9]* in a file operation"); +call mtr.add_suppression("InnoDB: Error number [0-9]* means 'File exists'"); +call mtr.add_suppression("InnoDB: Cannot create file '.*t0.ibd'"); +call mtr.add_suppression("InnoDB: The file '.*t0\.ibd' already exists"); +# The following are for aborted startup without --innodb-force-recovery: +call mtr.add_suppression("InnoDB: Tablespace .* was not found at .*test"); +call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace"); +call mtr.add_suppression("InnoDB: Cannot read first page of '.*test.[tu]2.ibd' I/O error"); +call mtr.add_suppression("InnoDB: Cannot read first page in datafile: .*test.*ibd"); +call mtr.add_suppression("InnoDB: Datafile './test/.*ibd' is corrupted"); +call mtr.add_suppression("InnoDB: Cannot replay file rename. Remove either file and try again"); +call mtr.add_suppression("InnoDB: Cannot rename.*because the target file exists"); +call mtr.add_suppression("InnoDB: Found corrupted log"); +# The following are for the --innodb-force-recovery=1 with broken u* tables: +call mtr.add_suppression("InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd"); +call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified"); +call mtr.add_suppression("InnoDB: .*you must create directories"); +call mtr.add_suppression("InnoDB: Cannot open datafile for read-only: '.*u[1-5]\.ibd'"); +call mtr.add_suppression("InnoDB: Could not find a valid tablespace file for `test/u[1-5]`"); +call mtr.add_suppression("InnoDB: Ignoring tablespace for `test`.`u[1-3]` because it could not be opened."); +call mtr.add_suppression("InnoDB: Failed to find tablespace for table .* in the cache. Attempting to load the tablespace with space id"); +call mtr.add_suppression("InnoDB: Plugin initialization aborted"); +call mtr.add_suppression("Plugin 'InnoDB' \(init function returned error\|registration as a STORAGE ENGINE failed\)"); +FLUSH TABLES; +--enable_query_log + +--source include/no_checkpoint_start.inc + +CREATE TABLE u1(a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE u2(a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE u3(a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE u4(a INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO u4 VALUES(1); +RENAME TABLE u4 TO u5; +RENAME TABLE u5 TO u6; +INSERT INTO u6 VALUES(2); + +--let CLEANUP_IF_CHECKPOINT=DROP TABLE u1,u2,u3,u6; +--source include/no_checkpoint_end.inc + +--echo # Fault 6: All-zero data file and innodb_force_recovery + +--remove_file $MYSQLD_DATADIR/test/u1.ibd +--remove_file $MYSQLD_DATADIR/test/u2.ibd +--remove_file $MYSQLD_DATADIR/test/u3.ibd + +# InnoDB: Header page consists of zero bytes +perl; +die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/test/u1.ibd"); +print FILE "\0" x 16384; +close(FILE); +EOF + +--exec echo "" > $MYSQLD_DATADIR/test/u2.ibd + +# TODO: Test with this, once +# Bug#18131883 IMPROVE INNODB ERROR MESSAGES REGARDING FILES +# has been fixed: +#--mkdir $MYSQLD_DATADIR/test/u3.ibd + +--copy_file $MYSQLD_DATADIR/test/u6.ibd $MYSQLD_DATADIR/test/u4.ibd + +--let $restart_parameters= --innodb-force-recovery=1 +--source include/start_mysqld.inc +eval $check_no_innodb; + +let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd; +--source include/search_pattern_in_file.inc + +let SEARCH_PATTERN= \[ERROR\] InnoDB: Datafile .*u1.*\. Cannot determine the space ID from the first 64 pages; +--source include/search_pattern_in_file.inc + +# TODO: These errors should state the file name (u2.ibd) and be ignored +# in innodb-force-recovery mode once +# Bug#18131883 IMPROVE INNODB ERROR MESSAGES REGARDING FILES +# has been fixed: +let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*u2.ibd.*; +--source include/search_pattern_in_file.inc + +--source include/shutdown_mysqld.inc + +# Allow --innodb-force-recovery to start despite the broken file. +# TODO: Remove this workaround, and make --innodb-force-recovery=1 +# ignore the broken file. +--remove_file $MYSQLD_DATADIR/test/u2.ibd + +--echo # Fault 7: Missing or wrong data file and innodb_force_recovery + +--source include/start_mysqld.inc +eval $check_no_innodb; + +let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd; +--source include/search_pattern_in_file.inc + +let SEARCH_PATTERN= InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace; +--source include/search_pattern_in_file.inc + +let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot rename '.*u5.ibd' to '.*u6.ibd' for space ID \d+ because the target file exists; +--source include/search_pattern_in_file.inc + +--remove_file $MYSQLD_DATADIR/test/u6.ibd + +--source include/restart_mysqld.inc + +let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd; +--source include/search_pattern_in_file.inc + +let SEARCH_PATTERN= InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace; +--source include/search_pattern_in_file.inc + +let SEARCH_PATTERN= \[Warning\] InnoDB: Tablespace \d+ was not found at .*u[1-5].ibd, and innodb_force_recovery was set. All redo log for this tablespace will be ignored!; +--source include/search_pattern_in_file.inc + +--let $restart_parameters= +--source include/restart_mysqld.inc + +DROP TABLE u1,u2,u3,u6; + +--remove_file $MYSQLD_DATADIR/test/u1.ibd +--echo # List of files: +--list_files $MYSQLD_DATADIR/test + +SHOW TABLES; diff --git a/mysql-test/suite/innodb/t/log_file_name_debug.test b/mysql-test/suite/innodb/t/log_file_name_debug.test new file mode 100644 index 00000000000..41d7ec2e53e --- /dev/null +++ b/mysql-test/suite/innodb/t/log_file_name_debug.test @@ -0,0 +1,31 @@ +--source include/have_innodb.inc +# Embedded server does not support restarting +--source include/not_embedded.inc +--source include/have_debug.inc + +--echo # +--echo # Bug#19685095 DO NOT CARE ABOUT UNRESOLVED MLOG_FILE_NAME +--echo # IF THERE ARE NO OPERATIONS TO APPLY +--echo # + +SET GLOBAL DEBUG_DBUG='+d,fil_names_write_bogus'; +--disable_query_log +FLUSH TABLES; +--enable_query_log + +--source include/no_checkpoint_start.inc + +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; + +--let CLEANUP_IF_CHECKPOINT=DROP TABLE t1; +--source include/no_checkpoint_end.inc + +--source include/start_mysqld.inc + +DROP TABLE t1; + +--let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err +--let SEARCH_PATTERN = InnoDB: Tablespace 4294967280 was not found at .*, but there were no modifications either +--let SEARCH_ABORT = NOT FOUND +--let SEARCH_RANGE = -50000 +--source include/search_pattern_in_file.inc diff --git a/mysql-test/suite/innodb/t/log_file_size_checkpoint.test b/mysql-test/suite/innodb/t/log_file_size_checkpoint.test new file mode 100644 index 00000000000..26e0bdf5e2c --- /dev/null +++ b/mysql-test/suite/innodb/t/log_file_size_checkpoint.test @@ -0,0 +1,32 @@ +--source include/have_innodb.inc +--source include/not_embedded.inc +--source include/no_valgrind_without_big.inc + +CREATE DATABASE logtest; +USE logtest; +let $n=250; +let $t=veryLongTableNameToCreateMLOG_FILE_NAMErecords; + +--disable_query_log +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"); +FLUSH TABLES; + +let $i=$n; +while ($i) +{ +--eval CREATE TABLE $t$i(a INT PRIMARY KEY) ENGINE=InnoDB; +dec $i; +} + +# If we set above n to 500, this test case could fail easily, because +# the inndob buffer pool is too small, some of which would be occupied +# by the recv*. With n=250, this test case could sporadically fail too. +# So we have to set buffer pool size to 50M which should be enough for this +# test case. Once we fix the bug#22179133 and bug#22186325, we should use +# the default innodb buffer pool(or the smaller one). +let $restart_parameters = --innodb-log-files-in-group=2 --innodb-log-file-size=4M --innodb-buffer-pool-size=50M; +--source include/kill_and_restart_mysqld.inc + +DROP DATABASE logtest; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 5ed02a92e0e..b869f2d1307 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4462,12 +4462,6 @@ innobase_change_buffering_inited_ok: } */ - if (!srv_read_only_mode) { - mysql_thread_create(thd_destructor_thread_key, - &thd_destructor_thread, - NULL, thd_destructor_proxy, NULL); - } - /* Since we in this module access directly the fields of a trx struct, and due to different headers and flags it might happen that ib_mutex_t has a different size in this module and in InnoDB @@ -4489,6 +4483,10 @@ innobase_change_buffering_inited_ok: if (err != DB_SUCCESS) { DBUG_RETURN(innobase_init_abort()); + } else if (!srv_read_only_mode) { + mysql_thread_create(thd_destructor_thread_key, + &thd_destructor_thread, + NULL, thd_destructor_proxy, NULL); } /* Adjust the innodb_undo_logs config object */ diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 3403534d36b..587ffc15adb 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1299,6 +1299,7 @@ srv_shutdown_all_bg_threads() @param[in] line Line number @param[in] err Reason for aborting InnoDB startup @return DB_SUCCESS or error code. */ +MY_ATTRIBUTE((warn_unused_result, nonnull)) static dberr_t srv_init_abort_low( @@ -2411,6 +2412,7 @@ files_checked: if (err != DB_SUCCESS) { return(srv_init_abort(err)); } + /* Create the doublewrite buffer to a new tablespace */ if (buf_dblwr == NULL && !buf_dblwr_create()) { return(srv_init_abort(DB_ERROR));