Bug #74682 Assertion: index->id == btr_page_get_index_id(page) in btr0cur.cc line 899
Submitted: 4 Nov 2014 13:32 Modified: 4 Nov 2014 14:21
Reporter: Ramesh Sivaraman Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:5.6.20-debug, 5.6.22, 5.7.6 OS:Linux (CentOS 7)
Assigned to: CPU Architecture:Any

[4 Nov 2014 13:32] Ramesh Sivaraman
Description:
2014-11-04 13:22:11 7fa170295700  InnoDB: Assertion failure in thread 140331348219648 in file btr0cur.cc line 899
InnoDB: Failing assertion: index->id == btr_page_get_index_id(page)

**** GDB info

#0  0x00007fa16fc9c771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000a9035e in my_write_core (sig=6) at /ssd/ramesh/mysql-server/mysql-5.6/mysys/stacktrace.c:422
#2  0x0000000000723688 in handle_fatal_signal (sig=6) at /ssd/ramesh/mysql-server/mysql-5.6/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x00007fa16eaa85c9 in raise () from /lib64/libc.so.6
#5  0x00007fa16eaa9cd8 in abort () from /lib64/libc.so.6
#6  0x0000000000cf8cd8 in btr_cur_open_at_index_side_func (from_left=true, index=0x7fa0d306cff8, latch_mode=1, cursor=0x7fa170290240, level=0, file=0x101e698 "/ssd/ramesh/mysql-server/mysql-5.6/storage/innobase/include/btr0pcur.ic", line=518, mtr=0x7fa170290320) at /ssd/ramesh/mysql-server/mysql-5.6/storage/innobase/btr/btr0cur.cc:899
#7  0x0000000000c311cd in btr_pcur_open_at_index_side (from_left=true, index=0x7fa0d306cff8, latch_mode=1, pcur=0x7fa170290240, init_pcur=true, level=0, mtr=0x7fa170290320) at /ssd/ramesh/mysql-server/mysql-5.6/storage/innobase/include/btr0pcur.ic:518
#8  0x0000000000c348e7 in row_merge_read_clustered_index (trx=0x7fa0d30c7478, table=0x7fa0d315de00, old_table=0x7fa0d3081378, new_table=0x7fa0d3081378, online=true, index=0x7fa16dc188b8, fts_sort_idx=0x0, psort_info=0x0, files=0x7fa0d301c678, key_numbers=0x7fa16dc188c8, n_index=2, add_cols=0x0, col_map=0x0, add_autoinc=18446744073709551615, sequence=..., block=0x7fa16e4f6000 <Address 0x7fa16e4f6000 out of bounds>) at /ssd/ramesh/mysql-server/mysql-5.6/storage/innobase/row/row0merge.cc:1267
#9  0x0000000000c39a12 in row_merge_build_indexes (trx=0x7fa0d30c7478, old_table=0x7fa0d3081378, new_table=0x7fa0d3081378, online=true, indexes=0x7fa16dc188b8, key_numbers=0x7fa16dc188c8, n_indexes=2, table=0x7fa0d315de00, add_cols=0x0, col_map=0x0, add_autoinc=18446744073709551615, sequence=...) at /ssd/ramesh/mysql-server/mysql-5.6/storage/innobase/row/row0merge.cc:3534
#10 0x0000000000b6e4c9 in ha_innobase::inplace_alter_table (this=0x7fa0d307d010, altered_table=0x7fa0d315de00, ha_alter_info=0x7fa1702912f0) at /ssd/ramesh/mysql-server/mysql-5.6/storage/innobase/handler/handler0alter.cc:3932
#11 0x0000000000845455 in handler::ha_inplace_alter_table (this=0x7fa0d307d010, altered_table=0x7fa0d315de00, ha_alter_info=0x7fa1702912f0) at /ssd/ramesh/mysql-server/mysql-5.6/sql/handler.h:2868
#12 0x000000000083e198 in mysql_inplace_alter_table (thd=0x7fa0dc724000, table_list=0x7fa0d301f118, table=0x7fa0d3051600, altered_table=0x7fa0d315de00, ha_alter_info=0x7fa1702912f0, inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7fa170290d40, alter_ctx=0x7fa170291850) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_table.cc:6574
#13 0x000000000084247d in mysql_alter_table (thd=0x7fa0dc724000, new_db=0x7fa0d301f678 "test", new_name=0x0, create_info=0x7fa1702926e0, table_list=0x7fa0d301f118, alter_info=0x7fa170292650, order_num=0, order=0x0, ignore=false) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_table.cc:8395
#14 0x000000000098177f in Sql_cmd_alter_table::execute (this=0x7fa0d301f820, thd=0x7fa0dc724000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_alter.cc:313
#15 0x00000000007d5ea3 in mysql_execute_command (thd=0x7fa0dc724000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:4945
#16 0x00000000007d8fa4 in mysql_parse (thd=0x7fa0dc724000, rawbuf=0x7fa0d301f010 "alter table t1 add unique(a,b),add key (b)", length=42, parser_state=0x7fa170293e70) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:6245
#17 0x00000000007cc557 in dispatch_command (command=COM_QUERY, thd=0x7fa0dc724000, packet=0x7fa0dc762001 "alter table t1 add unique(a,b),add key (b)", packet_length=42) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:1332
#18 0x00000000007cb646 in do_command (thd=0x7fa0dc724000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:1034
#19 0x0000000000793a61 in do_handle_one_connection (thd_arg=0x7fa0dc724000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_connect.cc:982
#20 0x000000000079354a in handle_one_connection (arg=0x7fa0dc724000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_connect.cc:898
#21 0x0000000000ad4b5c in pfs_spawn_thread (arg=0x7fa16bffeb00) at /ssd/ramesh/mysql-server/mysql-5.6/storage/perfschema/pfs.cc:1860
#22 0x00007fa16fc97df3 in start_thread () from /lib64/libpthread.so.0
#23 0x00007fa16eb6901d in clone () from /lib64/libc.so.6

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
set global innodb_undo_logs=1;
set global innodb_trx_rseg_n_slots_debug=1;
create table t1(a INT,b INT);
DROP TABLE t1;
alter table t1 add unique(a,b),add key (b);
[4 Nov 2014 13:43] MySQL Verification Team
Hello Ramesh Sivaraman,

