Bug #92449 InnoDB: Assertion failure: dict0dd.cc:840:0
Submitted: 17 Sep 2018 5:26 Modified: 14 Jun 2019 6:12
Reporter: Roel Van de Paar Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S6 (Debug Builds)
Version:8.0.12, 8.0.16 OS:Any
Assigned to: CPU Architecture:Any

[17 Sep 2018 5:26] Roel Van de Paar
Description:
2018-09-17T05:15:15.456988Z 8 [Warning] [MY-013037] [InnoDB] InnoDB: Cannot find a free slot for an undo log. Do you have too many active transactions running concurrently?
2018-09-17T05:15:15.457094Z 8 [ERROR] [MY-000000] [InnoDB] InnoDB: Assertion failure: dict0dd.cc:840:0

Core was generated by `/sda/MS300718-mysql-8.0.12-linux-x86_64-debug/bin/mysqld --no-defaults --core-f'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x7f3ac27b1700 (LWP 24753))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055c9e36bb78d in my_write_core (sig=6) at /git/MS-8.0.12_dbg/mysys/stacktrace.cc:278
#2  0x000055c9e240fd94 in handle_fatal_signal (sig=6) at /git/MS-8.0.12_dbg/sql/signal_handler.cc:249
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007f3ac27f2801 in __GI_abort () at abort.c:79
#6  0x000055c9e3aa5239 in ut_dbg_assertion_failed (expr=0x55c9e4d663e7 "0", 
    file=0x55c9e4d65e18 "/git/MS-8.0.12_dbg/storage/innobase/dict/dict0dd.cc", line=840)
    at /git/MS-8.0.12_dbg/storage/innobase/ut/ut0dbg.cc:90
#7  0x000055c9e3ba2237 in dd_table_discard_tablespace (thd=0x7f3a94023000, table=0x7f3a940e38b8, table_def=0x7f3a9401ec78, 
    discard=true) at /git/MS-8.0.12_dbg/storage/innobase/dict/dict0dd.cc:840
#8  0x000055c9e37f3024 in ha_innobase::discard_or_import_tablespace (this=0x7f3a94261028, discard=true, table_def=0x7f3a9401ec78)
    at /git/MS-8.0.12_dbg/storage/innobase/handler/ha_innodb.cc:13068
#9  0x000055c9e2599e72 in handler::ha_discard_or_import_tablespace (this=0x7f3a94261028, discard=true, table_def=0x7f3a9401ec78)
    at /git/MS-8.0.12_dbg/sql/handler.cc:4538
#10 0x000055c9e2311e3c in Sql_cmd_discard_import_tablespace::mysql_discard_or_import_tablespace (this=0x7f3a940701e0, 
    thd=0x7f3a94023000, table_list=0x7f3a9406fc50) at /git/MS-8.0.12_dbg/sql/sql_table.cc:8859
#11 0x000055c9e27ee11b in Sql_cmd_discard_import_tablespace::execute (this=0x7f3a940701e0, thd=0x7f3a94023000)
    at /git/MS-8.0.12_dbg/sql/sql_alter.cc:390
#12 0x000055c9e2266a19 in mysql_execute_command (thd=0x7f3a94023000, first_level=true) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4210
#13 0x000055c9e2268f94 in mysql_parse (thd=0x7f3a94023000, parser_state=0x7f3ac27b0330) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4925
#14 0x000055c9e225eaeb in dispatch_command (thd=0x7f3a94023000, com_data=0x7f3ac27b0c90, command=COM_QUERY)
    at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1607
#15 0x000055c9e225d3c6 in do_command (thd=0x7f3a94023000) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1232
#16 0x000055c9e23fd678 in handle_connection (arg=0x7f3aaffbc480)
    at /git/MS-8.0.12_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#17 0x000055c9e3d6c422 in pfs_spawn_thread (arg=0x7f3ab5fe7720) at /git/MS-8.0.12_dbg/storage/perfschema/pfs.cc:2836
#18 0x00007f3ac41de6db in start_thread (arg=0x7f3ac27b1700) at pthread_create.c:463
#19 0x00007f3ac28d388f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
CREATE DATABASE test;
USE test;
CREATE TABLE t2(a CHAR,b INT,KEY(b))ENGINE=InnoDB;
set global innodb_trx_rseg_n_slots_debug=1;
ALTER TABLE t2 DISCARD TABLESPACE;

Suggested fix:
Please add a graceful shutdown/clean assert instead of asserting in dd_table_discard_tablespace
[17 Sep 2018 6:04] Roel Van de Paar
Another similar occurrence

CREATE DATABASE test;
USE test;
CREATE TABLE t1(c1 YEAR KEY,c2 ENUM('',''),c3 INT ZEROFILL);
FLUSH LOCAL TABLES t1 WITH READ LOCK;
SET @@GLOBAL.innodb_trx_rseg_n_slots_debug=3;
SET @@GLOBAL.innodb_rollback_segments=-1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
UNLOCK TABLES;
SET @@GLOBAL.innodb_file_per_table=0;
ALTER TABLE t1 MODIFY c3 TINYINT UNSIGNED ZEROFILL;

2018-09-17T05:41:07.454069Z 9 [Warning] [MY-013037] [InnoDB] InnoDB: Cannot find a free slot for an undo log. Do you have too many active transactions running concurrently?
2018-09-17T05:41:07.467651Z 9 [Warning] [MY-013037] [InnoDB] InnoDB: Cannot find a free slot for an undo log. Do you have too many active transactions running concurrently?
2018-09-17T05:41:07.676078Z 9 [ERROR] [MY-012391] [InnoDB] InnoDB: Unable to rename statistics from test.#sql-7174_9 to test.t1 in mysql.innodb_index_stats: Too many concurrent transactions. They can be renamed later using UPDATE mysql.innodb_index_stats SET database_name = 'test', table_name = 't1' WHERE database_name = 'test' AND table_name = '#sql-7174_9';
2018-09-17T05:41:07.707060Z 9 [ERROR] [MY-012003] [InnoDB] InnoDB: Cannot rename table 'test/#sql2-7174-9' to 'test/t1' since the dictionary cache already contains 'test/t1'.
2018-09-17T05:41:07.707571Z 9 [ERROR] [MY-000000] [InnoDB] InnoDB: Assertion failure: log0ddl.cc:1547:strcmp(table->name.m_name, table_name) == 0
InnoDB: thread 140004843230976

Core was generated by `/sda/MS300718-mysql-8.0.12-linux-x86_64-debug/bin/mysqld --no-defaults --core-f'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x7f556af29700 (LWP 31949))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000056199cd1c78d in my_write_core (sig=6) at /git/MS-8.0.12_dbg/mysys/stacktrace.cc:278
#2  0x000056199ba70d94 in handle_fatal_signal (sig=6) at /git/MS-8.0.12_dbg/sql/signal_handler.cc:249
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007f556af6a801 in __GI_abort () at abort.c:79
#6  0x000056199d106239 in ut_dbg_assertion_failed (expr=0x56199e2fb798 "strcmp(table->name.m_name, table_name) == 0", 
    file=0x56199e2fb0d0 "/git/MS-8.0.12_dbg/storage/innobase/log/log0ddl.cc", line=1547)
    at /git/MS-8.0.12_dbg/storage/innobase/ut/ut0dbg.cc:90
