mariadb/mysql-test/suite/innodb/include
Marko Mäkelä 1bd681c8b3 MDEV-25506 (3 of 3): Do not delete .ibd files before commit
This is a complete rewrite of DROP TABLE, also as part of other DDL,
such as ALTER TABLE, CREATE TABLE...SELECT, TRUNCATE TABLE.

The background DROP TABLE queue hack is removed.
If a transaction needs to drop and create a table by the same name
(like TRUNCATE TABLE does), it must first rename the table to an
internal #sql-ib name. No committed version of the data dictionary
will include any #sql-ib tables, because whenever a transaction
renames a table to a #sql-ib name, it will also drop that table.
Either the rename will be rolled back, or the drop will be committed.

Data files will be unlinked after the transaction has been committed
and a FILE_RENAME record has been durably written. The file will
actually be deleted when the detached file handle returned by
fil_delete_tablespace() will be closed, after the latches have been
released. It is possible that a purge of the delete of the SYS_INDEXES
record for the clustered index will execute fil_delete_tablespace()
concurrently with the DDL transaction. In that case, the thread that
arrives later will wait for the other thread to finish.

HTON_TRUNCATE_REQUIRES_EXCLUSIVE_USE: A new handler flag.
ha_innobase::truncate() now requires that all other references to
the table be released in advance. This was implemented by Monty.

ha_innobase::delete_table(): If CREATE TABLE..SELECT is detected,
we will "hijack" the current transaction, drop the table in
the current transaction and commit the current transaction.
This essentially fixes MDEV-21602. There is a FIXME comment about
making the check less failure-prone.

ha_innobase::truncate(), ha_innobase::delete_table():
Implement a fast path for temporary tables. We will no longer allow
temporary tables to use the adaptive hash index.

dict_table_t::mdl_name: The original table name for the purpose of
acquiring MDL in purge, to prevent a race condition between a
DDL transaction that is dropping a table, and purge processing
undo log records of DML that had executed before the DDL operation.
For #sql-backup- tables during ALTER TABLE...ALGORITHM=COPY, the
dict_table_t::mdl_name will differ from dict_table_t::name.

dict_table_t::parse_name(): Use mdl_name instead of name.

dict_table_rename_in_cache(): Update mdl_name.

For the internal FTS_ tables of FULLTEXT INDEX, purge would
acquire MDL on the FTS_ table name, but not on the main table,
and therefore it would be able to run concurrently with a
DDL transaction that is dropping the table. Previously, the
DROP TABLE queue hack prevented a race between purge and DDL.
For now, we introduce purge_sys.stop_FTS() to prevent purge from
opening any table, while a DDL transaction that may drop FTS_
tables is in progress. The function fts_lock_table(), which will
be invoked before the dictionary is locked, will wait for
purge to release any table handles.

trx_t::drop_table_statistics(): Drop statistics for the table.
This replaces dict_stats_drop_index(). We will drop or rename
persistent statistics atomically as part of DDL transactions.
On lock conflict for dropping statistics, we will fail instantly
with DB_LOCK_WAIT_TIMEOUT, because we will be holding the
exclusive data dictionary latch.

trx_t::commit_cleanup(): Separated from trx_t::commit_in_memory().
Relax an assertion around fts_commit() and allow DB_LOCK_WAIT_TIMEOUT
in addition to DB_DUPLICATE_KEY. The call to fts_commit() is
entirely misplaced here and may obviously break the consistency
of transactions that affect FULLTEXT INDEX. It needs to be fixed
separately.

dict_table_t::n_foreign_key_checks_running: Remove (MDEV-21175).
The counter was a work-around for missing meta-data locking (MDL)
on the SQL layer, and not really needed in MariaDB.

ER_TABLE_IN_FK_CHECK: Replaced with ER_UNUSED_28.

HA_ERR_TABLE_IN_FK_CHECK: Remove.

row_ins_check_foreign_constraints(): Do not acquire
dict_sys.latch either. The SQL-layer MDL will protect us.

