mariadb/mysql-test/suite
Marko Mäkelä 2bf6f2c054 MDEV-26077 Assertion err != DB_DUPLICATE_KEY or unexpected ER_TABLE_EXISTS_ERROR
This is a backport of 161e4bfafd.

trans_rollback_to_savepoint(): Only release metadata locks (MDL)
if the storage engines agree, after the changes were already rolled back.

Ever since commit 3792693f31
and mysql/mysql-server@55ceedbc3f
we used to cheat here and always release MDL if the binlog is disabled.

MDL are supposed to prevent race conditions between DML and DDL also
when no replication is in use. MDL are supposed to be a superset of
InnoDB table locks: InnoDB table lock may only exist if the thread
also holds MDL on the table name.

In the included test case, ROLLBACK TO SAVEPOINT would wrongly release
the MDL on both tables and let ALTER TABLE proceed, even though the DML
transaction is actually holding locks on the table.

Until commit 1bd681c8b3 (MDEV-25506)
in MariaDB 10.6, InnoDB would often work around the locking violation
in a blatantly non-ACID way: If locks exist on a table that is being
dropped (in this case, actually a partition of a table that is being
rebuilt by ALTER TABLE), InnoDB could move the table (or partition)
into a queue, to be dropped after the locks and references had been
released. If the lock is not released and the original copy of the
table not dropped quickly enough, a name conflict could occur on
a subsequent ALTER TABLE.

The scenario of commit 3792693f31
is unaffected by this fix, because mysqldump
would use non-locking reads, and the transaction would not be holding
any InnoDB locks during the execution of ROLLBACK TO SAVEPOINT.
MVCC reads inside InnoDB are only covered by MDL and page latches,
not by any table or record locks.

FIXME: It would be nice if storage engines were specifically asked
which MDL can be released, instead of only offering a choice
between all or nothing. InnoDB should be able to release any
locks for tables that are no longer in trx_t::mod_tables, except
if another transaction had converted some implicit record locks
to explicit ones, before the ROLLBACK TO SAVEPOINT had been completed.

Reviewed by: Sergei Golubchik
2021-07-02 11:15:35 +03:00
..
archive
binlog MDEV-22530: Aborting OPTIMIZE TABLE still logs in binary log and replicates to the Slave server. 2021-05-19 14:21:49 +05:30
binlog_encryption fix binlog_xa_recover test 2021-02-22 19:43:08 +01:00
csv
encryption MDEV-14180 Automatically disable key rotation checks for file_key_managment plugin 2021-06-15 13:15:32 +05:30
engines reenable tests from engines/funcs 2021-03-10 09:12:57 +01:00
federated MDEV-17573 Assertion in federatedx on multi-update 2020-12-09 20:15:29 +03:00
funcs_1 MDEV-25129 Add KEYWORDS view to the INFORMATION_SCHEMA 2021-06-29 16:15:24 +03:00
funcs_2 Merge 10.1 into 10.2 2020-07-01 12:03:55 +03:00
galera MDEV-25978 : rsync SST does not work with custom binlog name 2021-06-23 08:11:05 +03:00
galera_3nodes MDEV-21192: SST failing when enabling IPV6 2021-05-25 05:08:25 +02:00
gcol MDEV-24713 Assertion `dict_table_is_comp(index->table)' failed in row_merge_buf_add() 2021-06-15 13:15:32 +05:30
handler
heap MDEV-20604: Duplicate key value is silently truncated to 64 characters in print_keydup_error 2020-04-01 11:34:32 +02:00
innodb MDEV-26077 Assertion err != DB_DUPLICATE_KEY or unexpected ER_TABLE_EXISTS_ERROR 2021-07-02 11:15:35 +03:00
innodb_fts Adjusted test results after the fix for MDEV-20411 2021-06-26 08:51:17 -07:00
innodb_gis MDEV-25758 InnoDB spatial indexes miss large geometry fields after MDEV-25459 2021-05-27 15:01:19 +05:30
innodb_zip MDEV-18428 Memory: If transactional=0 is specified in CREATE TABLE, it is not possible to ALTER TABLE 2021-01-11 21:54:47 +01:00
jp
json
large_tests
maria MDEV-18428 Memory: If transactional=0 is specified in CREATE TABLE, it is not possible to ALTER TABLE 2021-01-11 21:54:47 +01:00
mariabackup MDEV-25884 Tests use environment $USER variable without quotes 2021-06-10 00:26:56 +03:00
mtr/t
mtr2
multi_source MDEV-23511 shutdown_server 10 times out, causing server kill at shutdown 2020-08-21 14:48:53 +03:00
optimizer_unfixed_bugs
parts Merge branch '10.1' into 10.2 2020-08-03 02:57:50 +03:00
percona MDEV-23511 shutdown_server 10 times out, causing server kill at shutdown 2020-08-21 14:48:53 +03:00
perfschema MDEV-25641 max_password_errors not working with ed25519 auth plugin 2021-05-22 21:56:51 +02:00
perfschema_stress
plugins MDEV-25884 Tests use environment $USER variable without quotes 2021-06-10 00:26:56 +03:00
roles MDEV-24289: show grants missing with grant option 2020-11-26 18:10:40 +01:00
rpl MDEV-17515: GTID Replication in optimistic mode deadlock 2021-05-17 16:38:58 +05:30
storage_engine MDEV-23511 shutdown_server 10 times out, causing server kill at shutdown 2020-08-21 14:48:53 +03:00
stress MDEV-22339 - Assertion `str_length < len' failed 2020-06-04 23:52:10 +02:00
sys_vars revive innodb_debug_sync 2021-04-27 11:51:17 +03:00
unit
vcol MDEV-25672 table alias from previous statement interferes later commands 2021-06-02 23:10:42 +02:00
wsrep Merge branch 'bb-10.2-release' into 10.2 2021-02-22 18:43:03 +01:00