#7  0x000056199cf44973 in Log_DDL::replay_remove_cache_log (this=0x7f5554bf6ed8, table_id=1060, 
    table_name=0x7f553cc83eb8 "test/#sql-7174_9") at /git/MS-8.0.12_dbg/storage/innobase/log/log0ddl.cc:1547
#8  0x000056199cf43e4f in Log_DDL::replay (this=0x7f5554bf6ed8, record=...)
    at /git/MS-8.0.12_dbg/storage/innobase/log/log0ddl.cc:1384
#9  0x000056199cf439af in Log_DDL::replay_by_thread_id (this=0x7f5554bf6ed8, thread_id=9)
    at /git/MS-8.0.12_dbg/storage/innobase/log/log0ddl.cc:1315
#10 0x000056199cf44bae in Log_DDL::post_ddl (this=0x7f5554bf6ed8, thd=0x7f553cc23000)
    at /git/MS-8.0.12_dbg/storage/innobase/log/log0ddl.cc:1582
#11 0x000056199ce3d634 in innobase_post_ddl (thd=0x7f553cc23000) at /git/MS-8.0.12_dbg/storage/innobase/handler/ha_innodb.cc:4077
#12 0x000056199b984262 in mysql_alter_table (thd=0x7f553cc23000, new_db=0x7f553cdad3a8 "test", new_name=0x0, 
    create_info=0x7f556af268b0, table_list=0x7f553cdace20, alter_info=0x7f556af269a0) at /git/MS-8.0.12_dbg/sql/sql_table.cc:14524
#13 0x000056199be4ee7a in Sql_cmd_alter_table::execute (this=0x7f553cdad488, thd=0x7f553cc23000)
    at /git/MS-8.0.12_dbg/sql/sql_alter.cc:330
#14 0x000056199b8c7a19 in mysql_execute_command (thd=0x7f553cc23000, first_level=true) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4210
#15 0x000056199b8c9f94 in mysql_parse (thd=0x7f553cc23000, parser_state=0x7f556af28330) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4925
#16 0x000056199b8bfaeb in dispatch_command (thd=0x7f553cc23000, com_data=0x7f556af28c90, command=COM_QUERY)
    at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1607
#17 0x000056199b8be3c6 in do_command (thd=0x7f553cc23000) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1232
#18 0x000056199ba5e678 in handle_connection (arg=0x7f55587a5480)
    at /git/MS-8.0.12_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