Thank you for the bug report and test case.
Confirmed the issue with debug build of 5.6.22

Thanks,
Umesh
[4 Nov 2014 13:44] MySQL Verification Team
//
/data/ushastry/server/mysql-advanced-5.6.22/scripts/mysql_install_db --basedir=/data/ushastry/server/mysql-advanced-5.6.22 --datadir=/tmp/bug --user=root
/data/ushastry/server/mysql-advanced-5.6.22/bin/mysqld-debug --basedir=/data/ushastry/server/mysql-advanced-5.6.22 --tmpdir=/tmp/bug --datadir=/tmp/bug --core --socket=/tmp/mysql.sock  --port=3306 --log-error=/tmp/bug/log.err --maximum-bulk_insert_buffer_size=1M --maximum-join_buffer_size=1M --maximum-max_heap_table_size=1M --maximum-max_join_size=1M --maximum-myisam_max_sort_file_size=1M --maximum-myisam_mmap_size=1M --maximum-myisam_sort_buffer_size=1M --maximum-optimizer_trace_max_mem_size=1M --maximum-preload_buffer_size=1M --maximum-query_alloc_block_size=1M --maximum-query_prealloc_size=1M --maximum-range_alloc_block_size=1M --maximum-read_buffer_size=1M --maximum-read_rnd_buffer_size=1M --maximum-sort_buffer_size=1M --maximum-tmp_table_size=1M --maximum-transaction_alloc_block_size=1M --maximum-transaction_prealloc_size=1M --log-output=none --sql_mode=ONLY_FULL_GROUP_BY --user=root 2>&1 &

