@@ -45,53 +45,13 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
4545eval $check_no_innodb;
4646let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t2.ibd' with space ID \d+. Another data file called .*t1.ibd exists with the same space ID;
4747--source include/search_pattern_in_file.inc
48-
49- --source include/shutdown_mysqld.inc
50-
51- --remove_file $MYSQLD_DATADIR/test/t1.ibd
52-
53- # This could fail to refuse InnoDB startup, in case there was a log
54- # checkpoint after the CREATE TABLE t3. That is what we checked above.
55- --echo # Fault 2: Wrong space_id in a dirty file, and a missing file.
56- --move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t1.ibd
57-
58- --source include/start_mysqld.inc
59- eval $check_no_innodb;
60-
61- let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at.*t3.ibd;
62- --source include/search_pattern_in_file.inc
63-
6448--source include/shutdown_mysqld.inc
6549
66- --move_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t3.ibd
67-
68- --echo # Fault 3: Wrong space_id in a dirty file, and no missing file.
69- # Swap t2.ibd and t3.ibd.
70- --move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t.ibd
71- --move_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t3.ibd
72- --move_file $MYSQLD_DATADIR/test/t.ibd $MYSQLD_DATADIR/test/t2.ibd
73-
74- --source include/start_mysqld.inc
75- eval $check_no_innodb;
76-
77- let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t[23].ibd' with space ID;
78- --source include/search_pattern_in_file.inc
79-
80- let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t1.ibd;
81- --source include/search_pattern_in_file.inc
82- let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t3.ibd;
83- --source include/search_pattern_in_file.inc
84- let SEARCH_PATTERN= InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace;
85- --source include/search_pattern_in_file.inc
86-
87- --source include/shutdown_mysqld.inc
88-
89- # Swap back t3.ibd, but hide t2.ibd (which the redo log also knows as t1.ibd).
90- --move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t.ibd
91- --move_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t3.ibd
92-
9350--echo # Fault 4: Missing data file
9451
52+ --move_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t.ibd
53+ --remove_file $MYSQLD_DATADIR/test/t1.ibd
54+
9555--source include/start_mysqld.inc
9656eval $check_no_innodb;
9757--source include/shutdown_mysqld.inc
@@ -108,15 +68,6 @@ let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t[12].ibd.
10868eval $check_no_innodb;
10969--source include/shutdown_mysqld.inc
11070
111- # On Linux, lseek() would typically report EINVAL when invoked on a directory.
112- # On other plaftorms as well as some GNU/Linux based environments, such as
113- # a Ubuntu 22.04 based image on Amazon Web Services,
114- # os_file_get_size() would succeed on a directory, and we would get another
115- # error about inability to apply log to a corrupted page.
116-
117- #--let SEARCH_PATTERN= InnoDB: Could not measure the size of single-table tablespace file '.*test/t2\\.ibd'
118- #--source include/search_pattern_in_file.inc
119-
12071--rmdir $MYSQLD_DATADIR/test/t2.ibd
12172
12273# Create a short file.
@@ -136,6 +87,9 @@ let SEARCH_PATTERN= .*\[ERROR\] InnoDB: Cannot apply log to \\[page id: space=[1
13687--remove_file $MYSQLD_DATADIR/test/t2.ibd
13788--move_file $MYSQLD_DATADIR/test/t.ibd $MYSQLD_DATADIR/test/t2.ibd
13889
90+ --echo # Fault 2: Wrong space_id in a dirty file, and a missing file.
91+ --move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t1.ibd
92+
13993--source include/start_mysqld.inc
14094
14195SELECT * FROM t2;
@@ -150,13 +104,20 @@ CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;
150104--remove_file $MYSQLD_DATADIR/test/t0.ibd
151105CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;
152106DROP TABLE t0;
107+ --error ER_CANT_CREATE_TABLE
108+ CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
109+ --error ER_CANT_CREATE_TABLE
110+ CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
111+ --remove_file $MYSQLD_DATADIR/test/t1.ibd
112+ CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
113+ DROP TABLE t1;
153114
154115--disable_query_log
155116# The following are for the orphan file t0.ibd or for the directory t2.ibd:
156117call mtr.add_suppression("InnoDB: Operating system error number [0-9]* in a file operation");
157118call mtr.add_suppression("InnoDB: Error number [0-9]* means '(File exists|Is a directory|Invalid argument)'");
158119call mtr.add_suppression("InnoDB: Cannot create file '.*t0.ibd'");
159- call mtr.add_suppression("InnoDB: The file '.*t0 \.ibd' already exists");
120+ call mtr.add_suppression("InnoDB: The file '.*t[01] \.ibd' already exists");
160121call mtr.add_suppression("InnoDB: Cannot open datafile for read-write: '.*t2\.ibd'");
161122call mtr.add_suppression("InnoDB: Could not measure the size of single-table tablespace file '.*test/t2\\.ibd'");
162123# The following are for aborted startup without --innodb-force-recovery:
@@ -187,6 +148,17 @@ call mtr.add_suppression("InnoDB: Cannot read first page in datafile:");
187148FLUSH TABLES;
188149--enable_query_log
189150
151+ # Force a log checkpoint to "discard" any FILE_CREATE records.
152+ SET GLOBAL innodb_max_purge_lag_wait=0;
153+ SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0;
154+ SET GLOBAL innodb_max_dirty_pages_pct=0.0;
155+ let $wait_condition =
156+ SELECT variable_value = 0
157+ FROM information_schema.global_status
158+ WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY';
159+ --source include/wait_condition.inc
160+ SET GLOBAL innodb_max_dirty_pages_pct=90.0;
161+
190162--source include/no_checkpoint_start.inc
191163
192164CREATE TABLE u1(a INT PRIMARY KEY) ENGINE=InnoDB;
0 commit comments