Bug #83799 | InnoDB: Assertion failure in thread x in file handler0alter.cc line 5817 | ||
---|---|---|---|
Submitted: | 14 Nov 2016 5:50 | Modified: | 14 Nov 2016 6:53 |
Reporter: | Roel Van de Paar | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
Version: | 5.6.34, 5.7.16 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | debug |
[14 Nov 2016 5:50]
Roel Van de Paar
[14 Nov 2016 5:51]
Roel Van de Paar
code in storage/innobase/handler/handler0alter.cc (from 5.7); /* Test the case when referenced_table failed to open, if trx->check_foreigns is not set, we should still be able to add the foreign key */ DBUG_EXECUTE_IF("innodb_test_open_ref_fail", referenced_table = NULL;); and as SESSION.foreign_key_checks=0 it seems it should still be able to add the foreign key [but perhaps not when it's on the same table?]
[14 Nov 2016 5:55]
Roel Van de Paar
ref bug 76445
[14 Nov 2016 6:53]
MySQL Verification Team
Hello Roel, Thank you for the report and test case. Observed that 5.6.34/5.7.16 debug builds are affected. Thanks, Umesh
[10 Oct 2017 16:51]
MySQL Verification Team
https://bugs.mysql.com/bug.php?id=88046 marked as duplicate of this one.
[23 Aug 2020 13:09]
lalit Choudhary
Few more test cases for 5.6.49, not reproducible with latest 5.7.31 -------------- MySQL 5.6.49 -------------- Case1: crash whiling adding column, drop database test; create database test; use test; CREATE TABLE t1 (a INT, KEY(a), UNIQUE(a), FOREIGN KEY (a) REFERENCES t1 (a)) ENGINE=InnoDB; SET SESSION FOREIGN_KEY_CHECKS= OFF ; ALTER TABLE t1 DROP INDEX a; ALTER TABLE t1 ADD COLUMN v INT; mysql [localhost] {msandbox} (test) > ALTER TABLE t1 ADD COLUMN v INT; ERROR 1215 (HY000): Cannot add foreign key constraint mysql [localhost] {msandbox} (test) > mysql log: Version: '5.6.49' socket: '/tmp/mysql_sandbox5649.sock' port: 5649 MySQL Community Server (GPL) 2020-08-23 18:23:00 28872 [ERROR] InnoDB: dict_load_foreigns() returned 38 for ALTER TABLE t1 ADD COLUMN v INT Case2:adding index, drop database test1; create database test1; use test1; CREATE TABLE t1 (f VARCHAR(256)) ENGINE=InnoDB; SET SESSION FOREIGN_KEY_CHECKS= OFF ; ALTER TABLE t1 ADD FOREIGN KEY (f) REFERENCES non_existing_table (x); ALTER TABLE t1 ADD FULLTEXT INDEX ft1 (f); mysql [localhost] {msandbox} (test1) > ALTER TABLE t1 ADD FULLTEXT INDEX ft1 (f); ERROR 1215 (HY000): Cannot add foreign key constraint mysql [localhost] {msandbox} (test1) > mysql log: Version: '5.6.49' socket: '/tmp/mysql_sandbox5649.sock' port: 5649 MySQL Community Server (GPL) 2020-08-23 18:23:00 28872 [ERROR] InnoDB: dict_load_foreigns() returned 38 for ALTER TABLE t1 ADD COLUMN v INT 2020-08-23 18:26:14 28872 [ERROR] InnoDB: dict_load_foreigns() returned 38 for ALTER TABLE t1 ADD FULLTEXT INDEX ft1 (f) Next restart has warnings, 2020-08-23 18:28:53 3207 [Note] InnoDB: Completed initialization of buffer pool 2020-08-23 18:28:53 3207 [Note] InnoDB: Highest supported file format is Barracuda. 2020-08-23 18:28:53 3207 [Warning] InnoDB: Load table 'test1/t1' failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again. 2020-08-23 18:28:53 3207 [Warning] InnoDB: Load table 'test1/t1' failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again. 2020-08-23 18:28:53 3207 [Warning] InnoDB: Load table 'test1/t1' failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again. 2020-08-23 18:28:53 3207 [Warning] InnoDB: Parent table of FTS auxiliary table test1/FTS_0000000000000017_000000000000001e_INDEX_6 not found. 2020-08-23 18:28:53 3207 [Warning] InnoDB: Load table 'test1/t1' failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again. 2020-08-23 18:28:53 3207 [Warning] InnoDB: Parent table of FTS auxiliary table test1/FTS_0000000000000017_BEING_DELETED not found. 2020-08-23 18:28:53 3207 [Warning] InnoDB: Load table 'test1/t1' failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again. 2020-08-23 18:28:53 3207 [Warning] InnoDB: Parent table of FTS auxiliary table test1/FTS_0000000000000017_BEING_DELETED_CACHE not found. 2020-08-23 18:28:53 3207 [Warning] InnoDB: Load table 'test1/t1' failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again. 2020-08-23 18:28:53 3207 [Warning] InnoDB: Parent table of FTS auxiliary table test1/FTS_0000000000000017_CONFIG not found. 2020-08-23 18:28:53 3207 [Warning] InnoDB: Load table 'test1/t1' failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again. 2020-08-23 18:28:53 3207 [Warning] InnoDB: Parent table of FTS auxiliary table test1/FTS_0000000000000017_DELETED not found. 2020-08-23 18:28:53 3207 [Warning] InnoDB: Load table 'test1/t1' failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again. 2020-08-23 18:28:53 3207 [Warning] InnoDB: Parent table of FTS auxiliary table test1/FTS_0000000000000017_DELETED_CACHE not found. ------------- MySQL 5.7.31 ------------- In MySQL 5.7.31 behavior is different it gives warnings for ALTER, no error in mysql log. Case1: mysql [localhost] {msandbox} (test) > ALTER TABLE t1 ADD COLUMN v INT; Query OK, 0 rows affected, 1 warning (0.11 sec) Records: 0 Duplicates: 0 Warnings: 1 mysql [localhost] {msandbox} (test) > show warnings; +---------+------+------------------------------------------------+ | Level | Code | Message | +---------+------+------------------------------------------------+ | Warning | 1088 | InnoDB: Could not add foreign key constraints. | +---------+------+------------------------------------------------+ 1 row in set (0.00 sec) Case2: mysql [localhost] {msandbox} (test) > ALTER TABLE t1 ADD FULLTEXT INDEX ft1 (f); Query OK, 0 rows affected, 2 warnings (0.41 sec) Records: 0 Duplicates: 0 Warnings: 2 mysql [localhost] {msandbox} (test) > show warnings; +---------+------+--------------------------------------------------+ | Level | Code | Message | +---------+------+--------------------------------------------------+ | Warning | 124 | InnoDB rebuilding table to add column FTS_DOC_ID | | Warning | 1088 | InnoDB: Could not add foreign key constraints. | +---------+------+--------------------------------------------------+ 2 rows in set (0.00 sec)
[23 Aug 2020 13:11]
lalit Choudhary
Crash when using debug build 5.6
[23 Aug 2020 14:39]
lalit Choudhary
5.7 also affected with different behavior. Run case1 and case2,restart mysql and try to access these tables, mysql [localhost] {msandbox} (test) > ALTER TABLE t1 ADD FULLTEXT INDEX ft1 (f); Query OK, 0 rows affected, 2 warnings (0.41 sec) Records: 0 Duplicates: 0 Warnings: 2 mysql [localhost] {msandbox} (test) > show warnings; +---------+------+--------------------------------------------------+ | Level | Code | Message | +---------+------+--------------------------------------------------+ | Warning | 124 | InnoDB rebuilding table to add column FTS_DOC_ID | | Warning | 1088 | InnoDB: Could not add foreign key constraints. | +---------+------+--------------------------------------------------+ 2 rows in set (0.00 sec) mysql [localhost] {msandbox} (test) > show create table t1; ERROR 1146 (42S02): Table 'test.t1' doesn't exist 2020-08-23T14:30:18.236096Z 2 [Warning] InnoDB: Load table `test`.`t1` failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again. 2020-08-23T14:30:18.236248Z 2 [Warning] InnoDB: Cannot open table test/t1 from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue. mysql [localhost] {msandbox} (test) > drop database test; ERROR 1010 (HY000): Error dropping database (can't rmdir './test', errno: 39) 2020-08-23T14:36:40.187472Z 2 [Warning] InnoDB: Load table `test`.`t1` failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again. 2020-08-23T14:36:40.187696Z 2 [ERROR] InnoDB: Cannot load table test/t1 from InnoDB internal data dictionary during drop database