This was reviewed by Thirunarayanan Balathandayuthapani
and tested by Matthias Leich.
2021-06-09 17:06:07 +03:00
..
alter_table_pk_no_sort.inc MDEV-14119 Assertion cmp_rec_rec() in ALTER TABLE 2020-08-11 18:52:38 +03:00
autoinc_persist_alter.inc MDEV-6076: Optimize the test. 2016-12-16 10:24:54 +02:00
crc32.pl MDEV-18025: Improve test case and consistency checks 2018-12-19 15:45:35 +02:00
dml_ops.inc MDEV-11816 Disallow CREATE TEMPORARY TABLE…ROW_FORMAT=COMPRESSED 2017-01-18 08:42:57 +02:00
have_innodb_bzip2.inc misc after-merge changes: 2016-09-10 16:04:44 +02:00
have_innodb_lz4.inc misc after-merge changes: 2016-09-10 16:04:44 +02:00
have_innodb_lzma.inc misc after-merge changes: 2016-09-10 16:04:44 +02:00
have_innodb_lzo.inc misc after-merge changes: 2016-09-10 16:04:44 +02:00
have_innodb_punchhole.inc MDEV-11254: innodb-use-trim has no effect in 10.2 2017-01-24 14:40:58 +02:00
have_innodb_snappy.inc misc after-merge changes: 2016-09-10 16:04:44 +02:00
have_undo_tablespaces.combinations MDEV-17049 Enable innodb_undo tests on buildbot 2018-09-07 22:10:02 +03:00
have_undo_tablespaces.inc MDEV-17049 Enable innodb_undo tests on buildbot 2018-09-07 22:10:02 +03:00
ibd_convert.pl Fix tests for innodb_checksum_algorithm=strict_crc32 2019-02-16 12:06:52 +02:00
import.inc MDEV-13625 Merge InnoDB test cases from MySQL 5.6 (part 1) 2017-08-29 15:28:58 +03:00
innodb-page-compression.inc Merge 10.2 into 10.3 2019-05-29 11:32:46 +03:00
innodb-util.pl Merge the server part of MySQL WL#5522 - InnoDB transportable tablespaces. 2014-02-02 10:00:36 +01:00
innodb-wl6045.inc MDEV-13443: Port innochecksum tests from 10.2 innodb_zip suite to 10.1 2017-08-07 12:39:38 +03:00
innodb_binlog.combinations MDEV-17073 INSERT…ON DUPLICATE KEY UPDATE became more deadlock-prone 2018-11-02 18:52:39 +02:00
innodb_binlog.inc MDEV-17073 INSERT…ON DUPLICATE KEY UPDATE became more deadlock-prone 2018-11-02 18:52:39 +02:00
innodb_bulk_create_index.inc Import WL#7277 bulk insert creation tests from MySQL 5.7 2017-11-20 13:28:34 +02:00
innodb_bulk_create_index_debug.inc MDEV-20310: Make InnoDB crash tests Valgrind-friendly 2019-08-13 13:32:27 +03:00
innodb_dict.inc MDEV-13625 Merge InnoDB test cases from MySQL 5.6 (part 1) 2017-08-29 15:28:58 +03:00
innodb_isolation_selects.inc Adapt a test from MySQL 2017-04-26 23:03:34 +03:00
innodb_merge_threshold_delete.inc Remove wait_innodb_all_purged.inc 2017-08-08 09:44:38 +03:00
innodb_merge_threshold_secondary.inc Remove wait_innodb_all_purged.inc 2017-08-08 09:44:38 +03:00
innodb_merge_threshold_update.inc Remove wait_innodb_all_purged.inc 2017-08-08 09:44:38 +03:00
innodb_stats.inc Added missing tests for innodb persistent statistics (from mysql-5.6.10) 2013-08-07 17:08:51 -07:00
log_file_cleanup.inc MDEV-14425 deprecate and ignore innodb_log_files_in_group 2020-02-19 12:21:59 +03:00
no_checkpoint_end.inc MDEV-15682 mariabackup.unsupported_redo fails in buildbot with wrong result code 2018-03-29 13:22:59 +03:00
no_checkpoint_start.inc Port the test innodb.doublewrite from MySQL 5.7. 2016-12-20 15:03:56 +02:00
restart_and_reinit.inc MDEV-11873 Unnecessary InnoDB warnings upon bootstrap 2017-03-14 17:11:46 +02:00
show_i_s_tables.inc MDEV-25506 (3 of 3): Do not delete .ibd files before commit 2021-06-09 17:06:07 +03:00
show_i_s_tablespaces.inc MDEV-25506 (3 of 3): Do not delete .ibd files before commit 2021-06-09 17:06:07 +03:00
wait_all_purged.inc MDEV-16952 Introduce SET GLOBAL innodb_max_purge_lag_wait 2020-10-27 15:47:18 +02:00