mysql> show variables like '%version%';
+-------------------------+---------------------------------------------------------------+
| Variable_name           | Value                                                         |
+-------------------------+---------------------------------------------------------------+
| innodb_version          | 5.6.22                                                        |
| protocol_version        | 10                                                            |
| slave_type_conversions  |                                                               |
| version                 | 5.6.22-enterprise-commercial-advanced-debug                   |
| version_comment         | MySQL Enterprise Server - Advanced Edition Debug (Commercial) |
| version_compile_machine | x86_64                                                        |
| version_compile_os      | Linux                                                         |
+-------------------------+---------------------------------------------------------------+
7 rows in set (0.00 sec)

mysql> DROP DATABASE test;CREATE DATABASE test;USE test;
Query OK, 0 rows affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

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

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

mysql> create table t1(a INT,b INT);
Query OK, 0 rows affected (0.03 sec)

mysql> DROP TABLE t1;
ERROR 177 (HY000): Too many active concurrent transactions
mysql> alter table t1 add unique(a,b),add key (b);
ERROR 2013 (HY000): Lost connection to MySQL server during query

(gdb) bt
#0  0x0000003deb00c8ac in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000b0011b in my_write_core (sig=6) at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/mysys/stacktrace.c:422
#2  0x000000000077ecb8 in handle_fatal_signal (sig=6) at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x0000003deac32625 in raise () from /lib64/libc.so.6
#5  0x0000003deac33e05 in abort () from /lib64/libc.so.6
#6  0x0000000000d4508b in btr_cur_open_at_index_side_func (from_left=true, index=0x7fde6401c7f8, latch_mode=1, cursor=0x7fde8ee3c990, level=0,
    file=0x113dc88 "/pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/storage/innobase/include/btr0pcur.ic", line=518, mtr=0x7fde8ee3c4c0)
    at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/storage/innobase/btr/btr0cur.cc:899
#7  0x0000000000c7bb24 in btr_pcur_open_at_index_side (from_left=true, index=0x7fde6401c7f8, latch_mode=1, pcur=0x7fde8ee3c990, init_pcur=true, level=0, mtr=0x7fde8ee3c4c0)
    at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/storage/innobase/include/btr0pcur.ic:518
#8  0x0000000000c7f30d in row_merge_read_clustered_index (trx=0x7fde64032b08, table=0x7fde6401cf40, old_table=0x7fde6401a298, new_table=0x7fde6401a298, online=true, index=0x7fde6401e218,
    fts_sort_idx=0x0, psort_info=0x0, files=0x7fde6401f108, key_numbers=0x7fde6401e228, n_index=2, add_cols=0x0, col_map=0x0, add_autoinc=18446744073709551615, sequence=...,
    block=0x7fde5fd00000 <Address 0x7fde5fd00000 out of bounds>) at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/storage/innobase/row/row0merge.cc:1267
#9  0x0000000000c84455 in row_merge_build_indexes (trx=0x7fde64032b08, old_table=0x7fde6401a298, new_table=0x7fde6401a298, online=true, indexes=0x7fde6401e218, key_numbers=0x7fde6401e228,
    n_indexes=2, table=0x7fde6401cf40, add_cols=0x0, col_map=0x0, add_autoinc=18446744073709551615, sequence=...)
    at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/storage/innobase/row/row0merge.cc:3539
#10 0x0000000000bb8ba3 in ha_innobase::inplace_alter_table (this=0x7fde640113a0, altered_table=0x7fde6401cf40, ha_alter_info=0x7fde8ee3dac0)
    at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/storage/innobase/handler/handler0alter.cc:3928
#11 0x00000000008a65f7 in handler::ha_inplace_alter_table (this=0x7fde640113a0, altered_table=0x7fde6401cf40, ha_alter_info=0x7fde8ee3dac0)
    at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/sql/handler.h:2870
