From d3afdb1e8f0ab5d2d5257ee931fe5d4d2ed82ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 14 Mar 2019 10:15:50 +0200 Subject: [PATCH] Datafile::validate_first_page(): Change some ERROR to Note On startup, if the InnoDB doublewrite buffer can be used to recover a corrupted page, raising an ERROR about a recoverable error seems inappropriate. Issue Note instead, and adjust tests accordingly. Also, correctly validate the tablespace ID in the files. --- mysql-test/suite/innodb/r/doublewrite.result | 2 +- mysql-test/suite/innodb/r/log_file_name.result | 10 +++++----- mysql-test/suite/innodb/r/restart.result | 1 - mysql-test/suite/innodb/t/alter_kill.test | 2 -- mysql-test/suite/innodb/t/doublewrite.test | 4 +--- mysql-test/suite/innodb/t/log_file_name.test | 14 ++++++-------- mysql-test/suite/innodb/t/restart.test | 1 - storage/innobase/fsp/fsp0file.cc | 7 +++---- 8 files changed, 16 insertions(+), 25 deletions(-) diff --git a/mysql-test/suite/innodb/r/doublewrite.result b/mysql-test/suite/innodb/r/doublewrite.result index 61c81ee9dff..9a94a081abe 100644 --- a/mysql-test/suite/innodb/r/doublewrite.result +++ b/mysql-test/suite/innodb/r/doublewrite.result @@ -231,7 +231,7 @@ set global innodb_buf_flush_list_now = 1; check table t1; Table Op Msg_type Msg_text test.t1 check status OK -FOUND 1 /\[ERROR\] InnoDB: .*test.t1\.ibd.*/ in mysqld.1.err +FOUND 1 /InnoDB: .*test.t1\.ibd/ in mysqld.1.err select f1, f2 from t1; f1 f2 1 ############ diff --git a/mysql-test/suite/innodb/r/log_file_name.result b/mysql-test/suite/innodb/r/log_file_name.result index f578455f251..b81dd124e68 100644 --- a/mysql-test/suite/innodb/r/log_file_name.result +++ b/mysql-test/suite/innodb/r/log_file_name.result @@ -48,7 +48,7 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS -FOUND 1 /\[ERROR\] InnoDB: Cannot read first page of .*t2.ibd.*/ in mysqld.1.err +NOT FOUND /\[Note\] InnoDB: Cannot read first page of .*t2.ibd.*/ in mysqld.1.err FOUND 1 /\[ERROR\] InnoDB: Datafile .*t2.*\. Cannot determine the space ID from the first 64 pages.*/ in mysqld.1.err SELECT * FROM t2; a @@ -82,18 +82,18 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS -FOUND 1 /\[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*/ in mysqld.1.err +FOUND 1 /\[Note\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*/ in mysqld.1.err FOUND 1 /\[ERROR\] InnoDB: Datafile .*u1.*\. Cannot determine the space ID from the first 64 pages.*/ in mysqld.1.err -FOUND 1 /\[ERROR\] InnoDB: Cannot read first page of .*u2.ibd.*/ in mysqld.1.err +NOT FOUND /\[Note\] InnoDB: Cannot read first page of .*u2.ibd.*/ in mysqld.1.err # 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 -FOUND 1 /\[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*/ in mysqld.1.err +FOUND 1 /\[Note\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*/ in mysqld.1.err FOUND 1 /InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace.*/ in mysqld.1.err FOUND 1 /\[ERROR\] InnoDB: Cannot rename '.*u5.ibd' to '.*u6.ibd' for space ID \d+ because the target file exists.*/ in mysqld.1.err -FOUND 1 /\[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*/ in mysqld.1.err +FOUND 1 /\[Note\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*/ in mysqld.1.err FOUND 1 /InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace.*/ in mysqld.1.err FOUND 1 /\[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!.*/ in mysqld.1.err DROP TABLE u1,u2,u3,u6; diff --git a/mysql-test/suite/innodb/r/restart.result b/mysql-test/suite/innodb/r/restart.result index c70adac3a55..5e3315be204 100644 --- a/mysql-test/suite/innodb/r/restart.result +++ b/mysql-test/suite/innodb/r/restart.result @@ -5,7 +5,6 @@ # of tables with .isl file or DATA DIRECTORY attribute. call mtr.add_suppression("\\[ERROR\\] InnoDB: Invalid flags 0x7a207879 in .*td\\.ibd"); # FIXME: This is much more noisy than MariaDB 10.1! -call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot read first page in datafile: .*td\\.ibd, Space ID:2048948345, Flags: 2048948345"); call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number .* in a file operation\\."); call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot find the path specified\\."); call mtr.add_suppression("\\[ERROR\\] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them\\."); diff --git a/mysql-test/suite/innodb/t/alter_kill.test b/mysql-test/suite/innodb/t/alter_kill.test index 8150f990707..e0d785e412a 100644 --- a/mysql-test/suite/innodb/t/alter_kill.test +++ b/mysql-test/suite/innodb/t/alter_kill.test @@ -8,8 +8,6 @@ let PAGE_SIZE=`select @@innodb_page_size`; -- disable_query_log call mtr.add_suppression("InnoDB: innodb_force_recovery is on."); -call mtr.add_suppression("InnoDB: Header page contains inconsistent data in .*bug16720368.ibd"); -call mtr.add_suppression("InnoDB: Checksum mismatch in datafile:.*bug16720368"); call mtr.add_suppression("InnoDB: Ignoring tablespace for.*bug16720368"); call mtr.add_suppression("Found 1 prepared XA transactions"); call mtr.add_suppression("InnoDB: Operating system error.*in a file operation"); diff --git a/mysql-test/suite/innodb/t/doublewrite.test b/mysql-test/suite/innodb/t/doublewrite.test index bdeaba2dcec..3c87b108d6c 100644 --- a/mysql-test/suite/innodb/t/doublewrite.test +++ b/mysql-test/suite/innodb/t/doublewrite.test @@ -11,8 +11,6 @@ # Slow shutdown and restart to make sure ibuf merge is finished SET GLOBAL innodb_fast_shutdown = 0; --disable_query_log -call mtr.add_suppression("InnoDB: Header page consists of zero bytes"); -call mtr.add_suppression("InnoDB: Checksum mismatch in datafile: .*, Space ID:0, Flags: 0"); call mtr.add_suppression("InnoDB: Data file .* uses page size .* but the innodb_page_size start-up parameter is"); call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS"); call mtr.add_suppression("InnoDB: New log files created"); @@ -397,7 +395,7 @@ EOF --source include/start_mysqld.inc check table t1; ---let SEARCH_PATTERN= \[ERROR\] InnoDB: .*test.t1\\.ibd.* +--let SEARCH_PATTERN= InnoDB: .*test.t1\\.ibd --source include/search_pattern_in_file.inc select f1, f2 from t1; diff --git a/mysql-test/suite/innodb/t/log_file_name.test b/mysql-test/suite/innodb/t/log_file_name.test index 87c1681d443..df9f8664a64 100644 --- a/mysql-test/suite/innodb/t/log_file_name.test +++ b/mysql-test/suite/innodb/t/log_file_name.test @@ -107,7 +107,7 @@ let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t[12].ibd. eval $check_no_innodb; --source include/shutdown_mysqld.inc # On Windows, this error message is not output when t2.ibd is a directory! -#let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*t2.ibd; +#let SEARCH_PATTERN= \[Note\] InnoDB: Cannot read first page of .*t2.ibd; #--source include/search_pattern_in_file.inc --rmdir $MYSQLD_DATADIR/test/t2.ibd @@ -120,7 +120,7 @@ EOF eval $check_no_innodb; --source include/shutdown_mysqld.inc -let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*t2.ibd.*; +let SEARCH_PATTERN= \[Note\] InnoDB: Cannot read first page of .*t2.ibd.*; --source include/search_pattern_in_file.inc let SEARCH_PATTERN= \[ERROR\] InnoDB: Datafile .*t2.*\. Cannot determine the space ID from the first 64 pages.*; --source include/search_pattern_in_file.inc @@ -156,13 +156,11 @@ call mtr.add_suppression("InnoDB: Cannot open datafile for read-write: '.*t2\.ib 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: Log scan aborted at LSN"); # 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 size of the file .*u1\\.ibd is only 16384 bytes, should be at least 65536"); call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified"); call mtr.add_suppression("InnoDB: .*you must create directories"); @@ -216,7 +214,7 @@ EOF --source include/start_mysqld.inc eval $check_no_innodb; -let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*; +let SEARCH_PATTERN= \[Note\] 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.*; @@ -226,7 +224,7 @@ let SEARCH_PATTERN= \[ERROR\] InnoDB: Datafile .*u1.*\. Cannot determine the spa # 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.*; +let SEARCH_PATTERN= \[Note\] InnoDB: Cannot read first page of .*u2.ibd.*; --source include/search_pattern_in_file.inc --source include/shutdown_mysqld.inc @@ -241,7 +239,7 @@ let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*u2.ibd.*; --source include/start_mysqld.inc eval $check_no_innodb; -let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*; +let SEARCH_PATTERN= \[Note\] 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.*; @@ -254,7 +252,7 @@ let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot rename '.*u5.ibd' to '.*u6.ibd' for --source include/restart_mysqld.inc -let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*; +let SEARCH_PATTERN= \[Note\] 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.*; diff --git a/mysql-test/suite/innodb/t/restart.test b/mysql-test/suite/innodb/t/restart.test index 2fd7ca244e5..d7582306492 100644 --- a/mysql-test/suite/innodb/t/restart.test +++ b/mysql-test/suite/innodb/t/restart.test @@ -16,7 +16,6 @@ let page_size= `select @@innodb_page_size`; --echo # of tables with .isl file or DATA DIRECTORY attribute. call mtr.add_suppression("\\[ERROR\\] InnoDB: Invalid flags 0x7a207879 in .*td\\.ibd"); --echo # FIXME: This is much more noisy than MariaDB 10.1! -call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot read first page in datafile: .*td\\.ibd, Space ID:2048948345, Flags: 2048948345"); call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number .* in a file operation\\."); call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot find the path specified\\."); call mtr.add_suppression("\\[ERROR\\] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them\\."); diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc index 4a8874d0fa5..b707588e2da 100644 --- a/storage/innobase/fsp/fsp0file.cc +++ b/storage/innobase/fsp/fsp0file.cc @@ -513,9 +513,9 @@ Datafile::validate_first_page(lsn_t* flush_lsn) if (error_txt != NULL) { err_exit: - ib::error() << error_txt << " in datafile: " << m_filepath + ib::info() << error_txt << " in datafile: " << m_filepath << ", Space ID:" << m_space_id << ", Flags: " - << m_flags << ". " << TROUBLESHOOT_DATADICT_MSG; + << m_flags; m_is_valid = false; free_first_page(); return(DB_CORRUPTION); @@ -562,8 +562,7 @@ err_exit: goto err_exit; } - if (m_space_id == ULINT_UNDEFINED) { - /* The space_id can be most anything, except -1. */ + if (m_space_id >= SRV_LOG_SPACE_FIRST_ID) { error_txt = "A bad Space ID was found"; goto err_exit; }