mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#54747: Deadlock between REORGANIZE PARTITION and SELECT is not detected
The ALTER PARTITION and SELECT seemed to be deadlocked when having innodb_thread_concurrency = 1. Problem was that there was unreleased latches in the ALTER PARTITION thread which was needed by the SELECT thread to be able to continue. Solution was to release the latches by commit before requesting upgrade to exclusive MDL lock. Updated according to reviewers comments (3).
This commit is contained in:
@ -1,5 +1,41 @@
|
||||
drop table if exists t1, t2;
|
||||
#
|
||||
# Bug#54747: Deadlock between REORGANIZE PARTITION and
|
||||
# SELECT is not detected
|
||||
#
|
||||
SET @old_innodb_thread_concurrency:= @@innodb_thread_concurrency;
|
||||
SET GLOBAL innodb_thread_concurrency = 1;
|
||||
CREATE TABLE t1
|
||||
(user_num BIGINT,
|
||||
hours SMALLINT,
|
||||
KEY user_num (user_num))
|
||||
ENGINE = InnoDB
|
||||
PARTITION BY RANGE COLUMNS (hours)
|
||||
(PARTITION hour_003 VALUES LESS THAN (3),
|
||||
PARTITION hour_004 VALUES LESS THAN (4),
|
||||
PARTITION hour_005 VALUES LESS THAN (5),
|
||||
PARTITION hour_last VALUES LESS THAN (MAXVALUE));
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
|
||||
BEGIN;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
5
|
||||
# con1
|
||||
# SEND a ALTER PARTITION which waits on the ongoing transaction.
|
||||
ALTER TABLE t1
|
||||
REORGANIZE PARTITION hour_003, hour_004 INTO
|
||||
(PARTITION oldest VALUES LESS THAN (4));
|
||||
# Connection default wait until the ALTER is in 'waiting for table...'
|
||||
# state and then continue the transaction by trying a SELECT
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
5
|
||||
COMMIT;
|
||||
# con1, reaping ALTER.
|
||||
# Disconnecting con1 and switching to default. Cleaning up.
|
||||
SET GLOBAL innodb_thread_concurrency = @old_innodb_thread_concurrency;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#50418: DROP PARTITION does not interact with transactions
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
|
Reference in New Issue
Block a user