[MDEV-19027] create_table_def fails when virtual column is present between stored columns Created: 2019-03-22  Updated: 2019-05-27  Resolved: 2019-05-27

Status: Closed
Project: MariaDB Server
Component/s: Partitioning, Storage Engine - InnoDB
Affects Version/s: 10.2, 10.3, 10.4
Fix Version/s: 10.2.25, 10.3.16, 10.4.6

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Thirunarayanan Balathandayuthapani
Resolution: Fixed Votes: 0
Labels: affects-tests

Issue Links:
Blocks
blocks MDEV-14046 Allow ALGORITHM=INPLACE for 10.1 tabl... Closed
Relates
relates to MDEV-19066 AddressSanitizer: use-after-poison in... Closed
relates to MDEV-19085 Assertion failures in dtuple_get_nth_... Closed

 Description   

10.3 f4484dfd

mysqld: /data/src/10.3/storage/innobase/dict/dict0dict.cc:1230: void dict_table_add_system_columns(dict_table_t*, mem_heap_t*): Assertion `table->n_def == (table->n_cols - 3)' failed.
190323  0:45:20 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fb611a91ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x0000561bae4df885 in dict_table_add_system_columns (table=0x7fb5a0036358, heap=0x7fb5a0032c00) at /data/src/10.3/storage/innobase/dict/dict0dict.cc:1230
#9  0x0000561bae220835 in create_table_info_t::create_table_def (this=0x7fb61025fc40) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:11120
#10 0x0000561bae20cdd3 in create_table_info_t::create_table (this=0x7fb61025fc40, create_fk=false) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:12346
#11 0x0000561bae2214de in ha_innobase::create (this=0x7fb5a00255f8, name=0x7fb5a0031610 "test/tp016#P#p0", form=0x7fb5a0024150, create_info=0x7fb610260160, file_per_table=true, trx=0x7fb5fc1862a0) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:12664
#12 0x0000561bae20e857 in ha_innobase::truncate (this=0x7fb5a00255f8) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:13336
#13 0x0000561badee975f in handler::ha_truncate (this=0x7fb5a00255f8) at /data/src/10.3/sql/handler.cc:4388
#14 0x0000561bae64448f in ha_partition::truncate (this=0x7fb5a0024d98) at /data/src/10.3/sql/ha_partition.cc:4609
#15 0x0000561badee975f in handler::ha_truncate (this=0x7fb5a0024d98) at /data/src/10.3/sql/handler.cc:4388
#16 0x0000561bae0b3ce8 in Sql_cmd_truncate_table::handler_truncate (this=0x7fb5a0014088, thd=0x7fb5a0000b00, table_ref=0x7fb5a0013a38, is_tmp_table=false) at /data/src/10.3/sql/sql_truncate.cc:242
#17 0x0000561bae0b43ef in Sql_cmd_truncate_table::truncate_table (this=0x7fb5a0014088, thd=0x7fb5a0000b00, table_ref=0x7fb5a0013a38) at /data/src/10.3/sql/sql_truncate.cc:448
#18 0x0000561bae0b4574 in Sql_cmd_truncate_table::execute (this=0x7fb5a0014088, thd=0x7fb5a0000b00) at /data/src/10.3/sql/sql_truncate.cc:504
#19 0x0000561badbed6fb in mysql_execute_command (thd=0x7fb5a0000b00) at /data/src/10.3/sql/sql_parse.cc:6284
#20 0x0000561badbf27ac in mysql_parse (thd=0x7fb5a0000b00, rawbuf=0x7fb5a0013960 "TRUNCATE TABLE tp016", length=20, parser_state=0x7fb610261640, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8091
#21 0x0000561badbdfa60 in dispatch_command (command=COM_QUERY, thd=0x7fb5a0000b00, packet=0x7fb5a001ba41 "TRUNCATE TABLE tp016", packet_length=20, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1857
#22 0x0000561badbde44a in do_command (thd=0x7fb5a0000b00) at /data/src/10.3/sql/sql_parse.cc:1403
#23 0x0000561badd46f41 in do_handle_one_connection (connect=0x561bb2fb2eb0) at /data/src/10.3/sql/sql_connect.cc:1402
#24 0x0000561badd46cc5 in handle_one_connection (arg=0x561bb2fb2eb0) at /data/src/10.3/sql/sql_connect.cc:1308
#25 0x00007fb613980494 in start_thread (arg=0x7fb610262700) at pthread_create.c:333
#26 0x00007fb611b4e93f in clone () from /lib/x86_64-linux-gnu/libc.so.6

To reproduce:

  • download ftp://perro.askmonty.org/public/jira/mdev19027-data.tar.gz
  • unpack (it unpacks the datadir data)
  • start the new server on the datadir with

    --innodb-page-size=4K --innodb-compression-algorithm=zlib
    

  • [optionally, doesn't make a difference] run mysql_upgrade, restart
  • run

    mysql -uroot test -e "TRUNCATE TABLE tp016"
    

Non-debug build fails with SIGSEGV:

10.2 1caec9c8

#2  <signal handler called>
#3  0x00007f2943a2e560 in std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x000055f08f671523 in _M_insert (__x=<synthetic pointer>, __position=..., this=0x6170733a203d2045) at /usr/include/c++/4.9/bits/stl_list.h:1681
#5  push_back (__x=<synthetic pointer>, this=0x6170733a203d2045) at /usr/include/c++/4.9/bits/stl_list.h:1029
#6  dict_index_add_col (index=index@entry=0x7f28d4026900, table=table@entry=0x7f28d4028ff0, col=0x7f28d4024648, prefix_len=prefix_len@entry=0) at /data/src/10.2/storage/innobase/dict/dict0dict.cc:2740
#7  0x000055f08f671fa9 in dict_index_build_internal_clust (index=0x7f28d4029390, table=0x7f28d4028ff0) at /data/src/10.2/storage/innobase/dict/dict0dict.cc:3033
#8  dict_index_add_to_cache_w_vcol (table=0x7f28d4028ff0, index=0x7f28d4029390, add_v=<optimized out>, page_no=page_no@entry=4294967295, strict=<optimized out>) at /data/src/10.2/storage/innobase/dict/dict0dict.cc:2431
#9  0x000055f08f664357 in dict_create_index_step (thr=thr@entry=0x7f28d4025cf0) at /data/src/10.2/storage/innobase/dict/dict0crea.cc:1481
#10 0x000055f08f542f9a in que_thr_step (thr=0x7f28d4025cf0) at /data/src/10.2/storage/innobase/que/que0que.cc:1055
#11 que_run_threads_low (thr=0x7f28d4025cf0) at /data/src/10.2/storage/innobase/que/que0que.cc:1107
#12 que_run_threads (thr=thr@entry=0x7f28d4025cf0) at /data/src/10.2/storage/innobase/que/que0que.cc:1147
#13 0x000055f08f5717c1 in row_create_index_for_mysql (index=index@entry=0x7f28d4029390, trx=trx@entry=0x7f292d8a6198, field_lengths=field_lengths@entry=0x7f28d4025788) at /data/src/10.2/storage/innobase/row/row0mysql.cc:2448
#14 0x000055f08f4c3c5c in create_index (key_num=<optimized out>, table_name=<optimized out>, flags=<optimized out>, form=<optimized out>, trx=<optimized out>) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:11481
#15 create_table_info_t::create_table (this=this@entry=0x7f29401ad240, create_fk=create_fk@entry=false) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:12608
#16 0x000055f08f4c45f1 in create (trx=0x7f292d8a6198, file_per_table=<optimized out>, create_info=0x7f29401ad2a0, form=<optimized out>, name=0x7f28d4023f78 "test/tp016#P#p0", this=0x7f28d401b790) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:12920
#17 ha_innobase::truncate (this=0x7f28d401b790) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:13607
#18 0x000055f08f757a71 in ha_partition::truncate (this=<optimized out>) at /data/src/10.2/sql/ha_partition.cc:4494
#19 0x000055f08f3e38d9 in Sql_cmd_truncate_table::handler_truncate (this=<optimized out>, thd=0x7f28d40009a8, table_ref=0x7f28d400f220, is_tmp_table=<optimized out>) at /data/src/10.2/sql/sql_truncate.cc:245
#20 0x000055f08f3e4000 in Sql_cmd_truncate_table::truncate_table (this=this@entry=0x7f28d400f838, thd=thd@entry=0x7f28d40009a8, table_ref=table_ref@entry=0x7f28d400f220) at /data/src/10.2/sql/sql_truncate.cc:442
#21 0x000055f08f3e4096 in Sql_cmd_truncate_table::execute (this=0x7f28d400f838, thd=0x7f28d40009a8) at /data/src/10.2/sql/sql_truncate.cc:499
#22 0x000055f08f101466 in mysql_execute_command (thd=0x7f28d40009a8) at /data/src/10.2/sql/sql_parse.cc:6224
#23 0x000055f08f106519 in mysql_parse (thd=0x7f28d40009a8, rawbuf=<optimized out>, length=20, parser_state=0x7f29401af260, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.2/sql/sql_parse.cc:8011
#24 0x000055f08f1091f1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f28d40009a8, packet=packet@entry=0x7f28d4006cf9 "TRUNCATE TABLE tp016", packet_length=packet_length@entry=20, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.2/sql/sql_parse.cc:1832
#25 0x000055f08f109a38 in do_command (thd=0x7f28d40009a8) at /data/src/10.2/sql/sql_parse.cc:1386
#26 0x000055f08f1d4794 in do_handle_one_connection (connect=connect@entry=0x55f0928eec08) at /data/src/10.2/sql/sql_connect.cc:1335
#27 0x000055f08f1d4934 in handle_one_connection (arg=0x55f0928eec08) at /data/src/10.2/sql/sql_connect.cc:1241
#28 0x00007f2944ff0494 in start_thread (arg=0x7f29401b0700) at pthread_create.c:333
#29 0x00007f29431be93f in clone () from /lib/x86_64-linux-gnu/libc.so.6



 Comments   
Comment by Marko Mäkelä [ 2019-04-01 ]

Similar to MDEV-19066, the table does not appear to define any virtual columns, and I cannot repeat this one on 10.2 f055da9b84bc9481917003a1ed0a702072c0f452 (MDEV-19085). Maybe something was recently fixed in ha_partition?

Note: because the table does not define any virtual columns, the recently fixed InnoDB 10.2+ bugs related to 10.1 virtual columns should be unrelated to this failure.

Comment by Elena Stepanova [ 2019-04-01 ]

Same reason as in MDEV-19066, my apologies. There might be a few more bug reports like that, but in new ones I will be adding permanent bug-specific links. Here is one for this ticket:
ftp://perro.askmonty.org/public/jira/mdev19027-data.tar.gz
(I'm also updating it in the description).

Comment by Elena Stepanova [ 2019-04-07 ]

Same happens upon upgrade from 5.5, only it has now lost brackets somehow:

10.3 cc492bfd

mysqld: /home/buildbot/buildbot/build/mariadb-10.3.15/storage/innobase/dict/dict0dict.cc:1226: void dict_table_add_system_columns(dict_table_t*, mem_heap_t*): Assertion `table->n_def == table->n_cols - 3' failed.
190407 17:32:25 [ERROR] mysqld got signal 6 ;

Comment by Marko Mäkelä [ 2019-05-27 ]

thiru, can you please analyze this? The new TRUNCATE in 10.2.19 is creating the table anew based on the .frm file contents. Apparently the .frm file must contain something funny in this case.

Generated at Thu Feb 08 08:48:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.