mariadb/mysql-test/suite/innodb_fts/r
Marko Mäkelä 14d9323f60 MDEV-37994 Race condition between checkpoint and .ibd file creation
It was possible that a log checkpoint was completed and the server killed
between the time that fil_ibd_create() durably wrote a FILE_CREATE record,
and the initialization of the tablespace. This could lead to a failure
to start up after the server was killed during TRUNCATE TABLE or any
table-rebuilding operation such as OPTIMIZE TABLE.

In the case of TRUNCATE TABLE, an attempt to rename a file #sql-ibNNN.ibd
(the contents of the table before truncation) to tablename.ibd would fail,
because both files existed and the file tablename.ibd would have been
filled with NUL bytes. It was possible to resume from this error by
deleting the file tablename.ibd and restarting the server.

We will prevent this class of errors by ensuring that both the FILE_CREATE
record and the records written by fsp_header_init() will be part of the
same atomic transaction, which must be durably written before any file
is created or allocated.

NOTE: There is another possible crash recovery problem, which we are not
attempting to solve here and which will be covered by the subsequent
change (MDEV-38026). If fil_ibd_create() fails to create the file and
the server were killed, recovery would not even attempt to create the file
at all.

fil_space_t::create(): Remove the DBUG_EXECUTE_IF fault injection that
was the only cause of return nullptr. This allows us to simplify
several callers.

fil_space_t::set_stopped(), fil_space_t::clear_stopped(): Accessor
functions for fil_ibd_create() for preventing any concurrent access
to an incompletely created tablespace.

fil_ibd_create(): In a single atomic mini-transaction, write the
FILE_CREATE record as well as the log for initializing the tablespace.
After durably writing the log, create the file in the file system
Only after the file has been successfully created and allocated,
open the tablespace for business. Finally, release the exclusive page
latches so that the header pages may be written to the file.

fil_ibd_open(): Move some fault injection from fil_space_t::create()
to a higher level, to the place where an existing file is being opened.

