Skip to content

Commit d3afdb1

Browse files
committed
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.
1 parent e63f621 commit d3afdb1

File tree

8 files changed

+16
-25
lines changed

8 files changed

+16
-25
lines changed

mysql-test/suite/innodb/r/doublewrite.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ set global innodb_buf_flush_list_now = 1;
231231
check table t1;
232232
Table Op Msg_type Msg_text
233233
test.t1 check status OK
234-
FOUND 1 /\[ERROR\] InnoDB: .*test.t1\.ibd.*/ in mysqld.1.err
234+
FOUND 1 /InnoDB: .*test.t1\.ibd/ in mysqld.1.err
235235
select f1, f2 from t1;
236236
f1 f2
237237
1 ############

mysql-test/suite/innodb/r/log_file_name.result

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES
4848
WHERE engine = 'innodb'
4949
AND support IN ('YES', 'DEFAULT', 'ENABLED');
5050
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
51-
FOUND 1 /\[ERROR\] InnoDB: Cannot read first page of .*t2.ibd.*/ in mysqld.1.err
51+
NOT FOUND /\[Note\] InnoDB: Cannot read first page of .*t2.ibd.*/ in mysqld.1.err
5252
FOUND 1 /\[ERROR\] InnoDB: Datafile .*t2.*\. Cannot determine the space ID from the first 64 pages.*/ in mysqld.1.err
5353
SELECT * FROM t2;
5454
a
@@ -82,18 +82,18 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES
8282
WHERE engine = 'innodb'
8383
AND support IN ('YES', 'DEFAULT', 'ENABLED');
8484
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
85-
FOUND 1 /\[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*/ in mysqld.1.err
85+
FOUND 1 /\[Note\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*/ in mysqld.1.err
8686
FOUND 1 /\[ERROR\] InnoDB: Datafile .*u1.*\. Cannot determine the space ID from the first 64 pages.*/ in mysqld.1.err
87-
FOUND 1 /\[ERROR\] InnoDB: Cannot read first page of .*u2.ibd.*/ in mysqld.1.err
87+
NOT FOUND /\[Note\] InnoDB: Cannot read first page of .*u2.ibd.*/ in mysqld.1.err
8888
# Fault 7: Missing or wrong data file and innodb_force_recovery
8989
SELECT * FROM INFORMATION_SCHEMA.ENGINES
9090
WHERE engine = 'innodb'
9191
AND support IN ('YES', 'DEFAULT', 'ENABLED');
9292
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
93-
FOUND 1 /\[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*/ in mysqld.1.err
93+
FOUND 1 /\[Note\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*/ in mysqld.1.err
9494
FOUND 1 /InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace.*/ in mysqld.1.err
9595
FOUND 1 /\[ERROR\] InnoDB: Cannot rename '.*u5.ibd' to '.*u6.ibd' for space ID \d+ because the target file exists.*/ in mysqld.1.err
96-
FOUND 1 /\[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*/ in mysqld.1.err
96+
FOUND 1 /\[Note\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*/ in mysqld.1.err
9797
FOUND 1 /InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace.*/ in mysqld.1.err
9898
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
9999
DROP TABLE u1,u2,u3,u6;

mysql-test/suite/innodb/r/restart.result

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# of tables with .isl file or DATA DIRECTORY attribute.
66
call mtr.add_suppression("\\[ERROR\\] InnoDB: Invalid flags 0x7a207879 in .*td\\.ibd");
77
# FIXME: This is much more noisy than MariaDB 10.1!
8-
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot read first page in datafile: .*td\\.ibd, Space ID:2048948345, Flags: 2048948345");
98
call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number .* in a file operation\\.");
109
call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot find the path specified\\.");
1110
call mtr.add_suppression("\\[ERROR\\] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them\\.");

mysql-test/suite/innodb/t/alter_kill.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ let PAGE_SIZE=`select @@innodb_page_size`;
88

99
-- disable_query_log
1010
call mtr.add_suppression("InnoDB: innodb_force_recovery is on.");
11-
call mtr.add_suppression("InnoDB: Header page contains inconsistent data in .*bug16720368.ibd");
12-
call mtr.add_suppression("InnoDB: Checksum mismatch in datafile:.*bug16720368");
1311
call mtr.add_suppression("InnoDB: Ignoring tablespace for.*bug16720368");
1412
call mtr.add_suppression("Found 1 prepared XA transactions");
1513
call mtr.add_suppression("InnoDB: Operating system error.*in a file operation");

mysql-test/suite/innodb/t/doublewrite.test

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
# Slow shutdown and restart to make sure ibuf merge is finished
1212
SET GLOBAL innodb_fast_shutdown = 0;
1313
--disable_query_log
14-
call mtr.add_suppression("InnoDB: Header page consists of zero bytes");
15-
call mtr.add_suppression("InnoDB: Checksum mismatch in datafile: .*, Space ID:0, Flags: 0");
1614
call mtr.add_suppression("InnoDB: Data file .* uses page size .* but the innodb_page_size start-up parameter is");
1715
call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS");
1816
call mtr.add_suppression("InnoDB: New log files created");
@@ -397,7 +395,7 @@ EOF
397395
--source include/start_mysqld.inc
398396

399397
check table t1;
400-
--let SEARCH_PATTERN= \[ERROR\] InnoDB: .*test.t1\\.ibd.*
398+
--let SEARCH_PATTERN= InnoDB: .*test.t1\\.ibd
401399
--source include/search_pattern_in_file.inc
402400

403401
select f1, f2 from t1;

mysql-test/suite/innodb/t/log_file_name.test

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t[12].ibd.
107107
eval $check_no_innodb;
108108
--source include/shutdown_mysqld.inc
109109
# On Windows, this error message is not output when t2.ibd is a directory!
110-
#let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*t2.ibd;
110+
#let SEARCH_PATTERN= \[Note\] InnoDB: Cannot read first page of .*t2.ibd;
111111
#--source include/search_pattern_in_file.inc
112112

113113
--rmdir $MYSQLD_DATADIR/test/t2.ibd
@@ -120,7 +120,7 @@ EOF
120120
eval $check_no_innodb;
121121
--source include/shutdown_mysqld.inc
122122

123-
let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*t2.ibd.*;
123+
let SEARCH_PATTERN= \[Note\] InnoDB: Cannot read first page of .*t2.ibd.*;
124124
--source include/search_pattern_in_file.inc
125125
let SEARCH_PATTERN= \[ERROR\] InnoDB: Datafile .*t2.*\. Cannot determine the space ID from the first 64 pages.*;
126126
--source include/search_pattern_in_file.inc
@@ -156,13 +156,11 @@ call mtr.add_suppression("InnoDB: Cannot open datafile for read-write: '.*t2\.ib
156156
call mtr.add_suppression("InnoDB: Tablespace .* was not found at .*test");
157157
call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace");
158158
call mtr.add_suppression("InnoDB: Cannot read first page of '.*test.[tu]2.ibd' I/O error");
159-
call mtr.add_suppression("InnoDB: Cannot read first page in datafile: .*test.*ibd");
160159
call mtr.add_suppression("InnoDB: Datafile '.*test.*ibd' is corrupted");
161160
call mtr.add_suppression("InnoDB: Cannot replay file rename. Remove either file and try again");
162161
call mtr.add_suppression("InnoDB: Cannot rename.*because the target file exists");
163162
call mtr.add_suppression("InnoDB: Log scan aborted at LSN");
164163
# The following are for the --innodb-force-recovery=1 with broken u* tables:
165-
call mtr.add_suppression("InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd");
166164
call mtr.add_suppression("InnoDB: The size of the file .*u1\\.ibd is only 16384 bytes, should be at least 65536");
167165
call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified");
168166
call mtr.add_suppression("InnoDB: .*you must create directories");
@@ -216,7 +214,7 @@ EOF
216214
--source include/start_mysqld.inc
217215
eval $check_no_innodb;
218216

219-
let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*;
217+
let SEARCH_PATTERN= \[Note\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*;
220218
--source include/search_pattern_in_file.inc
221219

222220
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
226224
# in innodb-force-recovery mode once
227225
# Bug#18131883 IMPROVE INNODB ERROR MESSAGES REGARDING FILES
228226
# has been fixed:
229-
let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*u2.ibd.*;
227+
let SEARCH_PATTERN= \[Note\] InnoDB: Cannot read first page of .*u2.ibd.*;
230228
--source include/search_pattern_in_file.inc
231229

232230
--source include/shutdown_mysqld.inc
@@ -241,7 +239,7 @@ let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*u2.ibd.*;
241239
--source include/start_mysqld.inc
242240
eval $check_no_innodb;
243241

244-
let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*;
242+
let SEARCH_PATTERN= \[Note\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*;
245243
--source include/search_pattern_in_file.inc
246244

247245
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
254252

255253
--source include/restart_mysqld.inc
256254

257-
let SEARCH_PATTERN= \[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*;
255+
let SEARCH_PATTERN= \[Note\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd.*;
258256
--source include/search_pattern_in_file.inc
259257

260258
let SEARCH_PATTERN= InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace.*;

mysql-test/suite/innodb/t/restart.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ let page_size= `select @@innodb_page_size`;
1616
--echo # of tables with .isl file or DATA DIRECTORY attribute.
1717
call mtr.add_suppression("\\[ERROR\\] InnoDB: Invalid flags 0x7a207879 in .*td\\.ibd");
1818
--echo # FIXME: This is much more noisy than MariaDB 10.1!
19-
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot read first page in datafile: .*td\\.ibd, Space ID:2048948345, Flags: 2048948345");
2019
call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number .* in a file operation\\.");
2120
call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot find the path specified\\.");
2221
call mtr.add_suppression("\\[ERROR\\] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them\\.");

storage/innobase/fsp/fsp0file.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,9 @@ Datafile::validate_first_page(lsn_t* flush_lsn)
513513

514514
if (error_txt != NULL) {
515515
err_exit:
516-
ib::error() << error_txt << " in datafile: " << m_filepath
516+
ib::info() << error_txt << " in datafile: " << m_filepath
517517
<< ", Space ID:" << m_space_id << ", Flags: "
518-
<< m_flags << ". " << TROUBLESHOOT_DATADICT_MSG;
518+
<< m_flags;
519519
m_is_valid = false;
520520
free_first_page();
521521
return(DB_CORRUPTION);
@@ -562,8 +562,7 @@ Datafile::validate_first_page(lsn_t* flush_lsn)
562562
goto err_exit;
563563
}
564564

565-
if (m_space_id == ULINT_UNDEFINED) {
566-
/* The space_id can be most anything, except -1. */
565+
if (m_space_id >= SRV_LOG_SPACE_FIRST_ID) {
567566
error_txt = "A bad Space ID was found";
568567
goto err_exit;
569568
}

0 commit comments

Comments
 (0)