Bug #95743 | core at create table with FK for table transferred from MyISAM to InnoDB | ||
---|---|---|---|
Submitted: | 12 Jun 2019 8:06 | Modified: | 14 May 2020 17:23 |
Reporter: | dave do | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S3 (Non-critical) |
Version: | 8.0.16 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[12 Jun 2019 8:06]
dave do
[12 Jun 2019 8:14]
MySQL Verification Team
Hello Dave do, Thank you for the report and test case. Observed that 8.0.16 debug build is affected. regards, Umesh
[25 Nov 2019 7:47]
dave do
there are some updates for this issue. we found this issue may cause deadlock in some situation, after our further test. so please consider to reaise the Severity of this issue to S3/S2. and root cause issue, in my opinion, it is because the engine_substitution process is too late while we put it in create_table_impl now. I think we should advance these process to Sql_cmd_create_table::execute instead. deadlock info like this: ---TRANSACTION 19684203, ACTIVE 316 sec adding foreign keys 8 lock struct(s), heap size 1136, 4 row lock(s), undo log entries 35 MySQL thread id 897, OS thread handle 140367571412736, query id 10832956 192.107.57.39 root Waiting for table metadata lock =====> Wait MDL ddl_create_drop_foreign_key_table_005_table_0d create table ddl_create_drop_foreign_key_table_005_table_1 ( w_id bigint not null AUTO_INCREMENT, w_name varchar(10), w_street_1 varchar(20), w_street_2 varchar(20), w_city varchar(20), w_state char(2), w_zip char(9), w_tax decimal(4,2), w_ytd decimal(12,2), foreign key (w_id) REFERENCES ddl_create_drop_foreign_key_table_005_table_0d(c_bigint) ON UPDATE RESTRICT ON DELETE RESTRICT) Engine=MyISAM ---TRANSACTION 19681886, ACTIVE 317 sec 23 lock struct(s), heap size 1136, 107 row lock(s), undo log entries 206 MySQL thread id 898, OS thread handle 140367571121920, query id 10829170 192.107.57.39 root rename result table alter table ddl_create_drop_foreign_key_table_005_table_3 add constraint fkey_ddl_create_drop_foreign_key_table_005_table_3 foreign key(c_bigint) references ddl_create_drop_foreign_key_table_005_table_0d(c_bigint) Trx read view will not see trx with id >= 19682317, sees < 19655331 ---TRANSACTION 19683190, ACTIVE 316 sec dropping table 4 lock struct(s), heap size 1136, 12 row lock(s), undo log entries 24 MySQL thread id 902, OS thread handle 140367632852736, query id 10829654 192.107.57.39 root checking permissions drop table if exists ddl_create_drop_partition_table_004_key_1 --Thread 140367571121920 has waited at dict0stats.cc line 3225 for 316 seconds the semaphore: X-lock on RW-latch at 0x7fac207b1dd8 created in file dict0dict.cc line 1047 a writer (thread id 140367632852736) has reserved it in mode exclusive number of readers 0, waiters flag 1, lock_word: 0 Last time read locked in file not yet reserved line 0 Last time write locked in file /src/sql/storage/innobase/row/row0mysql.cc line 3834 --Thread 140367632852736 has waited at dict0dict.h line 1171 for 316 seconds the semaphore: X-lock on RW-latch at 0x7fac227a5918 created in file dict0dict.cc line 1038 a writer (thread id 140367571412736) has reserved it in mode exclusive number of readers 0, waiters flag 1, lock_word: 0 Last time read locked in file dict0dict.h line 1169 Last time write locked in file /src/sql/storage/innobase/include/dict0dict.h line 1171 summary as: 140367571412736 create table , hold dict sys lock, wait for MDL of ddl_create_drop_foreign_key_table_005_table_0d 140367571121920 alter table , hold MDL, wait for dict stats lock 140367632852736 drop table , hold dict stats lock, wait for dict sys lock detail stack info I will put in the files tab.
[25 Nov 2019 7:49]
dave do
Deadlock stack info of Bug #95743
Attachment: Deadlock stack info of Bug #95743.log (application/octet-stream, text), 20.33 KiB.
[26 Nov 2019 2:38]
dave do
Not only have assert in debug build, but also deadlock in release build.
[14 May 2020 17:23]
Paul DuBois
Posted by developer: Fixed in 8.0.21. An assertion was raised if creating a child table in a foreign key relation caused an engine substitution.