Bug #76445 InnoDB: Failing assertion: 0 in file handler0alter.cc line 6647
Submitted: 23 Mar 2015 4:07 Modified: 16 Apr 2015 17:59
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DDL Severity:S6 (Debug Builds)
Version:5.7.5-m16,5.7.6, 5.7.8, 8.0.0 OS:Any
Assigned to: CPU Architecture:Any

[23 Mar 2015 4:07] Roel Van de Paar
Description:
+bt
#0  0x00007f0aa8ca5771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000013a521c in my_write_core (sig=6) at /bzr/mysql-5.7.6-m16_dbg/mysys/stacktrace.c:247
#2  0x0000000000bb713c in handle_fatal_signal (sig=6) at /bzr/mysql-5.7.6-m16_dbg/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007f0aa78a95c9 in raise () from /lib64/libc.so.6
#5  0x00007f0aa78aacd8 in abort () from /lib64/libc.so.6
#6  0x00000000016c790b in ut_dbg_assertion_failed (expr=0x1c05744 "0", file=0x1c061a0 "/bzr/mysql-5.7.6-m16_dbg/storage/innobase/handler/handler0alter.cc",line=6647) at /bzr/mysql-5.7.6-m16_dbg/storage/innobase/ut/ut0dbg.cc:67
#7  0x00000000015122f4 in ha_innobase::commit_inplace_alter_table (this=0x7f0a04cb1c20, altered_table=0x7f0a04d4fe10, ha_alter_info=0x7f0aa929a140, commit=true) at /bzr/mysql-5.7.6-m16_dbg/storage/innobase/handler/handler0alter.cc:6647
#8  0x0000000000c1e2ef in handler::ha_commit_inplace_alter_table (this=0x7f0a04cb1c20, altered_table=0x7f0a04d4fe10, ha_alter_info=0x7f0aa929a140, commit=true) at /bzr/mysql-5.7.6-m16_dbg/sql/handler.cc:4389
#9  0x0000000001132ce0 in mysql_inplace_alter_table (thd=0x7f0a04c1a000, table_list=0x7f0a04c2c9f8, table=0x7f0a04c60610, altered_table=0x7f0a04d4fe10, ha_alter_info=0x7f0aa929a140, inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7f0aa9299b80, alter_ctx=0x7f0aa929a6c0) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_table.cc:6982
#10 0x0000000001137424 in mysql_alter_table (thd=0x7f0a04c1a000, new_db=0x7f0a04c2cf70 "test", new_name=0x0, create_info=0x7f0aa929b550, table_list=0x7f0a04c2c9f8, alter_info=0x7f0aa929b4a0) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_table.cc:8882
#11 0x00000000012890db in Sql_cmd_alter_table::execute (this=0x7f0a04c2d168, thd=0x7f0a04c1a000) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_alter.cc:316
#12 0x00000000010a917e in mysql_execute_command (thd=0x7f0a04c1a000) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:4452
#13 0x00000000010aae7a in mysql_parse (thd=0x7f0a04c1a000, parser_state=0x7f0aa929ce00) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:5129
#14 0x00000000010a0bd4 in dispatch_command (command=COM_QUERY, thd=0x7f0a04c1a000, packet=0x7f0a04c46011 "ALTER TABLE t1 ADD CONSTRAINT fi1 FOREIGN KEY(b)REFERENCES ti2(a)", packet_length=65) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:1249
#15 0x000000000109f925 in do_command (thd=0x7f0a04c1a000) at /bzr/mysql-5.7.6-m16_dbg/sql/sql_parse.cc:835
#16 0x00000000011c2fd9 in handle_connection (arg=0x7f0a9fbf78c0) at /bzr/mysql-5.7.6-m16_dbg/sql/conn_handler/connection_handler_per_thread.cc:298
#17 0x00000000013d2299 in pfs_spawn_thread (arg=0x7f0aa0bb2d50) at /bzr/mysql-5.7.6-m16_dbg/storage/perfschema/pfs.cc:2147
#18 0x00007f0aa8ca0df3 in start_thread () from /lib64/libpthread.so.0
#19 0x00007f0aa796a1ad in clone () from /lib64/libc.so.6

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
set @@foreign_key_checks=0;
CREATE TABLE t1(c1 DATE NULL,c2 BINARY (1)NOT NULL,c3 INT(1) NULL,c4 VARBINARY(1) NOT NULL KEY,c5 DATE NOT NULL UNIQUE KEY,c6 FIXED(0,0) NOT NULL DEFAULT 3.141592);
ALTER TABLE t1 ADD b GEOMETRY NOT NULL,ADD SPATIAL INDEX(b);
ALTER TABLE t1 ADD CONSTRAINT fi1 FOREIGN KEY(b)REFERENCES ti2(a);
[23 Mar 2015 5:17] Umesh Shastry
Hello Roel,

