[MDEV-14049] InnoDB fails to refuse startup when a file is not found in crash recovery Created: 2017-10-11  Updated: 2018-05-28  Resolved: 2018-05-28

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2.10
Fix Version/s: 10.2.15, 10.3.6

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: corruption, recovery

Issue Links:
Duplicate
duplicates MDEV-15325 Incomplete validation of missing tabl... Closed
Relates
relates to MDEV-12905 InnoDB occasionally skips the doublew... Closed

 Description   

I originally reported this in MDEV-12905.
In the test innodb.log_file_name, the startup attempt "Fault 2" sometimes fails to refuse InnoDB startup, even though the file t3.ibd is reported not to be found.
Because --innodb-force-recovery was not specified, this is an incorrect action. Redo log for missing files should only be ignored if innodb_force_recovery=1 or more.

CURRENT_TEST: innodb.log_file_name
2017-10-11 12:01:15 139847651086784 [Note] /mariadb/10.2/bld/sql/mysqld (mysqld 10.2.10-MariaDB-log) starting as process 30950 ...

The first startup message is the first (failed) recovery attempt after the test killed the server. There are several failed startup attempts initiated by the test. The last messages are from the last recovery attempt, which should have succeeded.

On the second recovery attempt we got error messages for the file t3.ibd, but did not refuse startup as expected:

2017-10-11 12:01:21 140400653447616 [ERROR] InnoDB: The error means the system cannot find the path specified.
2017-10-11 12:01:21 140400653447616 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2017-10-11 12:01:21 140400653447616 [ERROR] InnoDB: Cannot open datafile for read-only: './test/t3.ibd' OS error: 71
2017-10-11 12:01:21 140400653447616 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2017-10-11 12:01:21 140400653447616 [ERROR] InnoDB: The error means the system cannot find the path specified.
2017-10-11 12:01:21 140400653447616 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2017-10-11 12:01:21 140400653447616 [ERROR] InnoDB: Could not find a valid tablespace file for `test/t3`. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2017-10-11 12:01:21 140400653447616 [Warning] InnoDB: Ignoring tablespace for `test`.`t3` because it could not be opened.
2017-10-11 12:01:21 140400653447616 [Note] InnoDB: 128 out of 128 rollback segments are active.
2017-10-11 12:01:21 140400653447616 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2017-10-11 12:01:21 140400653447616 [Note] InnoDB: Creating shared tablespace for temporary tables
2017-10-11 12:01:21 140400653447616 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2017-10-11 12:01:21 140400653447616 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2017-10-11 12:01:21 140400653447616 [Note] InnoDB: 5.7.19 started; log sequence number 95773105

This corresponds to the following test snippet:

--echo # Fault 2: Wrong space_id in a dirty file, and a missing file.
--move_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t1.ibd
 
--source include/start_mysqld.inc
eval $check_no_innodb;
 
let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t1.ibd' with space ID.*;
--source include/search_pattern_in_file.inc
 
let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at.*t3.ibd.*;
--source include/search_pattern_in_file.inc
 
--source include/shutdown_mysqld.inc

In the log_file_name.log we indeed got the unexpected result that InnoDB did start up:

# Fault 2: Wrong space_id in a dirty file, and a missing file.
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE	SUPPORT	COMMENT	TRANSACTIONS	XA	SAVEPOINTS
InnoDB	YES	Supports transactions, row-level locking, foreign keys and encryption for tables	YES	YES	YES
FOUND 1 /InnoDB: Ignoring data file '.*t1.ibd' with space ID.*/ in mysqld.1.err
FOUND 1 /InnoDB: Tablespace \d+ was not found at.*t3.ibd.*/ in mysqld.1.err



 Comments   
Comment by Marko Mäkelä [ 2018-05-28 ]

This was fixed by
MDEV-15325 Incomplete validation of missing tablespace during recovery

Generated at Thu Feb 08 08:10:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.