| 1 |
# |
| 2 |
# Bug #20476395 DICT_LOAD_FOREIGNS() FAILED IN |
| 3 |
# COMMIT_INPLACE_ALTER_TABLE |
| 4 |
# |
| 5 |
call mtr.add_suppression("InnoDB: Failed to load table"); |
| 6 |
CREATE DATABASE Bug; |
| 7 |
CREATE TABLE Bug.parent(a SERIAL) ENGINE=INNODB; |
| 8 |
CREATE TABLE Bug.child(a SERIAL, FOREIGN KEY f(a) REFERENCES Bug.parent(a)) |
| 9 |
ENGINE=INNODB; |
| 10 |
create database bug; |
| 11 |
use bug; |
| 12 |
create table parent(a serial) engine=innodb; |
| 13 |
create table child(a serial, foreign key fk (a) references parent(a))engine=innodb; |
| 14 |
insert into parent values(1); |
| 15 |
insert into child values(1); |
| 16 |
drop database Bug; |
| 17 |
connect con1,localhost,root,,bug; |
| 18 |
SET DEBUG_SYNC='innodb_rename_table_ready SIGNAL s1 WAIT_FOR s2 EXECUTE 2'; |
| 19 |
ALTER TABLE child ROW_FORMAT=DYNAMIC, ALGORITHM=COPY; |
| 20 |
connection default; |
| 21 |
SET DEBUG_SYNC='now WAIT_FOR s1'; |
| 22 |
SET DEBUG_SYNC='now SIGNAL s2 WAIT_FOR s1'; |
| 23 |
# restart |
| 24 |
disconnect con1; |
| 25 |
show tables; |
| 26 |
Tables_in_bug |
| 27 |
child |
| 28 |
parent |
| 29 |
alter table parent row_format=dynamic; |
| 30 |
select * from child; |
| 31 |
a |
| 32 |
1 |
| 33 |
drop table parent; |
| 34 |
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails |
| 35 |
drop table child; |
| 36 |
drop table parent; |
| 37 |
drop database bug; |