mariadb/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
..
atomic MDEV-19696 - Cleanup gcc sync builtins 2019-07-03 12:11:22 +03:00
mysql MDEV-5536: add systemd socket activation 2021-03-28 13:53:55 +11:00
aria_backup.h S3 is pluggable now 2020-06-19 19:43:07 +02:00
assume_aligned.h Remove a misleading copyright message 2020-03-21 10:25:54 +02:00
big_endian.h Update FSF address 2019-05-11 19:25:02 +03:00
byte_order_generic.h Fix all warnings given by UBSAN 2021-04-20 12:30:09 +03:00
byte_order_generic_x86.h Fix all warnings given by UBSAN 2021-04-20 12:30:09 +03:00
byte_order_generic_x86_64.h MDEV-21981 Replace arithmetic + with bitwise OR when possible 2020-03-19 15:09:13 +02:00
CMakeLists.txt Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
decimal.h Added typedef decimal_digits_t (uint16) for number of digits in most 2021-05-19 22:27:27 +02:00
dur_prop.h Merge InnoDB 5.7 from mysql-5.7.9. 2016-09-02 13:22:28 +03:00
errmsg.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ft_global.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
handler_ername.h MDEV-25506 (3 of 3): Do not delete .ibd files before commit 2021-06-09 17:06:07 +03:00
handler_state.h Fix for MDEV-533: Confusing error code when doing auto-increment insert for out-of-range values 2012-09-18 15:14:19 +03:00
hash.h cleanup: PSI key is *always* the first argument 2020-03-10 19:24:23 +01:00
heap.h Added page_range to records_in_range() to improve range statistics 2020-03-27 03:54:45 +02:00
ilist.h MDEV-25223 change fil_system_t::space_list and fil_system_t::named_spaces from UT_LIST to ilist 2021-03-24 15:15:18 +03:00
json_lib.h Fix all warnings given by UBSAN 2021-04-20 12:30:09 +03:00
keycache.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
lf.h MDEV-23510: arm64 lf_hash alignment of pointers 2021-02-25 10:06:15 +11:00
little_endian.h Update FSF address 2019-05-11 19:25:02 +03:00
m_ctype.h Change CHARSET_INFO character set and collaction names to LEX_CSTRING 2021-05-19 22:54:07 +02:00
m_string.h Simplify a preprocessor condition 2021-05-17 18:10:11 +03:00
ma_dyncol.h MDEV-19897 Rename source code variable names from utf8 to utf8mb3 2019-06-28 12:37:04 +04:00
maria.h cleanup: Aria headers 2020-06-19 19:43:07 +02:00
my_alarm.h FreeBSD compilation fixes 2020-06-04 23:52:46 +02:00
my_alloc.h perfschema memory related instrumentation changes 2020-03-10 19:24:22 +01:00
my_atomic.h Move c++ code from my_atomic.h to my_atomic_wrapper.h 2020-05-19 14:07:34 +03:00
my_atomic_wrapper.h Merge 10.5 into 10.6 (except MDEV-24630) 2021-03-30 13:28:05 +03:00
my_attribute.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
my_base.h MDEV-25506 (3 of 3): Do not delete .ibd files before commit 2021-06-09 17:06:07 +03:00
my_bit.h Coding style fixes 2020-04-04 14:55:51 +04:00
my_bitmap.h MDEV-21907: Fix some -Wconversion outside InnoDB 2020-03-12 19:44:52 +02:00
my_byteorder.h MDEV-25870 Windows - fix ARM64 cross-compilation 2021-06-07 23:15:36 +02:00
my_check_opt.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
my_compare.h Merge 10.4 into 10.5 2021-04-21 09:01:01 +03:00
my_compiler.h Merge 10.4 into 10.5 2020-06-05 20:36:43 +03:00
my_counter.h MDEV-22456 after-merge fix: introduce Atomic_relaxed 2020-05-18 15:02:55 +03:00
my_cpu.h MDEV-24630: MY_RELAX_CPU assembly instruction upgrade/research for 2021-03-30 13:26:19 +03:00
my_crypt.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
my_dbug.h MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
my_decimal_limits.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
my_default.h MDEV-22214 mariadbd.exe calls function mysqld.exe, and crashes 2020-04-10 19:05:26 +02:00
my_dir.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
my_getopt.h Added 'const' to arguments in get_one_option and find_typeset() 2021-02-08 12:16:29 +02:00
my_global.h MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
my_handler_errors.h Merge 10.4 into 10.5 2019-05-23 10:32:21 +03:00
my_libwrap.h Update FSF Address 2019-05-11 21:29:06 +03:00
my_list.h Update FSF Address 2019-05-11 21:29:06 +03:00
my_md5.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
my_net.h MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
my_nosys.h Update FSF Address 2019-05-11 21:29:06 +03:00
my_pthread.h MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
my_rdtsc.h MDEV-25870 Windows - fix ARM64 cross-compilation 2021-06-07 23:15:36 +02:00
my_rnd.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
my_service_manager.h MDEV-5536: add systemd socket activation 2021-03-28 13:53:55 +11:00
my_stack_alloc.h perfschema memory related instrumentation changes 2020-03-10 19:24:22 +01:00
my_stacktrace.h MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
my_sys.h Added checking to protect against simultaneous double free in safemalloc 2021-05-19 22:54:14 +02:00
my_time.h MDEV-23311 CEILING() and FLOOR() convert temporal input to numbers, unlike ROUND() and TRUNCATE() 2020-07-28 23:29:08 +04:00
my_tree.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
my_uctype.h Update FSF Address 2019-05-11 21:29:06 +03:00
my_user.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
my_valgrind.h MEM_CHECK_DEFINED: replace HAVE_valgrind 2021-03-26 07:58:49 +11:00
my_xml.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
myisam.h Added page_range to records_in_range() to improve range statistics 2020-03-27 03:54:45 +02:00
myisamchk.h MDEV-17913 Encrypted transactional Aria tables remain corrupt after crash recovery, automatic repairment does not work 2021-04-06 14:57:22 +03:00
myisammrg.h Added page_range to records_in_range() to improve range statistics 2020-03-27 03:54:45 +02:00
myisampack.h Fix all warnings given by UBSAN 2021-04-20 12:30:09 +03:00
mysql.h MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
mysql.h.pp Merge 10.5 into 10.6 2021-02-11 09:26:53 +02:00
mysql_com.h MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
mysql_com_server.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
mysql_embed.h Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00
mysql_time.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
mysql_version.h.in Merge 10.3 into 10.4 2020-10-29 13:38:38 +02:00
mysqld_default_groups.h Fixed that mariadb-# binaries reads their corresponding entry from my.cnf 2019-07-18 15:32:22 +03:00
mysys_err.h MDEV-7947 strcmp() takes 0.37% in OLTP RO 2020-07-23 10:54:33 +03:00
pack.h Merge branch '10.2' into bb-10.2-connector-c-integ-subm 2016-09-21 12:54:56 +02:00
password.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
pfs_file_provider.h perfschema compilation, test and misc fixes 2020-03-10 19:24:23 +01:00
pfs_idle_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_memory_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_metadata_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_socket_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_stage_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_statement_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_table_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_thread_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_transaction_provider.h cleanup: pass trxid by value 2020-03-10 19:24:23 +01:00
probes_mysql.d.base Update FSF Address 2019-05-11 21:29:06 +03:00
probes_mysql.h Update FSF Address 2019-05-11 21:29:06 +03:00
probes_mysql_nodtrace.h.in Merge branch '5.5' into 10.0 2016-02-15 22:50:59 +01:00
queues.h Merge branch '10.2' into 10.3 2020-05-04 16:47:11 +02:00
rijndael.h Update FSF Address 2019-05-11 21:29:06 +03:00
scope.h MDEV-22438 add a function similar to std::make_scope_exit() 2020-06-22 12:12:29 +03:00
service_versions.h Merge 10.4 into 10.5 2021-03-19 13:09:21 +02:00
source_revision.h.in SOURCE_REVISION should always be defined in source_revision.h 2017-11-01 13:20:32 +00:00
span.h span cleanup 2020-05-15 16:25:32 +03:00
sql_common.h MDEV-23238 - remove async client from server code. 2020-09-01 21:30:52 +02:00
ssl_compat.h WolfSSL v4.6.0-stable 2021-01-02 11:56:41 +02:00
sslopt-case.h MDEV-25511: Command line tools don't support CRL parameters 2021-05-31 08:29:37 +02:00
sslopt-longopts.h MDEV-14101 Provide an option to select TLS protocol version 2019-06-17 12:26:25 +02:00
sslopt-vars.h MDEV-14101 Provide an option to select TLS protocol version 2019-06-17 12:26:25 +02:00
t_ctype.h Update FSF Address 2019-05-11 21:29:06 +03:00
thr_alarm.h MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
thr_lock.h MDEV-13115: Implement SELECT SKIP LOCKED 2021-04-08 16:51:36 +10:00
thr_timer.h MDEV-16264 - prerequisite patch, periodic thr_timer 2019-11-15 16:50:22 +01:00
typelib.h Added 'const' to arguments in get_one_option and find_typeset() 2021-02-08 12:16:29 +02:00
violite.h MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
waiting_threads.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
welcome_copyright_notice.h Update FSF Address 2019-05-11 21:29:06 +03:00
wqueue.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
wsrep.h MDEV-9609 : wsrep_debug only logs DDL information on originating node 2021-05-15 13:24:22 +03:00