mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 03:17:20 +02:00
Bug #20476395 DICT_LOAD_FOREIGNS() FAILED IN COMMIT_INPLACE_ALTER_TABLE
Problem: Suppose there are two tables in the database related through a foreign key constraint - the parent table and the child table. Suppose there is an ALTER TABLE on the child table which gets interrupted in such a way that the child table is not available any more. After crash recovery, an ALTER TABLE on the parent table identifies that its foreign keys cannot be loaded. This results in an error and a debug assert. Solution: Remove the debug assert and change error to a warning. rb#8658 approved by Marko.
This commit is contained in:
parent
91659983eb
commit
a1f392a944
2 changed files with 62 additions and 0 deletions
25
mysql-test/suite/innodb/r/alter_foreign_crash.result
Normal file
25
mysql-test/suite/innodb/r/alter_foreign_crash.result
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# Bug #20476395 DICT_LOAD_FOREIGNS() FAILED IN
|
||||
# COMMIT_INPLACE_ALTER_TABLE
|
||||
#
|
||||
call mtr.add_suppression("InnoDB: Failed to load table");
|
||||
create database bug;
|
||||
use bug;
|
||||
create table parent(a serial) engine=innodb;
|
||||
create table child(a serial, foreign key fk (a) references parent(a));
|
||||
insert into parent values(1);
|
||||
insert into child values(1);
|
||||
SET DEBUG_SYNC='innodb_rename_table_ready SIGNAL s1 WAIT_FOR s2 EXECUTE 2';
|
||||
ALTER TABLE child ROW_FORMAT=DYNAMIC, ALGORITHM=COPY;
|
||||
SET DEBUG_SYNC='now WAIT_FOR s1';
|
||||
SET DEBUG_SYNC='now SIGNAL s2 WAIT_FOR s1';
|
||||
# Kill and restart
|
||||
show tables;
|
||||
Tables_in_bug
|
||||
parent
|
||||
alter table parent row_format=dynamic;
|
||||
Warnings:
|
||||
Warning 1088 InnoDB: Could not add foreign key constraints.
|
||||
drop table parent;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
|
||||
drop database bug;
|
||||
37
mysql-test/suite/innodb/t/alter_foreign_crash.test
Normal file
37
mysql-test/suite/innodb/t/alter_foreign_crash.test
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
--source include/have_innodb.inc
|
||||
--source include/have_debug_sync.inc
|
||||
# The embedded server does not support restarting.
|
||||
--source include/not_embedded.inc
|
||||
|
||||
--echo #
|
||||
--echo # Bug #20476395 DICT_LOAD_FOREIGNS() FAILED IN
|
||||
--echo # COMMIT_INPLACE_ALTER_TABLE
|
||||
--echo #
|
||||
|
||||
call mtr.add_suppression("InnoDB: Failed to load table");
|
||||
|
||||
create database bug;
|
||||
use bug;
|
||||
|
||||
create table parent(a serial) engine=innodb;
|
||||
create table child(a serial, foreign key fk (a) references parent(a));
|
||||
|
||||
insert into parent values(1);
|
||||
insert into child values(1);
|
||||
|
||||
connect (con1,localhost,root,,bug);
|
||||
SET DEBUG_SYNC='innodb_rename_table_ready SIGNAL s1 WAIT_FOR s2 EXECUTE 2';
|
||||
--send ALTER TABLE child ROW_FORMAT=DYNAMIC, ALGORITHM=COPY
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR s1';
|
||||
SET DEBUG_SYNC='now SIGNAL s2 WAIT_FOR s1';
|
||||
--source include/kill_and_restart_mysqld.inc
|
||||
disconnect con1;
|
||||
|
||||
show tables;
|
||||
alter table parent row_format=dynamic;
|
||||
|
||||
--error ER_ROW_IS_REFERENCED
|
||||
drop table parent;
|
||||
|
||||
drop database bug;
|
||||
Loading…
Add table
Add a link
Reference in a new issue