Commit 2de0e42a authored by Marko Mäkelä's avatar Marko Mäkelä

Import and adjust the InnoDB redo log tests from MySQL 5.7.

parent 0f34160d
# 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
# 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
# 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
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
#
# 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;
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;
--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 (<IN>) { $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
--echo # Testcase for the following bugs
--echo # Bug#16691130 - ASSERT WHEN INNODB_LOG_GROUP_HOME_DIR DOES NOT EXIST
--echo # Bug#16418661 - CHANGING NAME IN FOR INNODB_DATA_FILE_PATH SHOULD NOT SUCCEED WITH LOG FILES
--source include/have_innodb.inc
let bugdir= $MYSQLTEST_VARDIR/tmp/log_file;
--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
--echo # Write tmp/log_file/my.cnf
perl;
die unless open IN, "<", "$ENV{MYSQLTEST_VARDIR}/my.cnf";
my $found;
while (<IN>) { $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
This diff is collapsed.
--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
--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;
......@@ -4462,12 +4462,6 @@ innobase_init(
}
*/
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_init(
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 */
......
......@@ -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 @@ innobase_start_or_create_for_mysql(void)
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));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment