Bug #92074 InnoDB: Assertion failure: ha_innodb.cc:5757:j < ncol
Submitted: 20 Aug 2018 2:38 Modified: 20 Aug 2018 5:34
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Partitions Severity:S6 (Debug Builds)
Version:8.0.12, 5.7.23 OS:Any
Assigned to: CPU Architecture:Any

[20 Aug 2018 2:38] Roel Van de Paar
Description:
2018-08-20T02:36:07.512213Z 9 [ERROR] [MY-010520] [Server] Invalid (old?) table or database name 't#tmp'
2018-08-20T02:36:07.719098Z 9 [ERROR] [MY-000000] [InnoDB] InnoDB: Assertion failure: ha_innodb.cc:5757:j < ncol

Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
57	../sysdeps/unix/sysv/linux/pthread_kill.c: No such file or directory.
[Current thread is 1 (Thread 0x7f5dfed77700 (LWP 8215))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x0000563d0538d78d in my_write_core (sig=6) at /git/MS-8.0.12_dbg/mysys/stacktrace.cc:278
#2  0x0000563d040e1d94 in handle_fatal_signal (sig=6) at /git/MS-8.0.12_dbg/sql/signal_handler.cc:249
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007f5dfedb8801 in __GI_abort () at abort.c:79
#6  0x0000563d05777239 in ut_dbg_assertion_failed (expr=0x563d06934bac "j < ncol", 
    file=0x563d069321b0 "/git/MS-8.0.12_dbg/storage/innobase/handler/ha_innodb.cc", line=5757)
    at /git/MS-8.0.12_dbg/storage/innobase/ut/ut0dbg.cc:90
#7  0x0000563d054b2b86 in innobase_build_v_templ (table=0x7f5dd52a4820, ib_table=0x7f5dd50e38b8, s_templ=0x7f5dd5260d58, add_v=0x0, 
    locked=true, share_tbl_name=0x7f5dd505d658 "./test/tp") at /git/MS-8.0.12_dbg/storage/innobase/handler/ha_innodb.cc:5757
#8  0x0000563d054fec5f in Ha_innopart_share::set_v_templ (this=0x7f5dd5298c20, table=0x7f5dd52a4820, ib_table=0x7f5dd50e38b8, 
    name=0x7f5dd505d658 "./test/tp") at /git/MS-8.0.12_dbg/storage/innobase/handler/ha_innopart.cc:273
#9  0x0000563d055004a6 in ha_innopart::open (this=0x7f5dd5393028, name=0x7f5dd505d658 "./test/tp", table_def=0x7f5dd501f3f8)
    at /git/MS-8.0.12_dbg/storage/innobase/handler/ha_innopart.cc:915
#10 0x0000563d04264dad in handler::ha_open (this=0x7f5dd5393028, table_arg=0x7f5dd52a4820, name=0x7f5dd505d658 "./test/tp", mode=2, 
    test_if_locked=2, table_def=0x7f5dd501f3f8) at /git/MS-8.0.12_dbg/sql/handler.cc:2633
#11 0x0000563d04072c8f in open_table_from_share (thd=0x7f5dd5023000, share=0x7f5dd505d328, alias=0x7f5dd53698d8 "tp", db_stat=39, 
    prgflag=8, ha_open_flags=0, outparam=0x7f5dd52a4820, is_create_table=false, table_def_param=0x7f5dd501f3f8)
    at /git/MS-8.0.12_dbg/sql/table.cc:2952
#12 0x0000563d03e9ed63 in open_table (thd=0x7f5dd5023000, table_list=0x7f5dd53698e0, ot_ctx=0x7f5dfed728a0)
    at /git/MS-8.0.12_dbg/sql/sql_base.cc:3298
#13 0x0000563d03ea291c in open_and_process_table (thd=0x7f5dd5023000, lex=0x7f5dfed72c10, tables=0x7f5dd53698e0, 
    counter=0x7f5dfed72c68, prelocking_strategy=0x7f5dfed72928, has_prelocking_list=false, ot_ctx=0x7f5dfed728a0)
    at /git/MS-8.0.12_dbg/sql/sql_base.cc:4958
#14 0x0000563d03ea3e8e in open_tables (thd=0x7f5dd5023000, start=0x7f5dfed72910, counter=0x7f5dfed72c68, flags=1026, 
    prelocking_strategy=0x7f5dfed72928) at /git/MS-8.0.12_dbg/sql/sql_base.cc:5583
#15 0x0000563d03ea55f7 in open_tables_for_query (thd=0x7f5dd5023000, tables=0x7f5dd53698e0, flags=1026)
    at /git/MS-8.0.12_dbg/sql/sql_base.cc:6363
#16 0x0000563d052a7e41 in dd::info_schema::Table_statistics::read_stat_by_open_table (this=0x7f5dd5028ec0, thd=0x7f5dd5023000, 
    schema_name_ptr=..., table_name_ptr=..., index_name_ptr=..., partition_name=0x0, column_name_ptr=..., 
    column_ordinal_position=0, stype=dd::info_schema::enum_table_stats_type::TABLE_ROWS)
    at /git/MS-8.0.12_dbg/sql/dd/info_schema/table_stats.cc:697
#17 0x0000563d052a7077 in dd::info_schema::Table_statistics::read_stat (this=0x7f5dd5028ec0, thd=0x7f5dd5023000, 
    schema_name_ptr=..., table_name_ptr=..., index_name_ptr=..., partition_name=0x0, column_name_ptr=..., index_ordinal_position=0, 
    column_ordinal_position=0, engine_name_ptr=..., se_private_id=0, ts_se_private_data=0x0, tbl_se_private_data=0x0, 
    table_stat_data=@0x7f5dfed73a08: 0, cached_timestamp=@0x7f5dfed73a10: 0, 
    stype=dd::info_schema::enum_table_stats_type::TABLE_ROWS) at /git/MS-8.0.12_dbg/sql/dd/info_schema/table_stats.cc:468
#18 0x0000563d04368596 in dd::info_schema::Table_statistics::read_stat (this=0x7f5dd5028ec0, thd=0x7f5dd5023000, 
    schema_name_ptr=..., table_name_ptr=..., engine_name_ptr=..., partition_name=0x0, se_private_id=0, ts_se_private_data=0x0, 
    tbl_se_private_data=0x0, table_stat_data=@0x7f5dfed73a08: 0, cached_time=@0x7f5dfed73a10: 0, 
    stype=dd::info_schema::enum_table_stats_type::TABLE_ROWS) at /git/MS-8.0.12_dbg/sql/dd/info_schema/table_stats.h:215
#19 0x0000563d04362168 in get_table_statistics (args=0x7f5dd530c908, arg_count=8, 
    stype=dd::info_schema::enum_table_stats_type::TABLE_ROWS, null_value=0x7f5dd530c8bb) at /git/MS-8.0.12_dbg/sql/item_func.cc:8054
#20 0x0000563d043622d2 in Item_func_internal_table_rows::val_int (this=0x7f5dd530c830) at /git/MS-8.0.12_dbg/sql/item_func.cc:8064
#21 0x0000563d042d0170 in Item::save_in_field_inner (this=0x7f5dd530c830, field=0x7f5dd52a20e0, no_conversions=true)
    at /git/MS-8.0.12_dbg/sql/item.cc:5955
#22 0x0000563d042cf7b0 in Item::save_in_field (this=0x7f5dd530c830, field=0x7f5dd52a20e0, no_conversions=true)
    at /git/MS-8.0.12_dbg/sql/item.cc:5840
#23 0x0000563d042d574e in Item_ref::save_in_field_inner (this=0x7f5dd5325388, to=0x7f5dd52a20e0, no_conversions=true)
    at /git/MS-8.0.12_dbg/sql/item.cc:7477
#24 0x0000563d042d61da in Item_view_ref::save_in_field_inner (this=0x7f5dd5325388, field=0x7f5dd52a20e0, no_conversions=true)
    at /git/MS-8.0.12_dbg/sql/item.cc:7691
#25 0x0000563d042cf7b0 in Item::save_in_field (this=0x7f5dd5325388, field=0x7f5dd52a20e0, no_conversions=true)
    at /git/MS-8.0.12_dbg/sql/item.cc:5840
#26 0x0000563d042deda3 in Item_ref::save_in_result_field (this=0x7f5dd5327f98, no_conversions=true)
    at /git/MS-8.0.12_dbg/sql/item.h:4470
#27 0x0000563d044cad6d in copy_funcs (param=0x7f5dd5364670, thd=0x7f5dd5023000, type=CFT_ALL)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:678
#28 0x0000563d044d616c in end_write (join=0x7f5dd5329390, qep_tab=0x7f5dd5362ce8, end_of_records=false)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:4880
#29 0x0000563d044da88b in QEP_tmp_table::put_record (this=0x7f5dd5364f00, end_of_records=false)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:6241

How to repeat:
CREATE DATABASE test;
USE test;
CREATE TABLE t (a INT GENERATED ALWAYS AS(1) VIRTUAL,KEY(a)) ENGINE=INNODB;#NOERROR
CREATE TABLE tp (a INT, KEY (a))PARTITION BY RANGE (a) (PARTITION pCrashed VALUES LESS THAN (15), PARTITION pMAX VALUES LESS THAN MAXVALUE);#NOERROR
ALTER TABLE tp EXCHANGE PARTITION pCrashed WITH TABLE t;#NOERROR
show table status; ;
SELECT 1;
[20 Aug 2018 2:38] Roel Van de Paar
Rest of stack

