mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-27962 Instant DDL downgrades the MDL when table is empty
- Server incorrectly downgrading the MDL after prepare phase when
table is empty. mdl_exclusive_after_prepare is being set in
prepare phase only. But mdl_exclusive_after_prepare condition was
misplaced and checked before prepare phase by
commit d270525dfd
and it is now
changed to check after prepare phase.
- main.innodb_mysql_sync test case was changed to avoid locking
optimization when table is empty.
This commit is contained in:
@ -131,6 +131,7 @@ connection default;
|
||||
DROP DATABASE db1;
|
||||
# Test 2: Primary index (implicit), should block writes.
|
||||
CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb;
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
|
||||
# Sending:
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(a), LOCK=SHARED;
|
||||
@ -139,15 +140,16 @@ SET DEBUG_SYNC= "now WAIT_FOR manage";
|
||||
USE test;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 2
|
||||
# Sending:
|
||||
UPDATE t1 SET a=NULL;
|
||||
UPDATE t1 SET a=3;
|
||||
connection con2;
|
||||
# Waiting for SELECT to be blocked by the metadata lock on t1
|
||||
SET DEBUG_SYNC= "now SIGNAL query";
|
||||
connection default;
|
||||
# Reaping: ALTER TABLE t1 ADD UNIQUE INDEX(a)
|
||||
connection con1;
|
||||
# Reaping: UPDATE t1 SET a=NULL
|
||||
# Reaping: UPDATE t1 SET a=3
|
||||
# Test 3: Primary index (explicit), should block writes.
|
||||
connection default;
|
||||
ALTER TABLE t1 DROP INDEX a;
|
||||
@ -158,15 +160,16 @@ connection con1;
|
||||
SET DEBUG_SYNC= "now WAIT_FOR manage";
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
3 2
|
||||
# Sending:
|
||||
UPDATE t1 SET a=NULL;
|
||||
UPDATE t1 SET a=4;
|
||||
connection con2;
|
||||
# Waiting for SELECT to be blocked by the metadata lock on t1
|
||||
SET DEBUG_SYNC= "now SIGNAL query";
|
||||
connection default;
|
||||
# Reaping: ALTER TABLE t1 ADD PRIMARY KEY (a)
|
||||
connection con1;
|
||||
# Reaping: UPDATE t1 SET a=NULL
|
||||
# Reaping: UPDATE t1 SET a=4
|
||||
# Test 4: Secondary unique index, should not block reads.
|
||||
connection default;
|
||||
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
|
||||
@ -176,6 +179,7 @@ connection con1;
|
||||
SET DEBUG_SYNC= "now WAIT_FOR manage";
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
4 2
|
||||
SET DEBUG_SYNC= "now SIGNAL query";
|
||||
connection default;
|
||||
# Reaping: ALTER TABLE t1 ADD UNIQUE (b)
|
||||
|
Reference in New Issue
Block a user