Thank you for the report and test case.
Confirmed that 5.7.6, 5.7.8 debug builds are affected.

Thanks,
Umesh
[23 Mar 2015 5:18] Umesh Shastry
// 5.7.6 - only debug build affected

bin/mysql_install_db --basedir=/export/umesh/mysql-5.7.6 --datadir=/export/umesh/mysql-5.7.6/76445 -v
bin/mysqld-debug --basedir=/export/umesh/mysql-5.7.6 --datadir=/export/umesh/mysql-5.7.6/76445 --sql_mode=ONLY_FULL_GROUP_BY --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/mysql-5.7.6/76445/log.err 2>&1 &

- build

commit: e1298eb6a8e2247361533811930a07fde7aff618
date: 2015-02-26 15:29:31 +0100
build-date: 2015-02-26 15:35:58 +0100
short: e1298eb
branch: mysql-5.7.6-m16-release

MySQL source 5.7.6

(gdb) bt
#0  0x00007f7b1eabf771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000013ee069 in my_write_core (sig=6) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/mysys/stacktrace.c:247
#2  0x0000000000bdeba0 in handle_fatal_signal (sig=6) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007f7b1d6c55c9 in raise () from /lib64/libc.so.6
#5  0x00007f7b1d6c6cd8 in abort () from /lib64/libc.so.6
#6  0x000000000160d6bb in ut_dbg_assertion_failed (expr=0x1c2bb7c "0",
    file=0x1c2c800 "/export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/storage/innobase/handler/handler0alter.cc", line=6647)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/storage/innobase/ut/ut0dbg.cc:67
#7  0x0000000001456f17 in ha_innobase::commit_inplace_alter_table (this=0x7f7aa8011170, altered_table=0x7f7aa892a190, ha_alter_info=0x7f7b142e6750, commit=true)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/storage/innobase/handler/handler0alter.cc:6647
#8  0x0000000000c465e8 in handler::ha_commit_inplace_alter_table (this=0x7f7aa8011170, altered_table=0x7f7aa892a190, ha_alter_info=0x7f7b142e6750, commit=true)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/handler.cc:4389
#9  0x0000000001173151 in mysql_inplace_alter_table (thd=0x7f7aa8000bb0, table_list=0x7f7aa8005bf8, table=0x7f7aa80107f0, altered_table=0x7f7aa892a190, ha_alter_info=0x7f7b142e6750,
    inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7f7b142e70d0, alter_ctx=0x7f7b142e5cb0)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_table.cc:6982
#10 0x0000000001177ade in mysql_alter_table (thd=0x7f7aa8000bb0, new_db=0x7f7aa8006170 "test", new_name=0x0, create_info=0x7f7b142e7b70, table_list=0x7f7aa8005bf8, alter_info=0x7f7b142e7c50)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_table.cc:8882
#11 0x00000000012d10bf in Sql_cmd_alter_table::execute (this=0x7f7aa8006368, thd=0x7f7aa8000bb0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_alter.cc:316
#12 0x00000000010e7cff in mysql_execute_command (thd=0x7f7aa8000bb0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:4452
#13 0x00000000010e9a6f in mysql_parse (thd=0x7f7aa8000bb0, parser_state=0x7f7b142e95d0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:5129
#14 0x00000000010debc8 in dispatch_command (command=COM_QUERY, thd=0x7f7aa8000bb0, packet=0x7f7aa8009ce1 "ALTER TABLE t1 ADD CONSTRAINT fi1 FOREIGN KEY(b)REFERENCES ti2(a)", packet_length=65)
    at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:1249
#15 0x00000000010dd693 in do_command (thd=0x7f7aa8000bb0) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/sql_parse.cc:835
#16 0x000000000120444f in handle_connection (arg=0x4c89c90) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/sql/conn_handler/connection_handler_per_thread.cc:298
#17 0x00000000017770f1 in pfs_spawn_thread (arg=0x4e66f90) at /export/home/pb2/build/sb_0-14552753-1424962715.41/mysql-5.7.6-m16/storage/perfschema/pfs.cc:2147
#18 0x00007f7b1eabadf3 in start_thread () from /lib64/libpthread.so.0
#19 0x00007f7b1d78647d in clone () from /lib64/libc.so.6
[23 Mar 2015 5:18] Umesh Shastry
// 5.7.8   - only debug build affected

bin/mysql_install_db --basedir=/export/umesh/mysql-5.7.8 --datadir=/export/umesh/mysql-5.7.8/76445 -v
bin/mysqld-debug --basedir=/export/umesh/mysql-5.7.8 --datadir=/export/umesh/mysql-5.7.8/76445 --sql_mode=ONLY_FULL_GROUP_BY --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/mysql-5.7.8/76445/log.err 2>&1 &

- build

commit: 91153f3385c4917a215aa4c7818b3f6265608286
date: 2015-03-20 14:48:27 +0100
build-date: 2015-03-20 18:03:24 +0100
short: 91153f3
branch: mysql-5.7

MySQL source 5.7.8

(gdb) bt
#0  0x00007faa3cf37771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000018c6688 in my_write_core (sig=6) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/mysys/stacktrace.c:247
#2  0x0000000000f4b39e in handle_fatal_signal (sig=6) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/signal_handler.cc:220
#3  <signal handler called>
#4  0x00007faa3bb3d5c9 in raise () from /lib64/libc.so.6
#5  0x00007faa3bb3ecd8 in abort () from /lib64/libc.so.6
#6  0x0000000001ae4b43 in ut_dbg_assertion_failed (expr=0x222a174 "0",
    file=0x222ae40 "/export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/storage/innobase/handler/handler0alter.cc", line=6651)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/storage/innobase/ut/ut0dbg.cc:67
#7  0x000000000192e7e4 in ha_innobase::commit_inplace_alter_table (this=0x7fa9ac9346f0, altered_table=0x7fa9ac02fa20, ha_alter_info=0x7faa3175d150, commit=true)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/storage/innobase/handler/handler0alter.cc:6651
#8  0x0000000000fb74ed in handler::ha_commit_inplace_alter_table (this=0x7fa9ac9346f0, altered_table=0x7fa9ac02fa20, ha_alter_info=0x7faa3175d150, commit=true)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/handler.cc:4457
#9  0x000000000164f66c in mysql_inplace_alter_table (thd=0x7fa9ac000bb0, table_list=0x7fa9ac005ce0, table=0x7fa9ac93aaf0, altered_table=0x7fa9ac02fa20, ha_alter_info=0x7faa3175d150,
    inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7faa3175cb90, alter_ctx=0x7faa3175d6e0)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_table.cc:6998
#10 0x0000000001653db5 in mysql_alter_table (thd=0x7fa9ac000bb0, new_db=0x7fa9ac006268 "test", new_name=0x0, create_info=0x7faa3175e570, table_list=0x7fa9ac005ce0, alter_info=0x7faa3175e4c0)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_table.cc:8899
#11 0x00000000017aac23 in Sql_cmd_alter_table::execute (this=0x7fa9ac006460, thd=0x7fa9ac000bb0)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_alter.cc:316
#12 0x00000000015c5a14 in mysql_execute_command (thd=0x7fa9ac000bb0) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_parse.cc:4495
#13 0x00000000015c78b1 in mysql_parse (thd=0x7fa9ac000bb0, parser_state=0x7faa3175fe50) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_parse.cc:5201
#14 0x00000000015bd46c in dispatch_command (thd=0x7fa9ac000bb0, com_data=0x7faa31760e00, command=COM_QUERY)
    at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_parse.cc:1280
#15 0x00000000015bc0bf in do_command (thd=0x7fa9ac000bb0) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/sql_parse.cc:851
#16 0x00000000016e052e in handle_connection (arg=0x5326aa0) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/sql/conn_handler/connection_handler_per_thread.cc:299
#17 0x0000000001ce1375 in pfs_spawn_thread (arg=0x522d6c0) at /export/home3/pb2/build/sb_0-14765270-1426872165.51/mysqlcom-pro-5.7.8-rc/storage/perfschema/pfs.cc:2147
#18 0x00007faa3cf32df3 in start_thread () from /lib64/libpthread.so.0
#19 0x00007faa3bbfe47d in clone () from /lib64/libc.so.6
[23 Mar 2015 5:21] Umesh Shastry
// 5.8.0 - debug build affected

