Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-18911

Assertion `(templ->is_virtual && !field) || (field && field->prefix_len ? field->prefix_len == len : templ->mysql_col_len == len)' failed row_sel_field_store_in_mysql_format_func

Details

    Description

      Note: I'm filing it for 10.4 because it's the only version I can reproduce it with; but the failure depends on the execution plan. I can get rid of the failure by setting rowid_filter=off in optimizer_switch on 10.4, but I can't do the reverse on 10.3, so I have no information whether the problem exists in previous version.

      Note: Run with --repeat=N. The test case appears deterministic, but the failure is still sporadic. It usually fails for me withing first 1-2 attempts, but it can vary on different machines and builds.

      --source include/have_innodb.inc
       
      SET @stats.save= @@innodb_stats_persistent;
      SET GLOBAL innodb_stats_persistent= ON;
       
      CREATE TABLE t1 ( 
        a CHAR(100),
        pk INTEGER AUTO_INCREMENT,
        b BIT(8),
        c CHAR(115) AS (a) VIRTUAL,
        PRIMARY KEY(pk),
        KEY(c),
        KEY(b)
      ) ENGINE=InnoDB;
      INSERT INTO t1 (a,b) VALUES ('foo',b'0'),('',NULL),(NULL,b'1');
       
      CREATE TABLE t2 (f CHAR(100)) ENGINE=InnoDB;
       
      SELECT t1a.* FROM t1 AS t1a JOIN t1 AS t1b LEFT JOIN t2  ON (f = t1b.a) WHERE t1a.b >= 0 AND t1a.c = t1b.a;
       
      # Cleanup
      DROP TABLE t1, t2;
      SET GLOBAL innodb_stats_persistent= @stats.save;
      

      10.4 6d68a346

      mysqld: /data/src/10.4/storage/innobase/row/row0sel.cc:2854: void row_sel_field_store_in_mysql_format_func(byte*, const mysql_row_templ_t*, const dict_index_t*, ulint, const byte*, ulint): Assertion `(templ->is_virtual && !field) || (field && field->prefix_len ? field->prefix_len == len : templ->mysql_col_len == len)' failed.
      190313 15:11:45 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fb2b35aeee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000564f5f0195f8 in row_sel_field_store_in_mysql_format_func (dest=0x7fb2641a1241 ' ' <repeats 100 times>, "\003", templ=0x7fb26406cac0, index=0x7fb26414feb8, field_no=1, data=0x7fb2ad0a40f1 "\200", len=4) at /data/src/10.4/storage/innobase/row/row0sel.cc:2851
      #9  0x0000564f5f019d14 in row_sel_store_mysql_field (mysql_rec=0x7fb2641a1240 "\373", ' ' <repeats 100 times>, "\003", prebuilt=0x7fb264152508, rec=0x7fb2ad0a407e "foo", ' ' <repeats 112 times>, "\200", index=0x7fb26414feb8, offsets=0x7fb2ac8d5220, field_no=1, templ=0x7fb26406cac0) at /data/src/10.4/storage/innobase/row/row0sel.cc:3006
      #10 0x0000564f5f01bdab in row_search_idx_cond_check (mysql_rec=0x7fb2641a1240 "\373", ' ' <repeats 100 times>, "\003", prebuilt=0x7fb264152508, rec=0x7fb2ad0a407e "foo", ' ' <repeats 112 times>, "\200", offsets=0x7fb2ac8d5220) at /data/src/10.4/storage/innobase/row/row0sel.cc:3888
      #11 0x0000564f5f01f6a9 in row_search_mvcc (buf=0x7fb2641a1240 "\373", ' ' <repeats 100 times>, "\003", mode=PAGE_CUR_GE, prebuilt=0x7fb264152508, match_mode=1, direction=0) at /data/src/10.4/storage/innobase/row/row0sel.cc:5205
      #12 0x0000564f5ee7d7f1 in ha_innobase::index_read (this=0x7fb264151518, buf=0x7fb2641a1240 "\373", ' ' <repeats 100 times>, "\003", key_ptr=0x7fb26407ca70 "", key_len=116, find_flag=HA_READ_KEY_EXACT) at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:9360
      #13 0x0000564f5eb4b404 in handler::index_read_map (this=0x7fb264151518, buf=0x7fb2641a1240 "\373", ' ' <repeats 100 times>, "\003", key=0x7fb26407ca70 "", keypart_map=1, find_flag=HA_READ_KEY_EXACT) at /data/src/10.4/sql/handler.h:3594
      #14 0x0000564f5eb3d2b7 in handler::ha_index_read_map (this=0x7fb264151518, buf=0x7fb2641a1240 "\373", ' ' <repeats 100 times>, "\003", key=0x7fb26407ca70 "", keypart_map=1, find_flag=HA_READ_KEY_EXACT) at /data/src/10.4/sql/handler.cc:3040
      #15 0x0000564f5e86d891 in join_read_always_key (tab=0x7fb26407bf18) at /data/src/10.4/sql/sql_select.cc:20776
      #16 0x0000564f5e86bd5d in sub_select (join=0x7fb264019718, join_tab=0x7fb26407bf18, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20015
      #17 0x0000564f5e86c4cb in evaluate_join_record (join=0x7fb264019718, join_tab=0x7fb26407bb50, error=0) at /data/src/10.4/sql/sql_select.cc:20238
      #18 0x0000564f5e86bdbf in sub_select (join=0x7fb264019718, join_tab=0x7fb26407bb50, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20018
      #19 0x0000564f5e86b2ed in do_select (join=0x7fb264019718, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19556
      #20 0x0000564f5e841da9 in JOIN::exec_inner (this=0x7fb264019718) at /data/src/10.4/sql/sql_select.cc:4371
      #21 0x0000564f5e840f50 in JOIN::exec (this=0x7fb264019718) at /data/src/10.4/sql/sql_select.cc:4153
      #22 0x0000564f5e842602 in mysql_select (thd=0x7fb264000b00, tables=0x7fb264015bd8, wild_num=1, fields=..., conds=0x7fb264018c60, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fb2640196f0, unit=0x7fb264004a28, select_lex=0x7fb264015608) at /data/src/10.4/sql/sql_select.cc:4585
      #23 0x0000564f5e832b7a in handle_select (thd=0x7fb264000b00, lex=0x7fb264004960, result=0x7fb2640196f0, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:424
      #24 0x0000564f5e7fbf4b in execute_sqlcom_select (thd=0x7fb264000b00, all_tables=0x7fb264015bd8) at /data/src/10.4/sql/sql_parse.cc:6651
      #25 0x0000564f5e7f1206 in mysql_execute_command (thd=0x7fb264000b00) at /data/src/10.4/sql/sql_parse.cc:3888
      #26 0x0000564f5e7ffe8b in mysql_parse (thd=0x7fb264000b00, rawbuf=0x7fb2640154c8 "SELECT t1a.* FROM t1 AS t1a JOIN t1 AS t1b LEFT JOIN t2  ON (f = t1b.a) WHERE t1a.b >= 0 AND t1a.c = t1b.a", length=106, parser_state=0x7fb2ac8d7180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8204
      #27 0x0000564f5e7eb4cd in dispatch_command (command=COM_QUERY, thd=0x7fb264000b00, packet=0x7fb264139ff1 "", packet_length=106, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1829
      #28 0x0000564f5e7e9cb3 in do_command (thd=0x7fb264000b00) at /data/src/10.4/sql/sql_parse.cc:1358
      #29 0x0000564f5e9639e5 in do_handle_one_connection (connect=0x564f61f954f0) at /data/src/10.4/sql/sql_connect.cc:1399
      #30 0x0000564f5e963756 in handle_one_connection (arg=0x564f61f954f0) at /data/src/10.4/sql/sql_connect.cc:1302
      #31 0x0000564f5ee59253 in pfs_spawn_thread (arg=0x564f61fdb360) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #32 0x00007fb2b5285494 in start_thread (arg=0x7fb2ac8d8700) at pthread_create.c:333
      #33 0x00007fb2b366b93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value
            Component/s Optimizer [ 10200 ]
            alice Alice Sherepa made changes -
            alice Alice Sherepa made changes -
            Affects Version/s 10.5 [ 23123 ]
            alice Alice Sherepa made changes -
            Fix Version/s 10.5 [ 23123 ]
            alice Alice Sherepa made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Nikita Malyavin [ nikitamalyavin ]
            alice Alice Sherepa made changes -
            alice Alice Sherepa made changes -
            Affects Version/s 10.6 [ 24028 ]
            alice Alice Sherepa made changes -
            Fix Version/s 10.6 [ 24028 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 93247 ] MariaDB v4 [ 144121 ]
            alice Alice Sherepa made changes -
            Affects Version/s 10.7 [ 24805 ]
            alice Alice Sherepa made changes -
            Fix Version/s 10.7 [ 24805 ]
            julien.fritsch Julien Fritsch made changes -
            Fix Version/s 10.7 [ 24805 ]
            Roel Roel Van de Paar made changes -
            Roel Roel Van de Paar made changes -
            Roel Roel Van de Paar made changes -
            alice Alice Sherepa made changes -
            alice Alice Sherepa made changes -
            Fix Version/s 10.11 [ 27614 ]
            alice Alice Sherepa made changes -
            Labels not-11.0+
            alice Alice Sherepa made changes -
            Affects Version/s 10.11 [ 27614 ]
            alice Alice Sherepa made changes -
            Comment [ {noformat}
            Version: '10.6.16-MariaDB-debug-log'
            mysqld: /d1/git/10.6/storage/innobase/row/row0sel.cc:2933: void row_sel_field_store_in_mysql_format_func(byte*, const mysql_row_templ_t*, const dict_index_t*, ulint, const byte*, ulint): Assertion `(templ->is_virtual && !field) || (field && field->prefix_len ? field->prefix_len == len : templ->mysql_col_len == len)' failed.
            231030 11:40:02 [ERROR] mysqld got signal 6 ;

            Server version: 10.6.16-MariaDB-debug-log source revision: ab6139ddc09b28df94016ac1e7345d623b08de8e

            linux/raise.c:51(__GI_raise)[0x7f11b9f968eb]
            stdlib/abort.c:81(__GI_abort)[0x7f11b9f81535]
            row/row0sel.cc:2937(row_sel_field_store_in_mysql_format_func(unsigned char*, mysql_row_templ_t const*, dict_index_t const*, unsigned long, unsigned char const*, unsigned long))[0x561074192755]
            row/row0sel.cc:3098(row_sel_store_mysql_field(unsigned char*, row_prebuilt_t*, unsigned char const*, dict_index_t const*, unsigned short const*, unsigned long, mysql_row_templ_t const*))[0x561074193ba8]
            row/row0sel.cc:4062(row_search_idx_cond_check(unsigned char*, row_prebuilt_t*, unsigned char const*, unsigned short const*))[0x5610741998b8]
            row/row0sel.cc:5469(row_search_mvcc(unsigned char*, page_cur_mode_t, row_prebuilt_t*, unsigned long, unsigned long))[0x5610741a2db8]
            handler/ha_innodb.cc:9120(ha_innobase::index_read(unsigned char*, unsigned char const*, unsigned int, ha_rkey_function))[0x561073d72b16]
            sql/handler.h:3952(handler::index_read_map(unsigned char*, unsigned char const*, unsigned long, ha_rkey_function))[0x5610730d0d8f]
            sql/handler.cc:3517(handler::ha_index_read_map(unsigned char*, unsigned char const*, unsigned long, ha_rkey_function))[0x56107328951c]
            sql/handler.cc:6663(handler::read_range_first(st_key_range const*, st_key_range const*, bool, bool))[0x5610732a47fc]
            sql/multi_range_read.cc:518(handler::multi_range_read_next(void**))[0x561072f3be10]
            sql/multi_range_read.cc:555(Mrr_simple_index_reader::get_next(void**))[0x561072f3c1e4]
            sql/multi_range_read.cc:1655(DsMrr_impl::dsmrr_next(void**))[0x561072f45bc3]
            handler/ha_innodb.cc:19969(ha_innobase::multi_range_read_next(void**))[0x561073da96e4]
            sql/opt_range.cc:12769(QUICK_RANGE_SELECT::get_next())[0x5610736a574f]
            sql/records.cc:403(rr_quick(READ_RECORD*))[0x5610736d9f2c]
            sql/records.h:81(READ_RECORD::read_record())[0x5610728428bc]
            sql/sql_select.cc:22811(join_init_read_record(st_join_table*))[0x561072b5c8bb]
            sql/sql_select.cc:21778(sub_select(JOIN*, st_join_table*, bool))[0x561072b5575b]
            sql/sql_select.cc:21306(do_select(JOIN*, Procedure*))[0x561072b53753]
            sql/sql_select.cc:4857(JOIN::exec_inner())[0x561072add8b6]
            sql/sql_select.cc:4636(JOIN::exec())[0x561072adae04]
            sql/sql_select.cc:5116(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x561072adf1cb]
            sql/sql_select.cc:561(handle_select(THD*, LEX*, select_result*, unsigned long))[0x561072aaee53]
            sql/sql_parse.cc:6285(execute_sqlcom_select(THD*, TABLE_LIST*))[0x561072a13931]
            sql/sql_parse.cc:3961(mysql_execute_command(THD*, bool))[0x561072a02270]
            sql/sql_parse.cc:8050(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x561072a1e7e2]
            sql/sql_parse.cc:1898(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x5610729f4b6c]
            sql/sql_parse.cc:1409(do_command(THD*, bool))[0x5610729f1862]
            sql/sql_connect.cc:1416(do_handle_one_connection(CONNECT*, bool))[0x561072e5d77c]
            sql/sql_connect.cc:1320(handle_one_connection)[0x561072e5d0d2]
            perfschema/pfs.cc:2203(pfs_spawn_thread)[0x561073b6f535]
            nptl/pthread_create.c:487(start_thread)[0x7f11ba44cfa3]

            Query (0x62b0002222a8): SELECT * FROM `t5_InnoDB` WHERE (`id` IS NULL OR `id` NOT IN (1, 255)) AND (`vcol_char` IS NULL OR `vcol_char` LIKE CONCAT ('help', '%')) AND (`col_int` NOT BETWEEN 8 AND 2 + 188 AND `vcol_int` BETWEEN 9 AND 3 + 255) AND (`col_char` LIKE CONCAT ('t', '%') OR `col_char` IS NULL)
            {noformat} ]
            serg Sergei Golubchik made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            alice Alice Sherepa made changes -
            alice Alice Sherepa made changes -
            Fix Version/s N/A [ 14700 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.11 [ 27614 ]
            Resolution Duplicate [ 3 ]
            Status Confirmed [ 10101 ] Closed [ 6 ]

            People

              nikitamalyavin Nikita Malyavin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.