Bug #91975 InnoDB: Assertion failure: dict0dd.cc:1071:!fail
Submitted: 11 Aug 0:24 Modified: 25 Aug 6:11
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S6 (Debug Builds)
Version:8.0.12 OS:Any
Assigned to: CPU Architecture:Any
Tags: debug

[11 Aug 0:24] Roel Van de Paar
Description:
New regression. Not present in 5.7.21. Please fix asap.

2018-08-11T00:22:27.667506Z 9 [ERROR] [MY-000000] [InnoDB] InnoDB: Assertion failure: dict0dd.cc:1071:!fail
InnoDB: thread 140409159669504

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
57	../sysdeps/unix/sysv/linux/pthread_kill.c: No such file or directory.
[Current thread is 1 (Thread 0x7fb38e15d700 (LWP 32644))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x0000563347c9878d in my_write_core (sig=6) at /git/MS-8.0.12_dbg/mysys/stacktrace.cc:278
#2  0x00005633469ecd94 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  0x00007fb38e19e801 in __GI_abort () at abort.c:79
#6  0x0000563348082239 in ut_dbg_assertion_failed (expr=0x563349343516 "!fail", 
    file=0x563349342e18 "/git/MS-8.0.12_dbg/storage/innobase/dict/dict0dd.cc", line=1071)
    at /git/MS-8.0.12_dbg/storage/innobase/ut/ut0dbg.cc:90
#7  0x00005633481803ad in dd_rename_tablespace (dd_space_id=7, new_space_name=0x7fb38e156cf0 "test/t3", 
    new_path=0x7fb364a4e7a8 "./test/t3.ibd") at /git/MS-8.0.12_dbg/storage/innobase/dict/dict0dd.cc:1071
#8  0x0000563347dec24d in innobase_basic_ddl::rename_impl<dd::Table> (thd=0x7fb364823000, from=0x7fb38e1585a0 "./test/t1", 
    to=0x7fb38e1587b0 "./test/t3", from_table=0x7fb36481ec78, to_table=0x7fb36481f178)
    at /git/MS-8.0.12_dbg/storage/innobase/handler/ha_innodb.cc:12277
#9  0x0000563347dd1f55 in ha_innobase::rename_table (this=0x7fb364a3c028, from=0x7fb38e1585a0 "./test/t1", 
    to=0x7fb38e1587b0 "./test/t3", from_table_def=0x7fb36481ec78, to_table_def=0x7fb36481f178)
    at /git/MS-8.0.12_dbg/storage/innobase/handler/ha_innodb.cc:13603
#10 0x0000563346b7723c in handler::ha_rename_table (this=0x7fb364a3c028, from=0x7fb38e1585a0 "./test/t1", 
    to=0x7fb38e1587b0 "./test/t3", from_table_def=0x7fb36481ec78, to_table_def=0x7fb36481f178)
    at /git/MS-8.0.12_dbg/sql/handler.cc:4646
#11 0x00005633468ed022 in mysql_rename_table (thd=0x7fb364823000, base=0x7fb38d846fa0, old_db=0x7fb36499efc8 "test", 
    old_name=0x7fb36499e9c0 "t1", old_fk_db=0x7fb36499efc8 "test", old_fk_name=0x7fb36499e9c0 "t1", new_schema=..., 
    new_db=0x7fb36499f560 "test", new_name=0x7fb36499ea00 "t3", flags=8) at /git/MS-8.0.12_dbg/sql/sql_table.cc:8288
#12 0x000056334688ec49 in do_rename (thd=0x7fb364823000, ren_table=0x7fb36499ea40, new_db=0x7fb36499f560 "test", 
    new_table_name=0x7fb36499ea00 "t3", new_table_alias=0x7fb36499efd0 "t3", skip_error=false, int_commit_done=0x7fb38e159ffe, 
    post_ddl_htons=0x7fb38e15a070, fk_invalidator=0x7fb38e15a0a0) at /git/MS-8.0.12_dbg/sql/sql_rename.cc:463
#13 0x000056334688f2f9 in rename_tables (thd=0x7fb364823000, table_list=0x7fb36499ea40, skip_error=false, 
    int_commit_done=0x7fb38e159ffe, post_ddl_htons=0x7fb38e15a070, fk_invalidator=0x7fb38e15a0a0)
    at /git/MS-8.0.12_dbg/sql/sql_rename.cc:614
#14 0x000056334688dee4 in mysql_rename_tables (thd=0x7fb364823000, table_list=0x7fb36499ea40)
#15 0x00005633468400c2 in mysql_execute_command (thd=0x7fb364823000, first_level=true) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:3138
#16 0x0000563346845f94 in mysql_parse (thd=0x7fb364823000, parser_state=0x7fb38e15c330) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4925
#17 0x000056334683baeb in dispatch_command (thd=0x7fb364823000, com_data=0x7fb38e15cc90, command=COM_QUERY)
    at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1607
#18 0x000056334683a3c6 in do_command (thd=0x7fb364823000) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1232
#19 0x00005633469da678 in handle_connection (arg=0x7fb37bba5480)
    at /git/MS-8.0.12_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#20 0x0000563348349422 in pfs_spawn_thread (arg=0x7fb381be7720) at /git/MS-8.0.12_dbg/storage/perfschema/pfs.cc:2836
