Bug #74810 | ALTER TABLE fails to check if a table is corrupted | ||
---|---|---|---|
Submitted: | 12 Nov 2014 8:50 | Modified: | 24 Nov 2014 16:10 |
Reporter: | Ramesh Sivaraman | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
Version: | 5.6.21-debug, 5.6.23, 5.7.6 | OS: | Linux (CentOS 7) |
Assigned to: | CPU Architecture: | Any |
[12 Nov 2014 8:50]
Ramesh Sivaraman
[12 Nov 2014 9:28]
MySQL Verification Team
Hello Ramesh Sivaraman, Thank you for the bug report and test case. Observed that 5.6.23/5.7.6 debug builds are affected. Thanks, Umesh
[12 Nov 2014 9:28]
MySQL Verification Team
// 5.6.23 - Debug build is affected (gdb) bt #0 __pthread_kill (threadid=<value optimized out>, signo=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:63 #1 0x0000000000affdab in my_write_core (sig=11) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/mysys/stacktrace.c:422 #2 0x000000000077ebbc in handle_fatal_signal (sig=11) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/signal_handler.cc:230 #3 <signal handler called> #4 strnlen () at ../sysdeps/x86_64/strnlen.S:35 #5 0x0000000000ecfffb in process_str_arg (cs=0x19698c0, to=0x7fd24bd06ae6 "", end=0x7fd24bd06cdf "", width=18446744073709551615, par=0x8f8f8f8f8f8f8f8f <Address 0x8f8f8f8f8f8f8f8f out of bounds>, print_type=0) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/strings/my_vsnprintf.c:195 #6 0x0000000000ed1c5c in my_vsnprintf_ex (cs=0x19698c0, to=0x7fd24bd06ae6 "", n=512, fmt=0x20930df "s is corrupted", ap=0x7fd24bd06ce0) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/strings/my_vsnprintf.c:607 #7 0x0000000000af6ba4 in my_error (nr=1712, MyFlags=0) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/mysys/my_error.c:181 #8 0x0000000000bbb1b8 in ha_innobase::inplace_alter_table (this=0x7fd2180215d0, altered_table=0x7fd21801aac0, ha_alter_info=0x7fd24bd07ac0) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/storage/innobase/handler/handler0alter.cc:3987 #9 0x00000000008a64a7 in handler::ha_inplace_alter_table (this=0x7fd2180215d0, altered_table=0x7fd21801aac0, ha_alter_info=0x7fd24bd07ac0) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/handler.h:2870 #10 0x000000000089ee70 in mysql_inplace_alter_table (thd=0x2795200, table_list=0x7fd218005100, table=0x7fd21801fce0, altered_table=0x7fd21801aac0, ha_alter_info=0x7fd24bd07ac0, inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7fd24bd08420, alter_ctx=0x7fd24bd07010) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_table.cc:6586 #11 0x00000000008a33d0 in mysql_alter_table (thd=0x2795200, new_db=0x7fd218005660 "test", new_name=0x0, create_info=0x7fd24bd08e90, table_list=0x7fd218005100, alter_info=0x7fd24bd08f70, order_num=0, order=0x0, ignore=false) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_table.cc:8419 #12 0x00000000009ea48a in Sql_cmd_alter_table::execute (this=0x7fd218005730, thd=0x2795200) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_alter.cc:313 #13 0x000000000083490e in mysql_execute_command (thd=0x2795200) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:4945 #14 0x0000000000837fa9 in mysql_parse (thd=0x2795200, rawbuf=0x7fd218004ff0 "ALTER TABLE t1 ADD COLUMN c4 INT COMMENT ' E '", length=46, parser_state=0x7fd24bd0a680) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:6357 #15 0x000000000082a92b in dispatch_command (command=COM_QUERY, thd=0x2795200, packet=0x28c3a91 "ALTER TABLE t1 ADD COLUMN c4 INT COMMENT ' E '", packet_length=46) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:1332 #16 0x0000000000829990 in do_command (thd=0x2795200) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:1034 #17 0x00000000007f0d8f in do_handle_one_connection (thd_arg=0x2795200) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_connect.cc:982 #18 0x00000000007f0860 in handle_one_connection (arg=0x2795200) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_connect.cc:898 #19 0x0000000000e5f509 in pfs_spawn_thread (arg=0x28871c0) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/storage/perfschema/pfs.cc:1860 #20 0x0000003deb0079d1 in start_thread (arg=0x7fd24bd0b700) at pthread_create.c:301 #21 0x0000003deace89dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
[12 Nov 2014 9:30]
MySQL Verification Team
// 5.7.6 - Debug build is affected (gdb) bt #0 __pthread_kill (threadid=<value optimized out>, signo=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:63 #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 (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #5 0x0000003deac33e05 in abort () at abort.c:92 #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=0x7f9700024748, latch_mode=1, cursor=0x7f973de520f0, 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=0x7f973de51be0) 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=0x7f9700024748, latch_mode=1, pcur=0x7f973de520f0, init_pcur=true, level=0, mtr=0x7f973de51be0) 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=0x7f973ea3c8f8, table=0x7f97000393e0, old_table=0x7f970001fb18, new_table=0x7f97000437f8, online=true, index=0x7f970003b3a0, fts_sort_idx=0x0, psort_info=0x0, files=0x7f9700021820, key_numbers=0x7f970003b3a8, n_index=1, add_cols=0x7f970003b3f0, col_map=0x7f970003b4a0, add_autoinc=18446744073709551615, sequence=..., block=0x7f973db17000 <Address 0x7f973db17000 out of bounds>, skip_pk_sort=true, tmpfd=0x7f973de527ec) 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=0x7f973ea3c8f8, old_table=0x7f970001fb18, new_table=0x7f97000437f8, online=true, indexes=0x7f970003b3a0, key_numbers=0x7f970003b3a8, n_indexes=1, table=0x7f97000393e0, add_cols=0x7f970003b3f0, col_map=0x7f970003b4a0, add_autoinc=18446744073709551615, sequence=..., skip_pk_sort=true) 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=0x7f9700038150, altered_table=0x7f97000393e0, ha_alter_info=0x7f973de53870) 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=0x7f9700038150, altered_table=0x7f97000393e0, ha_alter_info=0x7f973de53870) 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=0x7f9700000cf0, table_list=0x7f9700005da8, table=0x7f97000377b0, altered_table=0x7f97000393e0, ha_alter_info=0x7f973de53870, inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7f973de541f0, alter_ctx=0x7f973de52dd0) 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=0x7f9700000cf0, new_db=0x7f9700006320 "test", new_name=0x0, create_info=0x7f973de54c80, table_list=0x7f9700005da8, alter_info=0x7f973de54d60) 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=0x7f9700006400, thd=0x7f9700000cf0) 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=0x7f9700000cf0) 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=0x7f9700000cf0, parser_state=0x7f973de56660) 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=0x7f9700000cf0, packet=0x7f9700009a21 "ALTER TABLE t1 ADD COLUMN c4 INT COMMENT ' E '", packet_length=46) 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=0x7f9700000cf0) 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=0x36245a0) 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=0x347aba0) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/storage/perfschema/pfs.cc:2137 #22 0x0000003deb0079d1 in start_thread (arg=0x7f973de57700) at pthread_create.c:301 #23 0x0000003deace89dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
[12 Nov 2014 13:10]
Marko Mäkelä
This looks like a design problem, similar to Bug#74663 DROP TABLE CORRUPTS TABLE
[24 Nov 2014 15:29]
Daniel Price
Posted by developer: commit dd0cf2ee237866146f90cb0452f1d71fe29d990b Author: Marko Mäkelä <marko.makela@oracle.com> Date: Mon Nov 17 14:22:20 2014 +0200 Bug#20015132 ALTER TABLE FAILS TO CHECK IF TABLE IS CORRUPTED ha_innobase::prepare_inplace_alter_table(): If the clustered index is corrupted or the table is marked as corrupted, refuse any ALTER TABLE operation that would affect the InnoDB metadata. prepare_inplace_alter_table_dict(): If the table is not being rebuilt, and a corrupted secondary index would remain after the ALTER TABLE operation, refuse the operation. commit_try_norebuild(), row_merge_drop_indexes_dict(): Handle error==DB_TOO_MANY_CONCURRENT_TRXS as a special case.
[24 Nov 2014 16:10]
Daniel Price
Posted by developer: Fixed as of the upcoming 5.7.6 release, and here's the changelog entry: "ALTER TABLE" failed to check if the table is corrupted. An "ALTER TABLE" operation that affects "InnoDB" metadata should be refused if the clustered index is corrupted or the table is marked as corrupted. An "ALTER TABLE" operation should also be refused if the table is not rebuilt and a corrupted secondary index would remain after the "ALTER TABLE" operation.
[14 Aug 2017 1:46]
Roel Van de Paar
A 5.6 backport would be appreciated.