Bug #93656 Assertion failure in table_id == id | dict0dd.cc:2010
Submitted: 18 Dec 2018 13:37 Modified: 18 Dec 2018 21:07
Reporter: Ramesh Sivaraman Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S6 (Debug Builds)
Version:8.0.13 OS:Ubuntu
Assigned to: CPU Architecture:Any
Tags: debug

[18 Dec 2018 13:37] Ramesh Sivaraman
Description:
GDB info

#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
#1  0x000000000456c0a9 in my_write_core (sig=6) at /qa/binaries/MS-8.0_val_dbg/mysys/stacktrace.cc:278
#2  0x00000000031c38c1 in handle_fatal_signal (sig=6) at /qa/binaries/MS-8.0_val_dbg/sql/signal_handler.cc:249
#3  <signal handler called>
#4  0x00007f4b75418428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#5  0x00007f4b7541a02a in __GI_abort () at abort.c:89
#6  0x00000000049f72a1 in ut_dbg_assertion_failed (expr=0x5d2e23f "table_id == id", file=0x5d2d470 "/qa/binaries/MS-8.0_val_dbg/storage/innobase/dict/dict0dd.cc", line=2010) at /qa/binaries/MS-8.0_val_dbg/storage/innobase/ut/ut0dbg.cc:90
#7  0x0000000004b0c167 in dd_update_v_cols (dd_table=0x7f4a98033fb8, id=1060) at /qa/binaries/MS-8.0_val_dbg/storage/innobase/dict/dict0dd.cc:2010
#8  0x000000000476c455 in dd_commit_instant_table (new_table=0x7f4a981657b8, old_table=0x7f4a9812fb20, altered_table=0x7f4a98137460, old_dd_tab=0x7f4a9803c2c8, new_dd_tab=0x7f4a98033fb8) at /qa/binaries/MS-8.0_val_dbg/storage/innobase/handler/handler0alter.cc:3847
#9  0x0000000004775c2a in dd_commit_inplace_instant<dd::Table> (ha_alter_info=0x7f4b5be54920, thd=0x7f4a98000be0, trx=0x7f4b617b78e0, table=0x7f4a981657b8, old_table=0x7f4a9812fb20, altered_table=0x7f4a98137460, old_dd_tab=0x7f4a9803c2c8, new_dd_tab=0x7f4a98033fb8, autoinc=0x7f4a981659f8) at /qa/binaries/MS-8.0_val_dbg/storage/innobase/handler/handler0alter.cc:3928
#10 0x000000000476643f in ha_innobase::commit_inplace_alter_table (this=0x7f4a98130b68, altered_table=0x7f4a98137460, ha_alter_info=0x7f4b5be54920, commit=true, old_dd_tab=0x7f4a9803c2c8, new_dd_tab=0x7f4a98033fb8) at /qa/binaries/MS-8.0_val_dbg/storage/innobase/handler/handler0alter.cc:1229
#11 0x000000000335dc75 in handler::ha_commit_inplace_alter_table (this=0x7f4a98130b68, altered_table=0x7f4a98137460, ha_alter_info=0x7f4b5be54920, commit=true, old_table_def=0x7f4a9803c2c8, new_table_def=0x7f4a98033fb8) at /qa/binaries/MS-8.0_val_dbg/sql/handler.cc:4712
#12 0x00000000030bccf4 in mysql_inplace_alter_table (thd=0x7f4a98000be0, schema=..., new_schema=..., table_def=0x7f4a9803c2c8, altered_table_def=0x7f4a98033fb8, table_list=0x7f4a980334c8, table=0x7f4a9812fb20, altered_table=0x7f4a98137460, ha_alter_info=0x7f4b5be54920, inplace_supported=HA_ALTER_INPLACE_INSTANT, alter_ctx=0x7f4b5be55510, columns=std::set with 0 elements, fk_key_info=0x7f4a980167d8, fk_key_count=0, fk_invalidator=0x7f4b5be54860) at /qa/binaries/MS-8.0_val_dbg/sql/sql_table.cc:11663
#13 0x00000000030c7668 in mysql_alter_table (thd=0x7f4a98000be0, new_db=0x7f4a98199c08 "test", new_name=0x0, create_info=0x7f4b5be56840, table_list=0x7f4a980334c8, alter_info=0x7f4b5be56940) at /qa/binaries/MS-8.0_val_dbg/sql/sql_table.cc:14963
#14 0x00000000035c9e3a in Sql_cmd_alter_table::execute (this=0x7f4a981668b8, thd=0x7f4a98000be0) at /qa/binaries/MS-8.0_val_dbg/sql/sql_alter.cc:345
#15 0x0000000003001e96 in mysql_execute_command (thd=0x7f4a98000be0, first_level=true) at /qa/binaries/MS-8.0_val_dbg/sql/sql_parse.cc:4307
#16 0x000000000300491a in mysql_parse (thd=0x7f4a98000be0, parser_state=0x7f4b5be58380, force_primary_storage_engine=false) at /qa/binaries/MS-8.0_val_dbg/sql/sql_parse.cc:5041
#17 0x0000000002ff9ea4 in dispatch_command (thd=0x7f4a98000be0, com_data=0x7f4b5be58cf0, command=COM_QUERY) at /qa/binaries/MS-8.0_val_dbg/sql/sql_parse.cc:1687
#18 0x0000000002ff8506 in do_command (thd=0x7f4a98000be0) at /qa/binaries/MS-8.0_val_dbg/sql/sql_parse.cc:1260
#19 0x00000000031ae7d3 in handle_connection (arg=0x893d710) at /qa/binaries/MS-8.0_val_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#20 0x0000000004c8928a in pfs_spawn_thread (arg=0x88fb810) at /qa/binaries/MS-8.0_val_dbg/storage/perfschema/pfs.cc:2836
#21 0x00007f4b771366ba in start_thread (arg=0x7f4b5be59700) at pthread_create.c:333
#22 0x00007f4b754ea41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