Reviewed by: Thirunarayanan Balathandayuthapani
Tested by: Saahil Alam
2025-11-07 08:06:27 +02:00
..
basic.result MDEV-25004 Missing row in FTS_DOC_ID_INDEX during DELETE HISTORY 2022-12-27 00:02:02 +03:00
bug_32831765.result MDEV-27913 innodb_ft_cache_size max possible value (80000000) is too small for practical purposes 2022-02-24 22:41:23 +05:30
concurrent_insert.result MDEV-30996 insert.. select in presence of full text index freezes all other commits at commit time 2023-04-24 11:06:56 +05:30
crash_recovery.result MDEV-32050 fixup: Stabilize tests 2023-11-21 12:42:00 +02:00
create.result Merge branch '10.2' into 10.3 2021-02-01 13:49:33 +01:00
foreign_key_check.result MDEV-13626 Merge InnoDB test cases from MySQL 5.7 2023-11-08 12:17:14 +02:00
foreign_key_update.result MDEV-32346 Assertion failure sym_node->table != NULL in pars_retrieve_table_def on UPDATE 2024-03-06 14:04:49 +05:30
ft_result_cache_limit.result Remove deprication from mariadbd --debug 2023-11-28 16:33:22 +02:00
fts_kill_query.result Merge 10.1 into 10.2 2018-08-02 08:19:57 +03:00
fts_sync_commit_resiliency.result MDEV-34057 Inconsistent FTS state in concurrent scenarios 2024-06-06 19:09:13 +05:30
fulltext.result Merge 10.5 into 10.6 2024-11-29 12:37:46 +02:00
fulltext2.result Merge 10.3 into 10.4 2022-12-13 11:37:33 +02:00
fulltext3.result Merge 10.1 into 10.2 2019-03-06 15:15:59 +02:00
fulltext_cache.result
fulltext_distinct.result MDEV-7563 Support CHECK constraint as in (or close to) SQL Standard 2016-06-30 11:43:02 +02:00
fulltext_left_join.result
fulltext_misc.result MDEV-29871 innodb_fts.fulltext_misc unexpectedly reports a result 2023-02-21 18:48:59 +05:30
fulltext_multi.result
fulltext_order_by.result MDEV-34679 ER_BAD_FIELD uses non-localizable substrings 2024-10-17 21:37:37 +02:00
fulltext_update.result MDEV-7563 Support CHECK constraint as in (or close to) SQL Standard 2016-06-30 11:43:02 +02:00
fulltext_var.result MDEV-16172: Enable skipped tests 2018-05-17 09:37:01 +03:00
index_table.result MDEV-36061 Incorrect error handling on DDL with FULLTEXT INDEX 2025-02-13 16:28:06 +01:00
innodb-fts-ddl,vers.rdiff MDEV-30528 CREATE FULLTEXT INDEX assertion failure WITH SYSTEM VERSIONING 2024-02-12 16:52:55 +01:00
innodb-fts-ddl,vers_trx.rdiff MDEV-30528 CREATE FULLTEXT INDEX assertion failure WITH SYSTEM VERSIONING 2024-02-12 16:52:55 +01:00
innodb-fts-ddl.result MDEV-37994 Race condition between checkpoint and .ibd file creation 2025-11-07 08:06:27 +02:00
innodb-fts-fic,vers.rdiff MDEV-30528 CREATE FULLTEXT INDEX assertion failure WITH SYSTEM VERSIONING 2024-02-12 16:52:55 +01:00
innodb-fts-fic,vers_trx.rdiff MDEV-30528 CREATE FULLTEXT INDEX assertion failure WITH SYSTEM VERSIONING 2024-02-12 16:52:55 +01:00
innodb-fts-fic.result MDEV-15253: Default optimizer setting changes for MariaDB 10.4 2018-12-09 09:22:00 +05:30
innodb_ft_aux_table.result MDEV-36420 Assertion failure in SET GLOBAL innodb_ft_aux_table 2025-03-28 09:05:20 +02:00
innodb_fts_large_records.result
innodb_fts_misc.result MDEV-35082 HANDLER with FULLTEXT keys is not always rejected 2024-10-08 18:20:13 +02:00
innodb_fts_misc_1.result MDEV-30363 InnoDB: Failing assertion: trx->error_state == DB_SUCCESS in que_run_threads 2025-06-16 11:48:06 +02:00
innodb_fts_multiple_index.result MDEV-29446 Change SHOW CREATE TABLE to display default collation 2022-09-12 22:10:39 +04:00
innodb_fts_plugin.result Merge 10.5 into 10.6 2022-08-30 13:01:16 +03:00
innodb_fts_proximity.result MDEV-13626 Merge InnoDB test cases from MySQL 5.7 2023-11-08 12:17:14 +02:00
innodb_fts_result_cache_limit.result MDEV-13134 Introduce ALTER TABLE attributes ALGORITHM=NOCOPY and ALGORITHM=INSTANT 2018-05-07 14:58:11 +05:30
innodb_fts_stopword_charset.result Write information about restart in .result 2019-04-01 19:47:24 +03:00
innodb_fts_transaction.result MDEV-13134 Introduce ALTER TABLE attributes ALGORITHM=NOCOPY and ALGORITHM=INSTANT 2018-05-07 14:58:11 +05:30
limit_union.result MDEV-13626 Merge InnoDB test cases from MySQL 5.7 2023-11-08 12:17:14 +02:00
misc.result MDEV-35082 HANDLER with FULLTEXT keys is not always rejected 2024-10-08 18:20:13 +02:00
misc_1.result Merge branch '10.5' into 10.6 2023-12-17 11:20:43 +01:00
misc_debug,vers.rdiff Merge 10.5 into 10.6 2024-02-13 20:42:59 +02:00
misc_debug,vers_trx.rdiff Merge 10.5 into 10.6 2024-02-13 20:42:59 +02:00
misc_debug.result MDEV-30346 Avoid block device required error in innodb_fts.misc_debug 2023-01-05 11:07:55 +05:30
misc_debug2.result MDEV-37423 Enforce innodb_ft_min_token_size > 0 to prevent unnecessary token indexing 2025-10-21 11:19:29 +05:30
multiple_index.result MDEV-14231 MATCH() AGAINST( IN BOOLEAN MODE), results mismatch 2024-08-13 15:22:09 +05:30
opt.result MDEV-13626 Merge InnoDB test cases from MySQL 5.7 2023-11-08 12:17:14 +02:00
phrase.result MDEV-13626 Merge InnoDB test cases from MySQL 5.7 2023-11-08 12:17:14 +02:00
plugin_debug.result MDEV-14231 MATCH() AGAINST( IN BOOLEAN MODE), results mismatch 2024-08-13 15:22:09 +05:30
result_cache_limit.result MDEV-13626 Merge InnoDB test cases from MySQL 5.7 2023-11-08 12:17:14 +02:00
savepoint.result MDEV-24035 Failing assertion: UT_LIST_GET_LEN(lock.trx_locks) == 0 causing disruption and replication failure 2024-12-12 18:02:00 +02:00
stopword,vers.rdiff MDEV-25004 Missing row in FTS_DOC_ID_INDEX during DELETE HISTORY 2022-12-27 00:02:02 +03:00
stopword.result Merge 10.3 into 10.4 2023-01-03 16:10:02 +02:00
subexpr.result MDEV-13626 Merge InnoDB test cases from MySQL 5.7 2023-11-08 12:17:14 +02:00
sync.result MDEV-30996 insert.. select in presence of full text index freezes all other commits at commit time 2023-04-24 11:06:56 +05:30
sync_block.result MDEV-30996 insert.. select in presence of full text index freezes all other commits at commit time 2023-04-24 11:06:56 +05:30
sync_ddl,vers.rdiff MDEV-30528 CREATE FULLTEXT INDEX assertion failure WITH SYSTEM VERSIONING 2024-02-12 16:52:55 +01:00
sync_ddl,vers_trx.rdiff MDEV-30528 CREATE FULLTEXT INDEX assertion failure WITH SYSTEM VERSIONING 2024-02-12 16:52:55 +01:00
sync_ddl.result MDEV-30528 CREATE FULLTEXT INDEX assertion failure WITH SYSTEM VERSIONING 2024-02-12 16:52:55 +01:00
versioning,prepare.result MDEV-25004 Missing row in FTS_DOC_ID_INDEX during DELETE HISTORY 2022-12-27 00:02:02 +03:00
versioning.result Merge 10.5 into 10.6 2023-01-03 18:13:11 +02:00