1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-31812 Add switch to old_mode to disable non-locking ALTER

Add LOCK_ALTER_TABE_COPY bit to old_mode. Disables online copy by default,
but still allows to force it with explicit lock=none
This commit is contained in:
Nikita Malyavin
2023-08-08 18:07:56 +04:00
committed by Sergei Golubchik
parent a1af525588
commit 8aa1a9e6a7
10 changed files with 98 additions and 7 deletions

View File

@ -1650,6 +1650,52 @@ select * from t;
drop table t;
set debug_sync= reset;
--echo #
--echo # MDEV-31812 Add switch to old_mode to disable non-locking ALTER
--echo #
set @old_old_mode= @@old_mode;
create or replace table t1 (a int primary key, b int);
set debug_sync= 'alter_table_copy_end SIGNAL copy_end WAIT_FOR proceed';
send alter table t1 drop primary key, add primary key(b), algorithm= copy;
--connection con2
set debug_sync= 'now WAIT_FOR copy_end';
select if(max_stage = 4, "online", "old") as mode
from information_schema.processlist where id = @con;
set debug_sync= 'now SIGNAL proceed';
--connection default
--reap
set old_mode= LOCK_ALTER_TABLE_COPY;
set debug_sync= 'alter_table_copy_end SIGNAL copy_end WAIT_FOR proceed';
send alter table t1 drop primary key, add primary key(b), algorithm= copy;
--connection con2
set debug_sync= 'now WAIT_FOR copy_end';
select if(max_stage = 4, "online", "old") as mode
from information_schema.processlist where id = @con;
set debug_sync= 'now SIGNAL proceed';
--connection default
--reap
set debug_sync= 'alter_table_copy_end SIGNAL copy_end WAIT_FOR proceed';
send alter table t1 drop primary key, add primary key(b),
algorithm= copy, lock=none;
--connection con2
set debug_sync= 'now WAIT_FOR copy_end';
select if(max_stage = 4, "online", "old") as mode
from information_schema.processlist where id = @con;
set debug_sync= 'now SIGNAL proceed';
--connection default
--reap
set old_mode= @old_old_mode;
drop table t1;
set debug_sync= reset;
--disconnect con1
--disconnect con2
--echo #