#21 0x00007fb38fb8a6db in start_thread (arg=0x7fb38e15d700) at pthread_create.c:463
#22 0x00007fb38e27f88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
CREATE DATABASE test;
USE test;
CREATE TABLE t1(c1 TIME,c2 CHAR (1),c3 INT(1),c4 VARCHAR(1) KEY,c5 TIME UNIQUE KEY,c6 NUMERIC(0,0) DEFAULT 3.141592);
SET @@global.super_read_only=TRUE;
create temporary TABLE t1(i int,b BLOB,primary key pk(i),index sk(b(1)));
create temporary table t3(f int);
rename TABLE t1 to t3;
[11 Aug 0:25] Roel Van de Paar
Additional testcase

CREATE DATABASE test;
USE test;
CREATE TEMPORARY TABLE t5(c1 INT);
create table t1(pk int key);
SET GLOBAL super_read_only=1;
CREATE TEMPORARY TABLE t1(c1 INT);
RENAME TABLE t1 TO t5;
[11 Aug 13:51] Miguel Solorzano
Thank you for the bugh report.

2018-08-11T13:49:10.218161Z 0 [System] [MY-010931] [Server] /home/miguel/dbsd/8.0/bin/mysqld: ready for connections. Version: '8.0.13-debug'  socket: '/tmp/mysql80.sock'  port: 3380  Source distribution BUILD: 2018-JUL-20.
2018-08-11T13:49:11.414017Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of bind-address: '*' port: 33060 failed, `bind()` failed with error: Address already in use (98). Do you already have another mysqld server running with Mysqlx ?'
2018-08-11T13:49:11.414162Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/tmp/mysqlx.sock'
2018-08-11T13:49:48.020219Z 9 [ERROR] [MY-013183] [InnoDB] Assertion failure: dict0dd.cc:1072:!fail thread 139726831269632
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
13:49:48 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=1
max_threads=151
thread_count=2
connection_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 67870 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7f142011c720
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f14b024ac00 thread_stack 0x46000
/home/miguel/dbsd/8.0/bin/mysqld(my_print_stacktrace(unsigned char*, unsigned long)+0x43) [0x4148f2c]
/home/miguel/dbsd/8.0/bin/mysqld(handle_fatal_signal+0x3f5) [0x2f1d23e]
/lib64/libpthread.so.0(+0xf6d0) [0x7f14c2cf06d0]
/lib64/libc.so.6(gsignal+0x37) [0x7f14c1007277]
/lib64/libc.so.6(abort+0x148) [0x7f14c1008968]
/home/miguel/dbsd/8.0/bin/mysqld(ut_dbg_assertion_failed(char const*, char const*, unsigned long)+0x187) [0x450a010]
/home/miguel/dbsd/8.0/bin/mysqld(dd_rename_tablespace(unsigned long long, char const*, char const*)+0x574) [0x45fb086]
/home/miguel/dbsd/8.0/bin/mysqld(int innobase_basic_ddl::rename_impl<dd::Table>(THD*, char const*, char const*, dd::Table const*, dd::Table const*)+0x423) [0x4292231]
/home/miguel/dbsd/8.0/bin/mysqld(ha_innobase::rename_table(char const*, char const*, dd::Table const*, dd::Table*)+0x268) [0x4275910]
/home/miguel/dbsd/8.0/bin/mysqld(handler::ha_rename_table(char const*, char const*, dd::Table const*, dd::Table*)+0x7c) [0x3095d28]
/home/miguel/dbsd/8.0/bin/mysqld(mysql_rename_table(THD*, handlerton*, char const*, char const*, char const*, char const*, dd::Schema const&, char const*, char const*, unsigned int)+0xb33) [0x2e23fb7]
/home/miguel/dbsd/8.0/bin/mysqld() [0x2dc86aa]
/home/miguel/dbsd/8.0/bin/mysqld() [0x2dc8d40]
/home/miguel/dbsd/8.0/bin/mysqld(mysql_rename_tables(THD*, TABLE_LIST*)+0x763) [0x2dc7371]
/home/miguel/dbsd/8.0/bin/mysqld(mysql_execute_command(THD*, bool)+0x1cc5) [0x2d7dfcb]
/home/miguel/dbsd/8.0/bin/mysqld(mysql_parse(THD*, Parser_state*, bool)+0x66f) [0x2d83776]
/home/miguel/dbsd/8.0/bin/mysqld(dispatch_command(THD*, COM_DATA const*, enum_server_command)+0x1350) [0x2d79cb6]
/home/miguel/dbsd/8.0/bin/mysqld(do_command(THD*)+0x43a) [0x2d783dc]
/home/miguel/dbsd/8.0/bin/mysqld() [0x2f09eac]
/home/miguel/dbsd/8.0/bin/mysqld() [0x4799b6d]
/lib64/libpthread.so.0(+0x7e25) [0x7f14c2ce8e25]
/lib64/libc.so.6(clone+0x6d) [0x7f14c10cfbad]

Trying to get some variables.
[12 Aug 21:41] Roel Van de Paar
Another testcase. It crashed 8.0.4rc too, but with a different stack.

CREATE DATABASE test;
USE test;
CREATE TABLE t1(b INT)ENGINE=innodb;
ALTER TABLE t1 ALGORITHM=DEFAULT,DISCARD TABLESPACE;
ALTER TABLE t1 RENAME b;
CREATE TABLE t1(b INT KEY,c TEXT,d TEXT)ENGINE=MyISAM;
ALTER TABLE t1 ENGINE=InnoDB;
[12 Aug 21:42] Roel Van de Paar
Guys, this bug looks bad. Please check.
[14 Aug 13:07] Erlend Dahl
Posted by developer:
 
The first testcase takes out 8.0.11 too.
[25 Aug 6:11] Roel Van de Paar
Is the "14 Aug 13:07" comment meant to imply that this bug is not a recent regression? I hope not.