mirror of
https://github.com/MariaDB/server.git
synced 2025-09-11 05:52:26 +03:00
The code was backported from 10.6 bd03c0e516
commit. See that commit message for details.
Apart from the above commit trx_lock_t::wait_trx was also backported from
MDEV-24738. trx_lock_t::wait_trx is protected with lock_sys.wait_mutex
in 10.6, but that mutex was implemented only in MDEV-24789. As there is no
need to backport MDEV-24789 for MDEV-27025,
trx_lock_t::wait_trx is protected with the same mutexes as
trx_lock_t::wait_lock.
This fix should not break innodb-lock-schedule-algorithm=VATS. This
algorithm uses an Eldest-Transaction-First (ETF) heuristic, which prefers
older transactions over new ones. In this fix we just insert granted lock
just before the last granted lock of the same transaction, what does not
change transactions execution order.
The changes in lock_rec_create_low() should not break Galera Cluster,
there is a big "if" branch for WSREP. This branch is necessary to provide
the correct transactions execution order, and should not be changed for
the current bug fix.
28 lines
924 B
Plaintext
28 lines
924 B
Plaintext
#
|
|
# MDEV-27025 insert-intention lock conflicts with waiting ORDINARY lock
|
|
#
|
|
CREATE TABLE t (a INT PRIMARY KEY, b INT NOT NULL UNIQUE) ENGINE=InnoDB;
|
|
connect prevent_purge,localhost,root,,;
|
|
start transaction with consistent snapshot;
|
|
connection default;
|
|
INSERT INTO t VALUES (20,20);
|
|
DELETE FROM t WHERE b = 20;
|
|
connect con_ins,localhost,root,,;
|
|
SET DEBUG_SYNC = 'row_ins_sec_index_entry_dup_locks_created SIGNAL ins_set_locks WAIT_FOR ins_cont';
|
|
INSERT INTO t VALUES(10, 20);
|
|
connect con_del,localhost,root,,;
|
|
SET DEBUG_SYNC = 'now WAIT_FOR ins_set_locks';
|
|
SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL del_locked';
|
|
DELETE FROM t WHERE b = 20;
|
|
connection default;
|
|
SET DEBUG_SYNC = 'now WAIT_FOR del_locked';
|
|
SET DEBUG_SYNC = 'now SIGNAL ins_cont';
|
|
connection con_ins;
|
|
disconnect con_ins;
|
|
connection con_del;
|
|
disconnect con_del;
|
|
disconnect prevent_purge;
|
|
connection default;
|
|
SET DEBUG_SYNC = 'RESET';
|
|
DROP TABLE t;
|