Bug #89087 | Assertion `key->flags & 1' failed | ||
---|---|---|---|
Submitted: | 1 Jan 2018 22:26 | Modified: | 8 Feb 2018 17:51 |
Reporter: | Roel Van de Paar | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S6 (Debug Builds) |
Version: | 5.7.20 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[1 Jan 2018 22:26]
Roel Van de Paar
[2 Jan 2018 5:57]
MySQL Verification Team
Hello Roel, Thank you for the report and test case. Observed that 5.7.20 debug build is affected. Thanks, Umesh
[2 Jan 2018 5:57]
MySQL Verification Team
-- 5.7.20 debug build affected rm -rf 89087 bin/mysqld --initialize-insecure --basedir=$PWD --datadir=$PWD/89087 bin/mysqld-debug --no-defaults --basedir=$PWD --datadir=$PWD/89087 --core-file --socket=/tmp/mysql_5720.sock --port=5720 --log-error=$PWD/89087/log.err 2>&1 & (gdb) bt #0 0x00007f7d5a0b6771 in pthread_kill () from /lib64/libpthread.so.0 #1 0x00000000018d6751 in my_write_core (sig=6) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/mysys/stacktrace.c:249 #2 0x0000000000ed7e3a in handle_fatal_signal (sig=6) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/sql/signal_handler.cc:220 #3 <signal handler called> #4 0x00007f7d58ab05d7 in raise () from /lib64/libc.so.6 #5 0x00007f7d58ab1cc8 in abort () from /lib64/libc.so.6 #6 0x00007f7d58aa9546 in __assert_fail_base () from /lib64/libc.so.6 #7 0x00007f7d58aa95f2 in __assert_fail () from /lib64/libc.so.6 #8 0x00000000019f2453 in innobase_create_index_def (altered_table=0x7f7cfc01ae00, keys=0x7f7cfc006e30, key_number=1, new_clustered=true, key_clustered=true, index=0x7f7cfc01c180, heap=0x7f7cfc01bf58) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/storage/innobase/handler/handler0alter.cc:2016 #9 0x00000000019f33b3 in innobase_create_key_defs (heap=0x7f7cfc01bf58, ha_alter_info=0x7f7d380f9860, altered_table=0x7f7cfc01ae00, n_add=@0x7f7cfc007048: 1, n_fts_add=@0x7f7d380f8758: 0, got_default_clust=true, fts_doc_id_col=@0x7f7d380f88e0: 18446744073709551615, add_fts_doc_id=@0x7f7d380f86dc: false, add_fts_doc_idx=@0x7f7d380f86d8: false) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/storage/innobase/handler/handler0alter.cc:2426 #10 0x00000000019f77a3 in prepare_inplace_alter_table_dict (ha_alter_info=0x7f7d380f9860, altered_table=0x7f7cfc01ae00, old_table=0x7f7cfc01a460, table_name=0x7f7cfc00f4f5 "t1", flags=33, flags2=80, fts_doc_id_col=18446744073709551615, add_fts_doc_id=false, add_fts_doc_id_idx=false) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/storage/innobase/handler/handler0alter.cc:4287 #11 0x00000000019fcd6a in ha_innobase::prepare_inplace_alter_table (this=0x7f7cfc00f720, altered_table=0x7f7cfc01ae00, ha_alter_info=0x7f7d380f9860) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/storage/innobase/handler/handler0alter.cc:6085 #12 0x0000000000f57f67 in handler::ha_prepare_inplace_alter_table (this=0x7f7cfc00f720, altered_table=0x7f7cfc01ae00, ha_alter_info=0x7f7d380f9860) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/sql/handler.cc:4789 #13 0x0000000001621be2 in mysql_inplace_alter_table (thd=0x7f7cfc000b70, table_list=0x7f7cfc005fc0, table=0x7f7cfc01a460, altered_table=0x7f7cfc01ae00, ha_alter_info=0x7f7d380f9860, inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7f7d380fa1f0, alter_ctx=0x7f7d380f8dc0) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/sql/sql_table.cc:7479 #14 0x00000000016270f0 in mysql_alter_table (thd=0x7f7cfc000b70, new_db=0x7f7cfc006548 "test", new_name=0x0, create_info=0x7f7d380fac50, table_list=0x7f7cfc005fc0, alter_info=0x7f7d380fad50) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/sql/sql_table.cc:9711 #15 0x00000000017aa0d1 in Sql_cmd_alter_table::execute (this=0x7f7cfc0066f0, thd=0x7f7cfc000b70) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/sql/sql_alter.cc:316 #16 0x0000000001592426 in mysql_execute_command (thd=0x7f7cfc000b70, first_level=true) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/sql/sql_parse.cc:4857 #17 0x00000000015943b9 in mysql_parse (thd=0x7f7cfc000b70, parser_state=0x7f7d380fc690) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/sql/sql_parse.cc:5577 #18 0x0000000001588d5e in dispatch_command (thd=0x7f7cfc000b70, com_data=0x7f7d380fce00, command=COM_QUERY) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/sql/sql_parse.cc:1461 #19 0x0000000001587b61 in do_command (thd=0x7f7cfc000b70) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/sql/sql_parse.cc:999 #20 0x00000000016be3c0 in handle_connection (arg=0x4478290) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/sql/conn_handler/connection_handler_per_thread.cc:300 #21 0x0000000001910aa4 in pfs_spawn_thread (arg=0x4467290) at /export/home/pb2/build/sb_0-24964902-1505322971.88/mysql-5.7.20/storage/perfschema/pfs.cc:2190 #22 0x00007f7d5a0b1df5 in start_thread () from /lib64/libpthread.so.0 #23 0x00007f7d58b7160d in clone () from /lib64/libc.so.6
[2 Jan 2018 5:58]
MySQL Verification Team
-- 5.7.21 only debug build affected (gdb) bt #0 0x00007ff4791d3771 in pthread_kill () from /lib64/libpthread.so.0 #1 0x000000000185f6ad in my_write_core (sig=6) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/mysys/stacktrace.c:249 #2 0x0000000000ea9966 in handle_fatal_signal (sig=6) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/sql/signal_handler.cc:220 #3 <signal handler called> #4 0x00007ff477bcd5d7 in raise () from /lib64/libc.so.6 #5 0x00007ff477bcecc8 in abort () from /lib64/libc.so.6 #6 0x00007ff477bc6546 in __assert_fail_base () from /lib64/libc.so.6 #7 0x00007ff477bc65f2 in __assert_fail () from /lib64/libc.so.6 #8 0x00000000018ea602 in innobase_create_index_def (altered_table=0x7ff410277a60, keys=0x7ff410045110, key_number=1, new_clustered=true, key_clustered=true, index=0x7ff410038b90, heap=0x7ff410038968) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/storage/innobase/handler/handler0alter.cc:2016 #9 0x00000000018eb536 in innobase_create_key_defs (heap=0x7ff410038968, ha_alter_info=0x7ff458626be0, altered_table=0x7ff410277a60, n_add=@0x7ff410045328: 1, n_fts_add=@0x7ff458625e70: 0, got_default_clust=true, fts_doc_id_col=@0x7ff458625fd0: 18446744073709551615, add_fts_doc_id=@0x7ff458625dfc: false, add_fts_doc_idx=@0x7ff458625df8: false) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/storage/innobase/handler/handler0alter.cc:2426 #10 0x00000000018ef839 in prepare_inplace_alter_table_dict (ha_alter_info=0x7ff458626be0, altered_table=0x7ff410277a60, old_table=0x7ff4102705d0, table_name=0x7ff41028e785 "t1", flags=33, flags2=80, fts_doc_id_col=18446744073709551615, add_fts_doc_id=false, add_fts_doc_id_idx=false) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/storage/innobase/handler/handler0alter.cc:4287 #11 0x00000000018f4c17 in ha_innobase::prepare_inplace_alter_table (this=0x7ff410011d00, altered_table=0x7ff410277a60, ha_alter_info=0x7ff458626be0) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/storage/innobase/handler/handler0alter.cc:6086 #12 0x0000000000f2b1d3 in handler::ha_prepare_inplace_alter_table (this=0x7ff410011d00, altered_table=0x7ff410277a60, ha_alter_info=0x7ff458626be0) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/sql/handler.cc:4789 #13 0x00000000015bc87c in mysql_inplace_alter_table (thd=0x7ff410047c60, table_list=0x7ff4100442a0, table=0x7ff4102705d0, altered_table=0x7ff410277a60, ha_alter_info=0x7ff458626be0, inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7ff458626620, alter_ctx=0x7ff458627170) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/sql/sql_table.cc:7480 #14 0x00000000015c1b12 in mysql_alter_table (thd=0x7ff410047c60, new_db=0x7ff410044828 "test", new_name=0x0, create_info=0x7ff458627e10, table_list=0x7ff4100442a0, alter_info=0x7ff458627d60) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/sql/sql_table.cc:9712 #15 0x0000000001738d21 in Sql_cmd_alter_table::execute (this=0x7ff4100449d0, thd=0x7ff410047c60) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/sql/sql_alter.cc:316 #16 0x0000000001530880 in mysql_execute_command (thd=0x7ff410047c60, first_level=true) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/sql/sql_parse.cc:4854 #17 0x0000000001532623 in mysql_parse (thd=0x7ff410047c60, parser_state=0x7ff458629690) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/sql/sql_parse.cc:5582 #18 0x0000000001527ec6 in dispatch_command (thd=0x7ff410047c60, com_data=0x7ff458629df0, command=COM_QUERY) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/sql/sql_parse.cc:1458 #19 0x0000000001526e09 in do_command (thd=0x7ff410047c60) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/sql/sql_parse.cc:999 #20 0x00000000016565d6 in handle_connection (arg=0x48b3da0) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/sql/conn_handler/connection_handler_per_thread.cc:300 #21 0x0000000001cd3fcb in pfs_spawn_thread (arg=0x48c57c0) at /export/home/pb2/build/sb_0-25673884-1510161542.84/mysqlcom-pro-5.7.21/storage/perfschema/pfs.cc:2190 #22 0x00007ff4791cedf5 in start_thread () from /lib64/libpthread.so.0 #23 0x00007ff477c8e60d in clone () from /lib64/libc.so.6 (gdb) [umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-advanced-5.7.21-linux-x86_64: cat docs/INFO_SRC commit: ddfbfcfdfcb4f77f72e459a293686a2be27af112 date: 2017-11-08 17:46:12 +0530 build-date: 2017-11-08 18:00:52 +0100 short: ddfbfcf branch: mysql-5.7 MySQL source 5.7.21
[24 Jan 2018 0:10]
Jimmy Yang
Posted by developer: Ok, here is the assertion: 2355 DBUG_ASSERT(key->flags & HA_NOSAME); (gdb) p key->flags $1 = 0 (gdb) p key $2 = (const KEY *) 0x7fff70135be0 (gdb) p *key $3 = {key_length = 4, flags = 0, actual_flags = 0, user_defined_key_parts = 1, actual_key_parts = 1, unused_key_parts = 0, usable_key_parts = 1, block_size = 0, algorithm = HA_KEY_ALG_BTREE, is_algorithm_explicit = false, parser = 0x0, parser_name = {str = 0x0, length = 0}, key_part = 0x7fff701abee8, name = 0x7fff70020718 "c1", rec_per_key = 0x0, m_in_memory_estimate = 0, rec_per_key_float = 0x0, is_visible = true, table = 0x0, comment = {str = 0x0, length = 0}} The situation is in the last alter, server found index c1 can be chosen to be PRIMARY KEY, since it is a unique index on non-nullible column. However, to be a cluster index, InnoDB assume server will set NOSAME flag on the key to specify that NO duplicate is allowed. For some reason, server did not set this flag, so the assertion triggered. So server/runtime needs to check why this flag is not set.
[8 Feb 2018 17:51]
Daniel Price
Posted by developer: Fixed as of the upcoming 8.0.5 release, and here's the changelog entry: An ALTER TABLE operation that modified the nullability of an indexed column raised an assertion. InnoDB incorrectly assumed that a new primary key must be added instead of created from an existing unique key.