1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-28930 ALTER TABLE Deadlocks with parallel TL_WRITE

ALTER ONLINE TABLE acquires table with TL_READ. Myisam normally acquires
TL_WRITE for DML, which makes it hang until table is freed.

We deadlock once ALTER upgrades its MDL lock.

Solution:
Unlock table earlier. We don't need to hold TL_READ once we finished
copying. Relay log replication requires no data locks on `from` table.
This commit is contained in:
Nikita Malyavin
2022-06-29 20:16:19 +03:00
committed by Sergei Golubchik
parent 8fbdc76038
commit 2ed03a41e6
5 changed files with 65 additions and 9 deletions

View File

@ -717,6 +717,39 @@ drop table t1;
drop table t2;
drop table t3;
--echo #
--echo # MDEV-28930 ALTER TABLE Deadlocks with parallel TL_WRITE
--echo #
create table t1(a int) engine=myisam select 1;
set debug_sync='alter_table_online_before_lock SIGNAL ready WAIT_FOR go_for_locking';
--send
alter table t1 force;
--connection con2
set debug_sync='now WAIT_FOR ready';
set debug_sync='thr_multi_lock_before_thr_lock SIGNAL go_for_locking';
update t1 set a=2;
--connection default
--reap
set debug_sync='alter_table_online_before_lock SIGNAL ready WAIT_FOR go_for_locking';
--send
alter table mysql.global_priv force;
--connection con2
set debug_sync='now WAIT_FOR ready';
set debug_sync='thr_multi_lock_before_thr_lock SIGNAL go_for_locking';
create user user1@localhost;
--connection default
--reap
set debug_sync=reset;
drop user user1@localhost;
drop table t1;
--echo #
--echo # MDEV-28959 Online alter ignores strict table mode
--echo #