How to repeat:
rm -Rf /dev/shm/1545055992
mkdir -p /dev/shm/1545055992/tmp

/qa/binaries/MS131218-mysql-8.0.13-linux-x86_64-val-debug/bin/mysqld --no-defaults --initialize-insecure --early-plugin-load=keyring_file.so --keyring_file_data=keyring --basedir=/qa/binaries/MS131218-mysql-8.0.13-linux-x86_64-val-debug --datadir=/dev/shm/1545055992/data

/qa/binaries/MS131218-mysql-8.0.13-linux-x86_64-val-debug/bin/mysqld --no-defaults --basedir=/qa/binaries/MS131218-mysql-8.0.13-linux-x86_64-val-debug --datadir=/dev/shm/1545055992/data --tmpdir=/dev/shm/1545055992/tmp --port=33785 --pid-file=/dev/shm/1545055992/pid.pid --core-file --socket=/dev/shm/1545055992/socket.sock --log-error=/dev/shm/1545055992/error.log.out --early-plugin-load=keyring_file.so --keyring_file_data=keyring &

SQL

CREATE DATABASE test;
USE test;
CREATE TABLE t0(id int KEY AUTO_INCREMENT);
ALTER TABLE t0 DISCARD TABLESPACE;
ALTER TABLE t0 ADD COLUMN c0 INT COMMENT'';
[18 Dec 2018 20:05] MySQL Verification Team
Repeatable with 8.0.13:

nter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.13-debug Source distribution

Copyright (c) 2000, 2018, 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;
Query OK, 1 row affected (0,16 sec)

mysql> USE test;
Database changed
mysql> CREATE TABLE t0(id int KEY AUTO_INCREMENT);
Query OK, 0 rows affected (0,61 sec)

mysql> ALTER TABLE t0 DISCARD TABLESPACE;
Query OK, 0 rows affected (0,20 sec)

mysql> ALTER TABLE t0 ADD COLUMN c0 INT COMMENT'';
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> 

