diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-04-17 15:26:17 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-04-17 15:26:17 +0300 |
commit | 250799f961b8f261ae2922382e2c69bca7c3b6fa (patch) | |
tree | 2ac2b7b9864254188d9ac426fc878e511224477d /mysql-test | |
parent | a2335b791aa06fbf4b784486ed9d34ba75af9d51 (diff) | |
parent | 169c00994b5c7d94576fea88b2e84a8833511e96 (diff) | |
download | mariadb-git-250799f961b8f261ae2922382e2c69bca7c3b6fa.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'mysql-test')
7 files changed, 173 insertions, 8 deletions
diff --git a/mysql-test/suite/encryption/r/corrupted_during_recovery.result b/mysql-test/suite/encryption/r/corrupted_during_recovery.result new file mode 100644 index 00000000000..41c0d7d75a8 --- /dev/null +++ b/mysql-test/suite/encryption/r/corrupted_during_recovery.result @@ -0,0 +1,22 @@ +CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB, ENCRYPTED=YES; +INSERT INTO t1 VALUES(1); +CREATE TABLE t2(a BIGINT PRIMARY KEY) ENGINE=InnoDB, ENCRYPTED=YES; +INSERT INTO t1 VALUES(2); +SET GLOBAL innodb_flush_log_at_trx_commit=1; +INSERT INTO t2 VALUES(2); +# Kill the server +# Corrupt the pages +SELECT * FROM t1; +ERROR 42000: Unknown storage engine 'InnoDB' +SELECT * FROM t1; +a +1 +2 +SELECT * FROM t2; +a +2 +CHECK TABLE t1,t2; +Table Op Msg_type Msg_text +test.t1 check status OK +test.t2 check status OK +DROP TABLE t1, t2; diff --git a/mysql-test/suite/encryption/t/corrupted_during_recovery.test b/mysql-test/suite/encryption/t/corrupted_during_recovery.test new file mode 100644 index 00000000000..5784d5775c6 --- /dev/null +++ b/mysql-test/suite/encryption/t/corrupted_during_recovery.test @@ -0,0 +1,60 @@ +--source include/have_innodb.inc +--source include/have_file_key_management_plugin.inc + +--disable_query_log +call mtr.add_suppression("InnoDB: Plugin initialization aborted"); +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: Database page corruption on disk or a failed file read of tablespace test/t1 page"); +call mtr.add_suppression("InnoDB: Failed to read file '.*test.t1\\.ibd' at offset 3: Table is encrypted but decrypt failed"); +call mtr.add_suppression("InnoDB: The page \\[page id: space=\\d+, page number=3\\] in file '.*test.t1\\.ibd' cannot be decrypted"); +call mtr.add_suppression("InnoDB: Table in tablespace \\d+ encrypted. However key management plugin or used key_version \\d+ is not found or used encryption algorithm or method does not match. Can't continue opening the table."); +--enable_query_log + +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; +CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB, ENCRYPTED=YES; +INSERT INTO t1 VALUES(1); +# Force a redo log checkpoint. +--source include/restart_mysqld.inc +--source ../../suite/innodb/include/no_checkpoint_start.inc +CREATE TABLE t2(a BIGINT PRIMARY KEY) ENGINE=InnoDB, ENCRYPTED=YES; +INSERT INTO t1 VALUES(2); +SET GLOBAL innodb_flush_log_at_trx_commit=1; +INSERT INTO t2 VALUES(2); + +--let CLEANUP_IF_CHECKPOINT=DROP TABLE t1,t2; +--source ../../suite/innodb/include/no_checkpoint_end.inc + +--echo # Corrupt the pages + +perl; +my $ps = $ENV{INNODB_PAGE_SIZE}; + +my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd"; +open(FILE, "+<$file") || die "Unable to open $file"; +binmode FILE; +seek (FILE, $ENV{INNODB_PAGE_SIZE} * 3, SEEK_SET) or die "seek"; +print FILE "junk"; +close FILE or die "close"; + +$file = "$ENV{MYSQLD_DATADIR}/test/t2.ibd"; +open(FILE, "+<$file") || die "Unable to open $file"; +binmode FILE; +# Corrupt pages 1 to 3. MLOG_INIT_FILE_PAGE2 should protect us! +# Unfortunately, we are not immune to page 0 corruption. +seek (FILE, $ps, SEEK_SET) or die "seek"; +print FILE chr(0xff) x ($ps * 3); +close FILE or die "close"; +EOF + +--source include/start_mysqld.inc +--error ER_UNKNOWN_STORAGE_ENGINE +SELECT * FROM t1; +let $restart_parameters=--innodb_force_recovery=1; +--source include/restart_mysqld.inc + +SELECT * FROM t1; +SELECT * FROM t2; +CHECK TABLE t1,t2; + +DROP TABLE t1, t2; diff --git a/mysql-test/suite/innodb/r/corrupted_during_recovery.result b/mysql-test/suite/innodb/r/corrupted_during_recovery.result new file mode 100644 index 00000000000..788f17e3284 --- /dev/null +++ b/mysql-test/suite/innodb/r/corrupted_during_recovery.result @@ -0,0 +1,22 @@ +CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +CREATE TABLE t2(a BIGINT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(2); +SET GLOBAL innodb_flush_log_at_trx_commit=1; +INSERT INTO t2 VALUES(1); +# Kill the server +# Corrupt the pages +SELECT * FROM t1; +ERROR 42000: Unknown storage engine 'InnoDB' +SELECT * FROM t1; +a +0 +2 +SELECT * FROM t2; +a +1 +CHECK TABLE t1,t2; +Table Op Msg_type Msg_text +test.t1 check status OK +test.t2 check status OK +DROP TABLE t1, t2; diff --git a/mysql-test/suite/innodb/r/log_alter_table.result b/mysql-test/suite/innodb/r/log_alter_table.result index a6f35543c04..9cb9ed77e33 100644 --- a/mysql-test/suite/innodb/r/log_alter_table.result +++ b/mysql-test/suite/innodb/r/log_alter_table.result @@ -7,11 +7,11 @@ # CREATE TABLE t1 (a INT NOT NULL, b INT UNIQUE) ENGINE=InnoDB; INSERT INTO t1 VALUES (1,2); -ALTER TABLE t1 ADD PRIMARY KEY(a), ALGORITHM=INPLACE; -ALTER TABLE t1 DROP INDEX b, ADD INDEX (b); +ALTER TABLE t1 ADD PRIMARY KEY(a), LOCK=SHARED, ALGORITHM=INPLACE; +ALTER TABLE t1 DROP INDEX b, ADD INDEX (b), LOCK=SHARED; # Kill the server -FOUND 1 /scan .*: multi-log rec MLOG_FILE_CREATE2.*page .*:0/ in mysqld.1.err -FOUND 1 /scan .*: log rec MLOG_INDEX_LOAD/ in mysqld.1.err +FOUND 2 /scan \d+: multi-log rec MLOG_FILE_CREATE2 len \d+ page \d+:0/ in mysqld.1.err +FOUND 3 /scan \d+: log rec MLOG_INDEX_LOAD/ in mysqld.1.err CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK diff --git a/mysql-test/suite/innodb/t/corrupted_during_recovery.opt b/mysql-test/suite/innodb/t/corrupted_during_recovery.opt new file mode 100644 index 00000000000..6051f4cd1fa --- /dev/null +++ b/mysql-test/suite/innodb/t/corrupted_during_recovery.opt @@ -0,0 +1 @@ +--innodb_doublewrite=0 diff --git a/mysql-test/suite/innodb/t/corrupted_during_recovery.test b/mysql-test/suite/innodb/t/corrupted_during_recovery.test new file mode 100644 index 00000000000..fbfb1bbe5d5 --- /dev/null +++ b/mysql-test/suite/innodb/t/corrupted_during_recovery.test @@ -0,0 +1,60 @@ +--source include/have_innodb.inc + +--disable_query_log +call mtr.add_suppression("InnoDB: Plugin initialization aborted"); +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: Database page corruption on disk or a failed file read of tablespace test/t1 page"); +call mtr.add_suppression("InnoDB: Failed to read file '.*test.t1\\.ibd' at offset 3: Page read from tablespace is corrupted."); +--enable_query_log + +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; +CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +# Force a redo log checkpoint. +--source include/restart_mysqld.inc +--source ../include/no_checkpoint_start.inc +CREATE TABLE t2(a BIGINT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(2); +SET GLOBAL innodb_flush_log_at_trx_commit=1; +INSERT INTO t2 VALUES(1); + +--let CLEANUP_IF_CHECKPOINT=DROP TABLE t1,t2; +--source ../include/no_checkpoint_end.inc + +--echo # Corrupt the pages + +perl; +my $ps = $ENV{INNODB_PAGE_SIZE}; + +my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd"; +open(FILE, "+<$file") || die "Unable to open $file"; +binmode FILE; +sysseek(FILE, 3*$ps, 0) || die "Unable to seek $file\n"; +die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps; +# Replace the a=1 with a=0. +$page =~ s/\x80\x0\x0\x0\x0\x0\x0\x1/\x80\x0\x0\x0\x0\x0\x0\x0/; +sysseek(FILE, 3*$ps, 0) || die "Unable to seek $file\n"; +syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n"; +close FILE or die "close"; + +$file = "$ENV{MYSQLD_DATADIR}/test/t2.ibd"; +open(FILE, "+<$file") || die "Unable to open $file"; +binmode FILE; +# Corrupt pages 1 to 3. MLOG_INIT_FILE_PAGE2 should protect us! +# Unfortunately, we are not immune to page 0 corruption. +seek (FILE, $ps, SEEK_SET) or die "seek"; +print FILE chr(0xff) x ($ps * 3); +close FILE or die "close"; +EOF + +--source include/start_mysqld.inc +--error ER_UNKNOWN_STORAGE_ENGINE +SELECT * FROM t1; +let $restart_parameters=--innodb_force_recovery=1; +--source include/restart_mysqld.inc +SELECT * FROM t1; +SELECT * FROM t2; +CHECK TABLE t1,t2; + +DROP TABLE t1, t2; diff --git a/mysql-test/suite/innodb/t/log_alter_table.test b/mysql-test/suite/innodb/t/log_alter_table.test index 6f12dfaf0b9..c92953f16a1 100644 --- a/mysql-test/suite/innodb/t/log_alter_table.test +++ b/mysql-test/suite/innodb/t/log_alter_table.test @@ -19,9 +19,9 @@ CREATE TABLE t1 (a INT NOT NULL, b INT UNIQUE) ENGINE=InnoDB; # MLOG_INDEX_LOAD will not be emitted for empty tables. Insert a row. INSERT INTO t1 VALUES (1,2); # We should get two MLOG_INDEX_LOAD for this. -ALTER TABLE t1 ADD PRIMARY KEY(a), ALGORITHM=INPLACE; +ALTER TABLE t1 ADD PRIMARY KEY(a), LOCK=SHARED, ALGORITHM=INPLACE; # And one MLOG_INDEX_LOAD for this. -ALTER TABLE t1 DROP INDEX b, ADD INDEX (b); +ALTER TABLE t1 DROP INDEX b, ADD INDEX (b), LOCK=SHARED; --let CLEANUP_IF_CHECKPOINT=DROP TABLE t1; --source include/no_checkpoint_end.inc @@ -32,10 +32,10 @@ ALTER TABLE t1 DROP INDEX b, ADD INDEX (b); let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err; let SEARCH_ABORT=NOT FOUND; # ensure that we have exactly 2 records there. -let SEARCH_PATTERN=scan .*: multi-log rec MLOG_FILE_CREATE2.*page .*:0; +let SEARCH_PATTERN=scan \d+: multi-log rec MLOG_FILE_CREATE2 len \d+ page \d+:0; --source include/search_pattern_in_file.inc # ensure that we have exactly 3 records there. -let SEARCH_PATTERN=scan .*: log rec MLOG_INDEX_LOAD; +let SEARCH_PATTERN=scan \d+: log rec MLOG_INDEX_LOAD; --source include/search_pattern_in_file.inc CHECK TABLE t1; |