#30 0x0000563d044db7c1 in QEP_tmp_table::put_record (this=0x7f5dd5364f00) at /git/MS-8.0.12_dbg/sql/sql_executor.h:267
#31 0x0000563d044cc9bf in sub_select_op (join=0x7f5dd5329390, qep_tab=0x7f5dd5362ce8, end_of_records=false)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1293
#32 0x0000563d044cdcc8 in evaluate_join_record (join=0x7f5dd5329390, qep_tab=0x7f5dd5362b70)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1853
#33 0x0000563d044cd00e in sub_select (join=0x7f5dd5329390, qep_tab=0x7f5dd5362b70, end_of_records=false)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1546
#34 0x0000563d044cdcc8 in evaluate_join_record (join=0x7f5dd5329390, qep_tab=0x7f5dd53629f8)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1853
#35 0x0000563d044ce29d in evaluate_null_complemented_join_record (join=0x7f5dd5329390, qep_tab=0x7f5dd53629f8)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1978
#36 0x0000563d044cd06b in sub_select (join=0x7f5dd5329390, qep_tab=0x7f5dd53629f8, end_of_records=false)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1552
#37 0x0000563d044cdcc8 in evaluate_join_record (join=0x7f5dd5329390, qep_tab=0x7f5dd5362880)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1853
#38 0x0000563d044ce29d in evaluate_null_complemented_join_record (join=0x7f5dd5329390, qep_tab=0x7f5dd5362880)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1978
#39 0x0000563d044cd06b in sub_select (join=0x7f5dd5329390, qep_tab=0x7f5dd5362880, end_of_records=false)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1552
#40 0x0000563d044cdcc8 in evaluate_join_record (join=0x7f5dd5329390, qep_tab=0x7f5dd5362708)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1853
#41 0x0000563d044cd00e in sub_select (join=0x7f5dd5329390, qep_tab=0x7f5dd5362708, end_of_records=false)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1546
#42 0x0000563d044cdcc8 in evaluate_join_record (join=0x7f5dd5329390, qep_tab=0x7f5dd5362590)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1853
#43 0x0000563d044cd00e in sub_select (join=0x7f5dd5329390, qep_tab=0x7f5dd5362590, end_of_records=false)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1546
#44 0x0000563d044cdcc8 in evaluate_join_record (join=0x7f5dd5329390, qep_tab=0x7f5dd5362418)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1853
#45 0x0000563d044cd00e in sub_select (join=0x7f5dd5329390, qep_tab=0x7f5dd5362418, end_of_records=false)
    at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1546
#46 0x0000563d044cc515 in do_select (join=0x7f5dd5329390) at /git/MS-8.0.12_dbg/sql/sql_executor.cc:1171
#47 0x0000563d044c9621 in JOIN::exec (this=0x7f5dd5329390) at /git/MS-8.0.12_dbg/sql/sql_executor.cc:294
#48 0x0000563d03f954a2 in handle_query (thd=0x7f5dd5023000, lex=0x7f5dd5028800, result=0x7f5dd5322368, added_options=0, 
    removed_options=0) at /git/MS-8.0.12_dbg/sql/sql_select.cc:199
#49 0x0000563d03f3a153 in execute_show (thd=0x7f5dd5023000, all_tables=0x7f5dd52839c0) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4612
#50 0x0000563d03f342c0 in mysql_execute_command (thd=0x7f5dd5023000, first_level=true) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:2817
#51 0x0000563d03f3af94 in mysql_parse (thd=0x7f5dd5023000, parser_state=0x7f5dfed76330) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4925
#52 0x0000563d03f30aeb in dispatch_command (thd=0x7f5dd5023000, com_data=0x7f5dfed76c90, command=COM_QUERY)
    at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1607
#53 0x0000563d03f2f3c6 in do_command (thd=0x7f5dd5023000) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1232
#54 0x0000563d040cf678 in handle_connection (arg=0x7f5dec7904c0)
    at /git/MS-8.0.12_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#55 0x0000563d05a3e422 in pfs_spawn_thread (arg=0x7f5df27e7720) at /git/MS-8.0.12_dbg/storage/perfschema/pfs.cc:2836
#56 0x00007f5e007a46db in start_thread (arg=0x7f5dfed77700) at pthread_create.c:463
#57 0x00007f5dfee9988f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
[20 Aug 2018 5:34] Umesh Shastry
Hello Roel,

Thank you for the report and test case.
Observed that 8.0.12 debug build is affected.

regards,
Umesh
[20 Aug 2018 5:38] Umesh Shastry
-- 5.7.23 debug build affected