mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
78 lines
1.7 KiB
Text
78 lines
1.7 KiB
Text
#
|
|
# Bug #23755664 DEADLOCK WITH 3 CONCURRENT DELETES BY UNIQUE KEY
|
|
#
|
|
connection default;
|
|
CREATE TABLE `t`(
|
|
`id` INT,
|
|
`a` INT DEFAULT NULL,
|
|
PRIMARY KEY(`id`),
|
|
UNIQUE KEY `u`(`a`)
|
|
) ENGINE=InnoDB;
|
|
INSERT INTO t (`id`,`a`) VALUES
|
|
(1,1),
|
|
(2,9999),
|
|
(3,10000);
|
|
connect deleter,localhost,root,,;
|
|
connect holder,localhost,root,,;
|
|
connect waiter,localhost,root,,;
|
|
connection deleter;
|
|
SET DEBUG_SYNC =
|
|
'lock_sec_rec_read_check_and_lock_has_locked
|
|
SIGNAL deleter_has_locked
|
|
WAIT_FOR waiter_has_locked';
|
|
DELETE FROM t WHERE a = 9999;
|
|
connection holder;
|
|
SET DEBUG_SYNC=
|
|
'now WAIT_FOR deleter_has_locked';
|
|
SET DEBUG_SYNC=
|
|
'lock_sec_rec_read_check_and_lock_has_locked SIGNAL holder_has_locked';
|
|
DELETE FROM t WHERE a = 9999;
|
|
connection waiter;
|
|
SET DEBUG_SYNC=
|
|
'now WAIT_FOR holder_has_locked';
|
|
SET DEBUG_SYNC=
|
|
'lock_sec_rec_read_check_and_lock_has_locked SIGNAL waiter_has_locked';
|
|
DELETE FROM t WHERE a = 9999;
|
|
connection deleter;
|
|
connection holder;
|
|
connection waiter;
|
|
connection default;
|
|
disconnect deleter;
|
|
disconnect holder;
|
|
disconnect waiter;
|
|
DROP TABLE `t`;
|
|
SET DEBUG_SYNC='reset';
|
|
CREATE TABLE `t`(
|
|
`id` INT NOT NULL PRIMARY KEY
|
|
) ENGINE=InnoDB;
|
|
INSERT INTO t (`id`) VALUES (1), (2);
|
|
connect holder,localhost,root,,;
|
|
connect waiter,localhost,root,,;
|
|
connection holder;
|
|
BEGIN;
|
|
SELECT id FROM t WHERE id=1 FOR UPDATE;
|
|
id
|
|
1
|
|
SELECT id FROM t WHERE id=2 FOR UPDATE;
|
|
id
|
|
2
|
|
connection waiter;
|
|
SET DEBUG_SYNC=
|
|
'lock_wait_before_suspend SIGNAL waiter_will_wait';
|
|
SELECT id FROM t WHERE id = 1 FOR UPDATE;
|
|
connection holder;
|
|
SET DEBUG_SYNC=
|
|
'now WAIT_FOR waiter_will_wait';
|
|
SELECT * FROM t FOR UPDATE;
|
|
id
|
|
1
|
|
2
|
|
COMMIT;
|
|
connection waiter;
|
|
id
|
|
1
|
|
connection default;
|
|
disconnect holder;
|
|
disconnect waiter;
|
|
DROP TABLE `t`;
|
|
SET DEBUG_SYNC='reset';
|