#12 0x000000000089efc0 in mysql_inplace_alter_table (thd=0x350abf0, table_list=0x7fde640050d8, table=0x7fde64022920, altered_table=0x7fde6401cf40, ha_alter_info=0x7fde8ee3dac0,
    inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7fde8ee3e420, alter_ctx=0x7fde8ee3d010)
    at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/sql/sql_table.cc:6586
#13 0x00000000008a3520 in mysql_alter_table (thd=0x350abf0, new_db=0x7fde64005638 "test", new_name=0x0, create_info=0x7fde8ee3ee90, table_list=0x7fde640050d8, alter_info=0x7fde8ee3ef70,
    order_num=0, order=0x0, ignore=false) at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/sql/sql_table.cc:8419
#14 0x00000000009ea722 in Sql_cmd_alter_table::execute (this=0x7fde640057e0, thd=0x350abf0) at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/sql/sql_alter.cc:313
#15 0x0000000000834a46 in mysql_execute_command (thd=0x350abf0) at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/sql/sql_parse.cc:4945
#16 0x00000000008380e1 in mysql_parse (thd=0x350abf0, rawbuf=0x7fde64004fd0 "alter table t1 add unique(a,b),add key (b)", length=42, parser_state=0x7fde8ee40680)
    at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/sql/sql_parse.cc:6357
#17 0x000000000082aa63 in dispatch_command (command=COM_QUERY, thd=0x350abf0, packet=0x363a541 "alter table t1 add unique(a,b),add key (b)", packet_length=42)
    at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/sql/sql_parse.cc:1332
#18 0x0000000000829ac8 in do_command (thd=0x350abf0) at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/sql/sql_parse.cc:1034
#19 0x00000000007f0f17 in do_handle_one_connection (thd_arg=0x350abf0) at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/sql/sql_connect.cc:982
#20 0x00000000007f09e8 in handle_one_connection (arg=0x350abf0) at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/sql/sql_connect.cc:898
#21 0x0000000000e64c25 in pfs_spawn_thread (arg=0x35fdc70) at /pb2/build/sb_0-13562263-1414689457.82/mysqlcom-pro-5.6.22/storage/perfschema/pfs.cc:1860
#22 0x0000003deb0079d1 in start_thread () from /lib64/libpthread.so.0
#23 0x0000003deace89dd in clone () from /lib64/libc.so.6
[4 Nov 2014 13:46] MySQL Verification Team
// 5.7.6 debug build

(gdb) bt
#0  0x0000003deb00c8ac in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000f990a1 in my_write_core (sig=6) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/mysys/stacktrace.c:247
#2  0x000000000092d7cc in handle_fatal_signal (sig=6) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/signal_handler.cc:219
#3  <signal handler called>
#4  0x0000003deac32625 in raise () from /lib64/libc.so.6
#5  0x0000003deac33e05 in abort () from /lib64/libc.so.6
#6  0x000000000121b81b in ut_dbg_assertion_failed (expr=0x175ace8 "index->id == btr_page_get_index_id(page)",
    file=0x175a248 "/pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/storage/innobase/btr/btr0cur.cc", line=2231)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/storage/innobase/ut/ut0dbg.cc:67
#7  0x000000000124a9f8 in btr_cur_open_at_index_side_func (from_left=true, index=0x7f10fc0269a8, latch_mode=1, cursor=0x7f112a1720f0, level=0,
    file=0x171d1c0 "/pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/storage/innobase/include/btr0pcur.ic", line=551, mtr=0x7f112a171be0)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/storage/innobase/btr/btr0cur.cc:2231