---Type <return> to continue, or q <return> to quit---
#19 0x000056199d3cd422 in pfs_spawn_thread (arg=0x7f555e7e7720) at /git/MS-8.0.12_dbg/storage/perfschema/pfs.cc:2836
#20 0x00007f556c9566db in start_thread (arg=0x7f556af29700) at pthread_create.c:463
#21 0x00007f556b04b88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
[14 Jun 2019 6:12] MySQL Verification Team
Hello Roel,

Thank you for the report.

regards,
Umesh
[14 Jun 2019 6:12] MySQL Verification Team
- 8.0.16 debug build

 bin/mysql -uroot -S /tmp/mysql_ushastry.sock
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.16-debug MySQL Community Server - GPL - Debug

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE test;
ERROR 1007 (HY000): Can't create database 'test'; database exists
mysql> USE test;
Database changed
mysql> CREATE TABLE t2(a CHAR,b INT,KEY(b))ENGINE=InnoDB;
Query OK, 0 rows affected (0.04 sec)

mysql> set global innodb_trx_rseg_n_slots_debug=1;
Query OK, 0 rows affected (0.00 sec)

mysql> ALTER TABLE t2 DISCARD TABLESPACE;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> \q
Bye
[1]+  Aborted                 (core dumped) bin/mysqld-debug --basedir=$PWD --datadir=$PWD/95799 --core-file --socket=/tmp/mysql_ushastry.sock --port=3333 --log-error=$PWD/95799/log.err --mysqlx-port=33330 --mysqlx-socket=/tmp/mysql_x_ushastry.sock --log-error-verbosity=3 --secure-file-priv=/tmp/ 2>&1

(gdb) bt
#0  0x00007fbcfc39b771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000003fcc87b in my_write_core (sig=6) at ../../mysql-8.0.16/mysys/stacktrace.cc:284
#2  0x0000000002d97993 in handle_fatal_signal (sig=6) at ../../mysql-8.0.16/sql/signal_handler.cc:168
#3  <signal handler called>
#4  0x00007fbcfa6eb5d7 in raise () from /lib64/libc.so.6
#5  0x00007fbcfa6eccc8 in abort () from /lib64/libc.so.6
#6  0x00000000043cf64c in ut_dbg_assertion_failed (expr=0x5d1ae3f "0", file=0x5d1a870 "../../../mysql-8.0.16/storage/innobase/dict/dict0dd.cc", line=850) at ../../../mysql-8.0.16/storage/innobase/ut/ut0dbg.cc:92
#7  0x00000000044f5746 in dd_table_discard_tablespace (thd=0x7fbc34000c00, table=0x7fbc340ed428, table_def=0x7fbc34162a60, discard=true) at ../../../mysql-8.0.16/storage/innobase/dict/dict0dd.cc:850
#8  0x00000000040fa3ce in ha_innobase::discard_or_import_tablespace (this=0x7fbc341610f8, discard=true, table_def=0x7fbc34162a60) at ../../../mysql-8.0.16/storage/innobase/handler/ha_innodb.cc:13887
#9  0x0000000002f290a8 in handler::ha_discard_or_import_tablespace (this=0x7fbc341610f8, discard=true, table_def=0x7fbc34162a60) at ../../mysql-8.0.16/sql/handler.cc:4687
#10 0x0000000002c8798e in Sql_cmd_discard_import_tablespace::mysql_discard_or_import_tablespace (this=0x7fbc340f5ad8, thd=0x7fbc34000c00, table_list=0x7fbc340f5530) at ../../mysql-8.0.16/sql/sql_table.cc:10326
#11 0x000000000316d51c in Sql_cmd_discard_import_tablespace::execute (this=0x7fbc340f5ad8, thd=0x7fbc34000c00) at ../../mysql-8.0.16/sql/sql_alter.cc:408
#12 0x0000000002bdf2e5 in mysql_execute_command (thd=0x7fbc34000c00, first_level=true) at ../../mysql-8.0.16/sql/sql_parse.cc:4400
#13 0x0000000002be1af3 in mysql_parse (thd=0x7fbc34000c00, parser_state=0x7fbce02bac40) at ../../mysql-8.0.16/sql/sql_parse.cc:5194
#14 0x0000000002bd71ba in dispatch_command (thd=0x7fbc34000c00, com_data=0x7fbce02bbcd0, command=COM_QUERY) at ../../mysql-8.0.16/sql/sql_parse.cc:1746
#15 0x0000000002bd5774 in do_command (thd=0x7fbc34000c00) at ../../mysql-8.0.16/sql/sql_parse.cc:1264
#16 0x0000000002d838df in handle_connection (arg=0x8a69c60) at ../../mysql-8.0.16/sql/conn_handler/connection_handler_per_thread.cc:302
#17 0x00000000046ad1e6 in pfs_spawn_thread (arg=0x8e9e020) at ../../../mysql-8.0.16/storage/perfschema/pfs.cc:2836
#18 0x00007fbcfc396df5 in start_thread () from /lib64/libpthread.so.0
#19 0x00007fbcfa7ac60d in clone () from /lib64/libc.so.6
(gdb)