mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
78a04a4c22
1. The merge aeccbbd926
has overwritten
lock0lock.cc, and the changes of MDEV-29622 and MDEV-29635 were
partially lost, this commit restores the changes.
2. innodb.deadlock_wait_thr_race test:
The following hang was found during testing.
There is deadlock_report_before_lock_releasing sync point in
Deadlock::report(), which is waiting for sel_cont signal under lock_sys_t
lock. The signal must be issued after "UPDATE t SET b = 100" rollback,
and that rollback is executing undo record, which is blocked
on dict_sys latch request. dict_sys is locked by the thread of statistics
update(dict_stats_save()), and during that update lock_sys lock is
requested, and can't be acquired as Deadlock::report() holds it. We have
to disable statistics update to make the test stable.
But even if statistics update is disabled, and transaction with consistent
snapshot is started at the very beginning of the test to prevent purging,
the purge can still be invoked for system tables, and it tries to open
system table by id, what causes dict_sys.freeze() call and dict_sys
latching. What, in combination with lock_sys::xx_lock() causes the same
deadlock as described above. We need to disable purging globally for the
test as well.
All the above is applicable to innodb.deadlock_wait_lock_race test also.
27 lines
907 B
Text
27 lines
907 B
Text
CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB STATS_PERSISTENT=0;
|
|
CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB STATS_PERSISTENT=0;
|
|
INSERT INTO t VALUES (10, 10), (20, 20), (30, 30);
|
|
INSERT INTO t2 VALUES (10), (20), (30);
|
|
BEGIN;
|
|
UPDATE t2 SET a = a + 100;
|
|
SELECT * FROM t WHERE a = 20 FOR UPDATE;
|
|
a b
|
|
20 20
|
|
connect con_2,localhost,root,,;
|
|
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
|
BEGIN;
|
|
SET DEBUG_SYNC = 'lock_trx_handle_wait_before_unlocked_wait_lock_check SIGNAL upd_locked WAIT_FOR upd_cont';
|
|
UPDATE t SET b = 100;
|
|
connection default;
|
|
SET DEBUG_SYNC="now WAIT_FOR upd_locked";
|
|
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL upd_cont";
|
|
SELECT * FROM t WHERE a = 10 FOR UPDATE;
|
|
connection con_2;
|
|
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
|
disconnect con_2;
|
|
connection default;
|
|
a b
|
|
10 10
|
|
SET DEBUG_SYNC = 'RESET';
|
|
DROP TABLE t;
|
|
DROP TABLE t2;
|