mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Test recovery when a .ibd file is a directory.
Datafile::validate_for_recovery(): Remove a redundant error message. An error is already reported by Datafile::open_read_write() if the file cannot be opened. Also, do not assign SEARCH_ABORT, so that the full test will be executed even if one step fails.
This commit is contained in:
@@ -14,26 +14,41 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|||||||
WHERE engine = 'innodb'
|
WHERE engine = 'innodb'
|
||||||
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||||
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
||||||
|
FOUND /InnoDB: Ignoring data file '.*t2.ibd' with space ID \d+. Another data file called .*t1.ibd exists with the same space ID/ in mysqld.1.err
|
||||||
# Fault 2: Wrong space_id in a dirty file, and a missing file.
|
# Fault 2: Wrong space_id in a dirty file, and a missing file.
|
||||||
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
||||||
WHERE engine = 'innodb'
|
WHERE engine = 'innodb'
|
||||||
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||||
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
||||||
|
FOUND /InnoDB: Ignoring data file '.*t1.ibd' with space ID/ in mysqld.1.err
|
||||||
|
FOUND /InnoDB: Tablespace \d+ was not found at.*t3.ibd/ in mysqld.1.err
|
||||||
# Fault 3: Wrong space_id in a dirty file, and no missing file.
|
# Fault 3: Wrong space_id in a dirty file, and no missing file.
|
||||||
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
||||||
WHERE engine = 'innodb'
|
WHERE engine = 'innodb'
|
||||||
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||||
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
||||||
|
FOUND /InnoDB: Ignoring data file '.*t[23].ibd' with space ID/ in mysqld.1.err
|
||||||
|
FOUND /InnoDB: Tablespace \d+ was not found at .*t1.ibd/ in mysqld.1.err
|
||||||
|
FOUND /InnoDB: Tablespace \d+ was not found at .*t3.ibd/ in mysqld.1.err
|
||||||
|
FOUND /InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace/ in mysqld.1.err
|
||||||
# Fault 4: Missing data file
|
# Fault 4: Missing data file
|
||||||
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
||||||
WHERE engine = 'innodb'
|
WHERE engine = 'innodb'
|
||||||
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||||
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
||||||
|
FOUND /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/ in mysqld.1.err
|
||||||
# Fault 5: Wrong type of data file
|
# Fault 5: Wrong type of data file
|
||||||
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
||||||
WHERE engine = 'innodb'
|
WHERE engine = 'innodb'
|
||||||
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||||
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
||||||
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
||||||
|
WHERE engine = 'innodb'
|
||||||
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||||
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
||||||
|
FOUND /\[ERROR\] InnoDB: Cannot read first page of .*t2.ibd/ in mysqld.1.err
|
||||||
|
FOUND /\[ERROR\] InnoDB: Datafile .*t2.*\. Cannot determine the space ID from the first 64 pages/ in mysqld.1.err
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
a
|
a
|
||||||
9
|
9
|
||||||
@@ -66,11 +81,20 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|||||||
WHERE engine = 'innodb'
|
WHERE engine = 'innodb'
|
||||||
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||||
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
||||||
|
FOUND /\[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd/ in mysqld.1.err
|
||||||
|
FOUND /\[ERROR\] InnoDB: Datafile .*u1.*\. Cannot determine the space ID from the first 64 pages/ in mysqld.1.err
|
||||||
|
FOUND /\[ERROR\] InnoDB: Cannot read first page of .*u2.ibd/ in mysqld.1.err
|
||||||
# Fault 7: Missing or wrong data file and innodb_force_recovery
|
# Fault 7: Missing or wrong data file and innodb_force_recovery
|
||||||
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
||||||
WHERE engine = 'innodb'
|
WHERE engine = 'innodb'
|
||||||
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||||
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
||||||
|
FOUND /\[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd/ in mysqld.1.err
|
||||||
|
FOUND /InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace/ in mysqld.1.err
|
||||||
|
FOUND /\[ERROR\] InnoDB: Cannot rename '.*u5.ibd' to '.*u6.ibd' for space ID \d+ because the target file exists/ in mysqld.1.err
|
||||||
|
FOUND /\[ERROR\] InnoDB: Header page consists of zero bytes in datafile: .*u1.ibd/ in mysqld.1.err
|
||||||
|
FOUND /InnoDB: At LSN: \d+: unable to open file .*u[1-5].ibd for tablespace/ in mysqld.1.err
|
||||||
|
FOUND /\[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;
|
DROP TABLE u1,u2,u3,u6;
|
||||||
# List of files:
|
# List of files:
|
||||||
SHOW TABLES;
|
SHOW TABLES;
|
||||||
|
@@ -31,7 +31,6 @@ COMMIT;
|
|||||||
|
|
||||||
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
||||||
let SEARCH_RANGE= -50000;
|
let SEARCH_RANGE= -50000;
|
||||||
let SEARCH_ABORT= NOT FOUND;
|
|
||||||
let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
||||||
WHERE engine = 'innodb'
|
WHERE engine = 'innodb'
|
||||||
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||||
@@ -94,32 +93,38 @@ let SEARCH_PATTERN= InnoDB: Set innodb_force_recovery=1 to ignore this and to pe
|
|||||||
|
|
||||||
--source include/start_mysqld.inc
|
--source include/start_mysqld.inc
|
||||||
eval $check_no_innodb;
|
eval $check_no_innodb;
|
||||||
|
--source include/shutdown_mysqld.inc
|
||||||
|
|
||||||
let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t[12].ibd.
|
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;
|
.*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/search_pattern_in_file.inc
|
||||||
|
|
||||||
--source include/shutdown_mysqld.inc
|
|
||||||
|
|
||||||
--echo # Fault 5: Wrong type of data file
|
--echo # Fault 5: Wrong type of data file
|
||||||
|
|
||||||
# TODO: Test the following as well once
|
--mkdir $MYSQLD_DATADIR/test/t2.ibd
|
||||||
# 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
|
--source include/start_mysqld.inc
|
||||||
eval $check_no_innodb;
|
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;
|
||||||
|
#--source include/search_pattern_in_file.inc
|
||||||
|
|
||||||
|
--rmdir $MYSQLD_DATADIR/test/t2.ibd
|
||||||
|
|
||||||
|
# Create a short file.
|
||||||
|
--write_file $MYSQLD_DATADIR/test/t2.ibd
|
||||||
|
EOF
|
||||||
|
|
||||||
|
--source include/start_mysqld.inc
|
||||||
|
eval $check_no_innodb;
|
||||||
|
--source include/shutdown_mysqld.inc
|
||||||
|
|
||||||
|
let SEARCH_PATTERN= \[ERROR\] 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;
|
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/search_pattern_in_file.inc
|
||||||
|
|
||||||
--source include/shutdown_mysqld.inc
|
|
||||||
|
|
||||||
# Restore t2.ibd
|
# Restore t2.ibd
|
||||||
--remove_file $MYSQLD_DATADIR/test/t2.ibd
|
--remove_file $MYSQLD_DATADIR/test/t2.ibd
|
||||||
--move_file $MYSQLD_DATADIR/test/t.ibd $MYSQLD_DATADIR/test/t2.ibd
|
--move_file $MYSQLD_DATADIR/test/t.ibd $MYSQLD_DATADIR/test/t2.ibd
|
||||||
@@ -141,11 +146,12 @@ CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;
|
|||||||
DROP TABLE t0;
|
DROP TABLE t0;
|
||||||
|
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
# The following are for the orphan file t0.ibd:
|
# The following are for the orphan file t0.ibd or for the directory t2.ibd:
|
||||||
call mtr.add_suppression("InnoDB: Operating system error number [0-9]* in a file operation");
|
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: Error number [0-9]* means '(File exists|Is a directory)'");
|
||||||
call mtr.add_suppression("InnoDB: Cannot create file '.*t0.ibd'");
|
call mtr.add_suppression("InnoDB: Cannot create file '.*t0.ibd'");
|
||||||
call mtr.add_suppression("InnoDB: The file '.*t0\.ibd' already exists");
|
call mtr.add_suppression("InnoDB: The file '.*t0\.ibd' already exists");
|
||||||
|
call mtr.add_suppression("InnoDB: Cannot open datafile for read-write: '.*t2\.ibd'");
|
||||||
# The following are for aborted startup without --innodb-force-recovery:
|
# 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: 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: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace");
|
||||||
@@ -189,7 +195,7 @@ INSERT INTO u6 VALUES(2);
|
|||||||
--remove_file $MYSQLD_DATADIR/test/u3.ibd
|
--remove_file $MYSQLD_DATADIR/test/u3.ibd
|
||||||
|
|
||||||
# InnoDB: Header page consists of zero bytes
|
# InnoDB: Header page consists of zero bytes
|
||||||
perl;
|
--perl
|
||||||
die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/test/u1.ibd");
|
die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/test/u1.ibd");
|
||||||
print FILE "\0" x 16384;
|
print FILE "\0" x 16384;
|
||||||
close(FILE);
|
close(FILE);
|
||||||
@@ -218,7 +224,7 @@ let SEARCH_PATTERN= \[ERROR\] InnoDB: Datafile .*u1.*\. Cannot determine the spa
|
|||||||
# in innodb-force-recovery mode once
|
# in innodb-force-recovery mode once
|
||||||
# Bug#18131883 IMPROVE INNODB ERROR MESSAGES REGARDING FILES
|
# Bug#18131883 IMPROVE INNODB ERROR MESSAGES REGARDING FILES
|
||||||
# has been fixed:
|
# has been fixed:
|
||||||
let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*u2.ibd.*;
|
let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot read first page of .*u2.ibd;
|
||||||
--source include/search_pattern_in_file.inc
|
--source include/search_pattern_in_file.inc
|
||||||
|
|
||||||
--source include/shutdown_mysqld.inc
|
--source include/shutdown_mysqld.inc
|
||||||
|
@@ -467,11 +467,8 @@ Datafile::validate_for_recovery()
|
|||||||
close();
|
close();
|
||||||
err = open_read_write(srv_read_only_mode);
|
err = open_read_write(srv_read_only_mode);
|
||||||
if (err != DB_SUCCESS) {
|
if (err != DB_SUCCESS) {
|
||||||
ib::error() << "Datafile '" << m_filepath << "' could not"
|
|
||||||
" be opened in read-write mode so that the"
|
|
||||||
" doublewrite pages could be restored.";
|
|
||||||
return(err);
|
return(err);
|
||||||
};
|
}
|
||||||
|
|
||||||
err = find_space_id();
|
err = find_space_id();
|
||||||
if (err != DB_SUCCESS || m_space_id == 0) {
|
if (err != DB_SUCCESS || m_space_id == 0) {
|
||||||
|
Reference in New Issue
Block a user