#8  0x0000000001145726 in btr_pcur_open_at_index_side (from_left=true, index=0x7f10fc0269a8, latch_mode=1, pcur=0x7f112a1720f0, init_pcur=true, level=0, mtr=0x7f112a171be0)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/storage/innobase/include/btr0pcur.ic:551
#9  0x0000000001149ab5 in row_merge_read_clustered_index (trx=0x7f11333dc8f8, table=0x7f10fc02ae60, old_table=0x7f10fc022478, new_table=0x7f10fc022478, online=true, index=0x7f10fc02be98,
    fts_sort_idx=0x0, psort_info=0x0, files=0x7f10fc02a8b0, key_numbers=0x7f10fc02bea8, n_index=2, add_cols=0x0, col_map=0x0, add_autoinc=18446744073709551615, sequence=...,
    block=0x7f1129e37000 <Address 0x7f1129e37000 out of bounds>, skip_pk_sort=false, tmpfd=0x7f112a1727ec)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/storage/innobase/row/row0merge.cc:1557
#10 0x000000000114fba8 in row_merge_build_indexes (trx=0x7f11333dc8f8, old_table=0x7f10fc022478, new_table=0x7f10fc022478, online=true, indexes=0x7f10fc02be98, key_numbers=0x7f10fc02bea8,
    n_indexes=2, table=0x7f10fc02ae60, add_cols=0x0, col_map=0x0, add_autoinc=18446744073709551615, sequence=..., skip_pk_sort=false)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/storage/innobase/row/row0merge.cc:4020
#11 0x00000000010665d4 in ha_innobase::inplace_alter_table (this=0x7f10fc02a480, altered_table=0x7f10fc02ae60, ha_alter_info=0x7f112a173870)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/storage/innobase/handler/handler0alter.cc:4601
#12 0x0000000000d39be7 in handler::ha_inplace_alter_table (this=0x7f10fc02a480, altered_table=0x7f10fc02ae60, ha_alter_info=0x7f112a173870)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/handler.h:3248
#13 0x0000000000d320c1 in mysql_inplace_alter_table (thd=0x7f10fc000cf0, table_list=0x7f10fc005da8, table=0x7f10fc0318f0, altered_table=0x7f10fc02ae60, ha_alter_info=0x7f112a173870,
    inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7f112a1741f0, alter_ctx=0x7f112a172dd0)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_table.cc:6767
#14 0x0000000000d367ec in mysql_alter_table (thd=0x7f10fc000cf0, new_db=0x7f10fc006320 "test", new_name=0x0, create_info=0x7f112a174c80, table_list=0x7f10fc005da8, alter_info=0x7f112a174d60)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_table.cc:8629
#15 0x0000000000e7d727 in Sql_cmd_alter_table::execute (this=0x7f10fc0064c8, thd=0x7f10fc000cf0) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_alter.cc:315
#16 0x0000000000cbb4f7 in mysql_execute_command (thd=0x7f10fc000cf0) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:4785
#17 0x0000000000cbce6a in mysql_parse (thd=0x7f10fc000cf0, parser_state=0x7f112a176660) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:5397
#18 0x0000000000cb0f2c in dispatch_command (command=COM_QUERY, thd=0x7f10fc000cf0, packet=0x7f10fc009a21 "alter table t1 add unique(a,b),add key (b)", packet_length=42)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:1249
#19 0x0000000000cafbd4 in do_command (thd=0x7f10fc000cf0) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:833
#20 0x0000000000dbe89c in handle_connection (arg=0x450e0f0) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/conn_handler/connection_handler_per_thread.cc:298
#21 0x000000000138347f in pfs_spawn_thread (arg=0x4364760) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/storage/perfschema/pfs.cc:2137
#22 0x0000003deb0079d1 in start_thread () from /lib64/libpthread.so.0
#23 0x0000003deace89dd in clone () from /lib64/libc.so.6
[4 Nov 2014 14:21] Marko Mäkelä
This looks like a duplicate of Bug#74663, which is a crash in CHECK TABLE after a failed DROP TABLE. In both test cases, we have the following:

mysql> DROP TABLE t1;
ERROR 177 (HY000): Too many active concurrent transactions

Apparently, InnoDB will somehow corrupt the table in this case, and any subsequent operation on the table will fail.