miguel@tikal:~/bug $ /home/miguel/bug/8.0/bin/mysqld --no-defaults --basedir=/home/miguel/bug/8.0 --datadir=/home/miguel/bug/8.0/data --tmpdir=/home/miguel/bug/tmp --port=33785 --pid-file=/home/miguel/bug/8.0/pid.pid --core-file --early-plugin-load=keyring_file.so --keyring_file_data=keyring
2018-12-18T19:59:26.933676Z 0 [System] [MY-010116] [Server] /home/miguel/bug/8.0/bin/mysqld (mysqld 8.0.13-debug) starting as process 29533
2018-12-18T19:59:29.710300Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2018-12-18T19:59:29.833057Z 0 [System] [MY-010931] [Server] /home/miguel/bug/8.0/bin/mysqld: ready for connections. Version: '8.0.13-debug'  socket: '/tmp/mysql.sock'  port: 33785  Source distribution.
2018-12-18T19:59:29.893559Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/tmp/mysqlx.sock' bind-address: '::' port: 33060
2018-12-18T20:00:46.196939Z 7 [ERROR] [MY-013183] [InnoDB] Assertion failure: dict0dd.cc:2010:table_id == id thread 140117269198592
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.
20:00:46 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 = 67877 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7f6ee0000e40
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 = 7f6f980ead18 thread_stack 0x46000
/home/miguel/bug/8.0/bin/mysqld(my_print_stacktrace(unsigned char*, unsigned long)+0x55) [0x558816997270]
/home/miguel/bug/8.0/bin/mysqld(handle_fatal_signal+0x3f2) [0x55881566d2ed]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12dd0) [0x7f6fad02add0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7) [0x7f6fac5cf077]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x121) [0x7f6fac5b0535]
/home/miguel/bug/8.0/bin/mysqld(ut_dbg_assertion_failed(char const*, char const*, unsigned long)+0x1a5) [0x558816d847ab]
/home/miguel/bug/8.0/bin/mysqld(dd_update_v_cols(dd::Table*, unsigned long)+0x1e8) [0x558816e8335a]
/home/miguel/bug/8.0/bin/mysqld(+0x41fd4c2) [0x558816b284c2]
/home/miguel/bug/8.0/bin/mysqld(+0x4206aff) [0x558816b31aff]
/home/miguel/bug/8.0/bin/mysqld(ha_innobase::commit_inplace_alter_table(TABLE*, Alter_inplace_info*, bool, dd::Table const*, dd::Table*)+0x2a3) [0x558816b22553]
/home/miguel/bug/8.0/bin/mysqld(handler::ha_commit_inplace_alter_table(TABLE*, Alter_inplace_info*, bool, dd::Table const*, dd::Table*)+0xc6) [0x5588157fdc86]
/home/miguel/bug/8.0/bin/mysqld(+0x2c440fd) [0x55881556f0fd]
/home/miguel/bug/8.0/bin/mysqld(mysql_alter_table(THD*, char const*, char const*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*)+0x31d2) [0x5588155799ca]
/home/miguel/bug/8.0/bin/mysqld(Sql_cmd_alter_table::execute(THD*)+0x658) [0x558815a562ce]
/home/miguel/bug/8.0/bin/mysqld(mysql_execute_command(THD*, bool)+0x581a) [0x5588154b90a8]
/home/miguel/bug/8.0/bin/mysqld(mysql_parse(THD*, Parser_state*, bool)+0x696) [0x5588154bb752]
/home/miguel/bug/8.0/bin/mysqld(dispatch_command(THD*, COM_DATA const*, enum_server_command)+0x139e) [0x5588154b10f3]
/home/miguel/bug/8.0/bin/mysqld(do_command(THD*)+0x487) [0x5588154af782]
/home/miguel/bug/8.0/bin/mysqld(+0x2d2e28a) [0x55881565928a]
/home/miguel/bug/8.0/bin/mysqld(+0x471a0b6) [0x5588170450b6]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x8164) [0x7f6fad020164]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7f6fac6a8def]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f6ee01398d8): ALTER TABLE t0 ADD COLUMN c0 INT COMMENT''
Connection ID (thread ID): 7
Status: NOT_KILLED
[18 Dec 2018 21:08] MySQL Verification Team
Thank you for the bug report. Repeatable with version reported 8.0.13 but not anymore with most recent source server:

miguel@tikal:~/bug $ 8.0/bin/mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.15-debug Source distribution

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;
Query OK, 1 row affected (0,10 sec)

mysql> USE test;
Database changed
mysql> CREATE TABLE t0(id int KEY AUTO_INCREMENT);
Query OK, 0 rows affected (0,48 sec)

mysql> ALTER TABLE t0 DISCARD TABLESPACE;
Query OK, 0 rows affected (0,25 sec)

mysql> ALTER TABLE t0 ADD COLUMN c0 INT COMMENT'';
ERROR 1814 (HY000): Tablespace has been discarded for table 'test/t0'
mysql> SHOW VARIABLES LIKE "%VERSION%";
+--------------------------+-----------------------+
| Variable_name            | Value                 |
+--------------------------+-----------------------+
| immediate_server_version | 999999                |
| innodb_version           | 8.0.15                |
| original_server_version  | 999999                |
| protocol_version         | 10                    |
| slave_type_conversions   |                       |
| tls_version              | TLSv1,TLSv1.1,TLSv1.2 |
| version                  | 8.0.15-debug          |
| version_comment          | Source distribution   |
| version_compile_machine  | x86_64                |
| version_compile_os       | Linux                 |
| version_compile_zlib     | 1.2.11                |
+--------------------------+-----------------------+
11 rows in set (0,01 sec)

mysql>