bin/mysql_install_db --basedir=/export/umesh/mysql-5.8.0 --datadir=/export/umesh/mysql-5.8.0/76445 -v
bin/mysqld-debug --basedir=/export/umesh/mysql-5.8.0 --datadir=/export/umesh/mysql-5.8.0/76445 --core-file --socket=/tmp/mysql_ushastry.sock  --port=15000 --log-error=/export/umesh/mysql-5.8.0/76445/log.err 2>&1 &

- build

commit: b48798db34fbcaf5dbb5c8ae7ef738afeb60eccc
date: 2015-03-20 14:52:33 +0100
build-date: 2015-03-20 17:03:10 +0100
short: b48798d
branch: mysql-trunk

MySQL source 5.8.0

(gdb) bt
#0  0x00007f95a460a771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000018b3108 in my_write_core (sig=6) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/mysys/stacktrace.c:247
#2  0x0000000000f3d9fb in handle_fatal_signal (sig=6) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/signal_handler.cc:221
#3  <signal handler called>
#4  0x00007f95a32105c9 in raise () from /lib64/libc.so.6
#5  0x00007f95a3211cd8 in abort () from /lib64/libc.so.6
#6  0x0000000001af2303 in ut_dbg_assertion_failed (expr=0x22177c4 "0",
    file=0x22184b0 "/export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/storage/innobase/handler/handler0alter.cc", line=6651)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/storage/innobase/ut/ut0dbg.cc:67
#7  0x000000000193cd68 in ha_innobase::commit_inplace_alter_table (this=0x7f951c00fe20, altered_table=0x7f951c00eec0, ha_alter_info=0x7f9598e30150, commit=true)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/storage/innobase/handler/handler0alter.cc:6651
#8  0x0000000000fac54b in handler::ha_commit_inplace_alter_table (this=0x7f951c00fe20, altered_table=0x7f951c00eec0, ha_alter_info=0x7f9598e30150, commit=true)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/handler.cc:4467
#9  0x0000000001638574 in mysql_inplace_alter_table (thd=0x7f951c000bb0, table_list=0x7f951c005ce0, table=0x7f951c93ab40, altered_table=0x7f951c00eec0, ha_alter_info=0x7f9598e30150,
    inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7f9598e2fb90, alter_ctx=0x7f9598e306e0)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_table.cc:7002
#10 0x000000000163ccb6 in mysql_alter_table (thd=0x7f951c000bb0, new_db=0x7f951c006268 "test", new_name=0x0, create_info=0x7f9598e31570, table_list=0x7f951c005ce0, alter_info=0x7f9598e314c0)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_table.cc:8903
#11 0x0000000001797cbf in Sql_cmd_alter_table::execute (this=0x7f951c006460, thd=0x7f951c000bb0)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_alter.cc:319
#12 0x00000000015aeb81 in mysql_execute_command (thd=0x7f951c000bb0) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:4450
#13 0x00000000015b0a1d in mysql_parse (thd=0x7f951c000bb0, parser_state=0x7f9598e32e50) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:5158
#14 0x00000000015a66e6 in dispatch_command (thd=0x7f951c000bb0, com_data=0x7f9598e33e00, command=COM_QUERY)
    at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:1245
#15 0x00000000015a5335 in do_command (thd=0x7f951c000bb0) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/sql_parse.cc:814
#16 0x00000000016ca436 in handle_connection (arg=0x5573fe0) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/sql/conn_handler/connection_handler_per_thread.cc:300
#17 0x0000000001c59c8d in pfs_spawn_thread (arg=0x548d170) at /export/home3/pb2/build/sb_0-14764689-1426868485.86/mysqlcom-pro-5.8.0-m17/storage/perfschema/pfs.cc:2147
#18 0x00007f95a4605df3 in start_thread () from /lib64/libpthread.so.0
#19 0x00007f95a32d147d in clone () from /lib64/libc.so.6
[23 Mar 2015 5:23] Umesh Shastry
// latest debug/release builds of 5.6.25 are not affected
[16 Apr 2015 17:59] Paul Dubois
Noted in 5.7.8, 5.8.0 changelogs.

Attempts to create a foreign key matching a FULLTEXT index failed.
For debug builds, attempts to create a foreign key matching a SPATIAL
index raised an assertion.
[18 Jun 2016 21:25] Omer Barnir
Posted by developer:
 
Reported version value updated to reflect release name change from 5.8 to 8.0