1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

don't crash if ALTER TABLE fails and a long transaction blocks MDL upgrade

This commit is contained in:
Sergei Golubchik
2022-06-01 21:52:27 +02:00
parent 332f41aae3
commit b2be2e39a6
6 changed files with 77 additions and 31 deletions

View File

@ -22,6 +22,36 @@ a b
123 NULL
456 NULL
789 NULL
# Insert, error
create or replace table t1 (a int);
insert t1 values (5), (5);
connection con2;
set debug_sync= 'now WAIT_FOR ended';
connection default;
set session lock_wait_timeout=1;
set debug_sync= 'alter_table_copy_end SIGNAL ended WAIT_FOR end';
alter table t1 add unique (a), algorithm= copy, lock= none;
connection con2;
start transaction;
insert into t1 values (123), (456), (789);
set debug_sync= 'now SIGNAL end';
connection default;
ERROR 23000: Duplicate entry '5' for key 'a'
connection con2;
commit;
connection default;
select variable_value into @otd from information_schema.session_status where variable_name='Opened_table_definitions';
select * from t1;
a
5
5
123
456
789
select variable_value-@otd from information_schema.session_status where variable_name='Opened_table_definitions';
variable_value-@otd
1
set session lock_wait_timeout=default;
# long transaction and add column
create or replace table t1 (a int);
insert t1 values (5);