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

SELECT from table with indexed virtual column and certain charset causes Assertion `templ->mbmaxlen > templ->mbminlen || templ->mysql_col_len == len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0)' failure

    XMLWordPrintable

    Details

      Description

      The difference with MDEV-22395 is that older versions are also affected, and virtual columns are used.
      Setting to minor because it seems to only affect debug builds and involves indexed virtual columns and a non-common character set (although quite possibly there are other charsets that can be used instead).

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (pk INT, i INT, a CHAR(8), va CHAR(8) AS (a) VIRTUAL, PRIMARY KEY(pk), KEY(va(4),i)) ENGINE=InnoDB CHARACTER SET macce;
      INSERT INTO t1 (pk,a) VALUES (1,'foo'),(2,'bar');
      SELECT i FROM t1;
       
      # Cleanup
      DROP TABLE t1;
      

      10.2 3edad542

      mysqld: /data/src/10.2/storage/innobase/row/row0sel.cc:2914: 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->mbmaxlen > templ->mbminlen || templ->mysql_col_len == len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0)' failed.
      210128 18:01:03 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fdc509e6f36 in __GI___assert_fail (assertion=0x564e91a2e198 "templ->mbmaxlen > templ->mbminlen || templ->mysql_col_len == len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0)", file=0x564e91a2d250 "/data/src/10.2/storage/innobase/row/row0sel.cc", line=2914, function=0x564e91a2e070 "void row_sel_field_store_in_mysql_format_func(byte*, const mysql_row_templ_t*, const dict_index_t*, ulint, const byte*, ulint)") at assert.c:101
      #8  0x0000564e91413c39 in row_sel_field_store_in_mysql_format_func (dest=0x7fdbf8035331 "bar     ", '\245' <repeats 39 times>, "\210S\003\370\333\177", templ=0x7fdbf8148230, index=0x7fdbf80366e0, field_no=0, data=0x7fdc4b62008c "bar \200", len=4) at /data/src/10.2/storage/innobase/row/row0sel.cc:2914
      #9  0x0000564e91414860 in row_sel_store_mysql_rec (mysql_rec=0x7fdbf8035320 "\377\002", prebuilt=0x7fdbf8038490, rec=0x7fdc4b61c09d "\200", vrow=0x7fdbf8008110, rec_clust=true, index=0x7fdbf80366e0, offsets=0x7fdc4ae4b7c0) at /data/src/10.2/storage/innobase/row/row0sel.cc:3217
      #10 0x0000564e91419ed9 in row_search_mvcc (buf=0x7fdbf8035320 "\377\002", mode=PAGE_CUR_G, prebuilt=0x7fdbf8038490, match_mode=0, direction=0) at /data/src/10.2/storage/innobase/row/row0sel.cc:5623
      #11 0x0000564e912a664f in ha_innobase::index_read (this=0x7fdbf80ab288, buf=0x7fdbf8035320 "\377\002", key_ptr=0x0, key_len=0, find_flag=HA_READ_AFTER_KEY) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:9392
      #12 0x0000564e912a75f4 in ha_innobase::index_first (this=0x7fdbf80ab288, buf=0x7fdbf8035320 "\377\002") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:9769
      #13 0x0000564e9109df61 in handler::ha_index_first (this=0x7fdbf80ab288, buf=0x7fdbf8035320 "\377\002") at /data/src/10.2/sql/handler.cc:2809
      #14 0x0000564e90e877a1 in join_read_first (tab=0x7fdbf8014128) at /data/src/10.2/sql/sql_select.cc:19847
      #15 0x0000564e90e8516e in sub_select (join=0x7fdbf8012fe0, join_tab=0x7fdbf8014128, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:18855
      #16 0x0000564e90e84732 in do_select (join=0x7fdbf8012fe0, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:18402
      #17 0x0000564e90e5e3a9 in JOIN::exec_inner (this=0x7fdbf8012fe0) at /data/src/10.2/sql/sql_select.cc:3641
      #18 0x0000564e90e5d850 in JOIN::exec (this=0x7fdbf8012fe0) at /data/src/10.2/sql/sql_select.cc:3436
      #19 0x0000564e90e5ea12 in mysql_select (thd=0x7fdbf8000d90, tables=0x7fdbf80128d8, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fdbf8012fc0, unit=0x7fdbf8004988, select_lex=0x7fdbf80050c8) at /data/src/10.2/sql/sql_select.cc:3836
      #20 0x0000564e90e52b8c in handle_select (thd=0x7fdbf8000d90, lex=0x7fdbf80048c8, result=0x7fdbf8012fc0, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:361
      #21 0x0000564e90e1d296 in execute_sqlcom_select (thd=0x7fdbf8000d90, all_tables=0x7fdbf80128d8) at /data/src/10.2/sql/sql_parse.cc:6248
      #22 0x0000564e90e13c45 in mysql_execute_command (thd=0x7fdbf8000d90) at /data/src/10.2/sql/sql_parse.cc:3559
      #23 0x0000564e90e2103f in mysql_parse (thd=0x7fdbf8000d90, rawbuf=0x7fdbf80126f8 "SELECT i FROM t1", length=16, parser_state=0x7fdc4ae4d5f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7763
      #24 0x0000564e90e0f318 in dispatch_command (command=COM_QUERY, thd=0x7fdbf8000d90, packet=0x7fdbf8008b51 "", packet_length=16, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
      #25 0x0000564e90e0de13 in do_command (thd=0x7fdbf8000d90) at /data/src/10.2/sql/sql_parse.cc:1381
      #26 0x0000564e90f6872e in do_handle_one_connection (connect=0x564e93093220) at /data/src/10.2/sql/sql_connect.cc:1336
      #27 0x0000564e90f68493 in handle_one_connection (arg=0x564e93093220) at /data/src/10.2/sql/sql_connect.cc:1241
      #28 0x0000564e917909fa in pfs_spawn_thread (arg=0x564e930763a0) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #29 0x00007fdc50ef6609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #30 0x00007fdc50ad2293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible on 10.2-10.6.
      No obvious immediate problem on a non-debug build.
      No obvious problem with MyISAM and otherwise the same test case.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated: