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

Assertion `0' failed in row_sel_convert_mysql_key_to_innobase, [Warning] InnoDB: Using a partial-field key prefix in search

    XMLWordPrintable

Details

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (
          pk INT,
          a INT,
          b VARCHAR(1),
          PRIMARY KEY (pk),
          KEY (b,a)
      ) ENGINE=InnoDB;
       
      INSERT INTO t1 VALUES (1,1,'a'),(2,2,'b'); # Optional, fails either way
       
      SELECT a FROM t1
      WHERE pk < 0 AND b <= 'w'
      GROUP BY a HAVING a > 0;
      

      10.4 e35676f5 debug

      2019-05-29 16:42:12 9 [Warning] InnoDB: Using a partial-field key prefix in search, index `b` of table `test`.`t1`. Last data field length 5 bytes, key ptr now exceeds key end by 1 bytes. Key value in the MySQL format:
       len 8; hex 0001007700000000; asc    w    ;
      mysqld: /data/src/10.4/storage/innobase/row/row0sel.cc:2681: void row_sel_convert_mysql_key_to_innobase(dtuple_t*, byte*, ulint, dict_index_t*, const byte*, ulint): Assertion `0' failed.
      190529 16:42:12 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fb1d5249f12 in __GI___assert_fail (assertion=0x555fe3206173 "0", file=0x555fe3205e00 "/data/src/10.4/storage/innobase/row/row0sel.cc", line=2681, function=0x555fe3209920 <row_sel_convert_mysql_key_to_innobase(dtuple_t*, unsigned char*, unsigned long, dict_index_t*, unsigned char const*, unsigned long)::__PRETTY_FUNCTION__> "void row_sel_convert_mysql_key_to_innobase(dtuple_t*, byte*, ulint, dict_index_t*, const byte*, ulint)") at assert.c:101
      #8  0x0000555fe2a93621 in row_sel_convert_mysql_key_to_innobase (tuple=0x7fb184069048, buf=0x7fb18414eccc "\245\245\245\245", buf_len=8, index=0x7fb1841a1da8, key_ptr=0x7fb184067ff9 "\245\245\245\245\245\217\217\003", key_len=8) at /data/src/10.4/storage/innobase/row/row0sel.cc:2681
      #9  0x0000555fe28fd78b in ha_innobase::records_in_range (this=0x7fb18400b628, keynr=1, min_key=0x7fb1ca60a6e0, max_key=0x7fb1ca60a700) at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:13551
      #10 0x0000555fe254c56d in handler::multi_range_read_info_const (this=0x7fb18400b628, keyno=1, seq=0x7fb1ca60a900, seq_init_param=0x7fb1ca60a930, n_ranges_arg=0, bufsz=0x7fb1ca60a804, flags=0x7fb1ca60a800, cost=0x7fb1ca60afb0) at /data/src/10.4/sql/multi_range_read.cc:159
      #11 0x0000555fe254ff8e in DsMrr_impl::dsmrr_info_const (this=0x7fb18400ba88, keyno=1, seq=0x7fb1ca60a900, seq_init_param=0x7fb1ca60a930, n_ranges=0, bufsz=0x7fb1ca60aec8, flags=0x7fb1ca60aec4, cost=0x7fb1ca60afb0) at /data/src/10.4/sql/multi_range_read.cc:1579
      #12 0x0000555fe2907d76 in ha_innobase::multi_range_read_info_const (this=0x7fb18400b628, keyno=1, seq=0x7fb1ca60a900, seq_init_param=0x7fb1ca60a930, n_ranges=0, bufsz=0x7fb1ca60aec8, flags=0x7fb1ca60aec4, cost=0x7fb1ca60afb0) at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:20260
      #13 0x0000555fe28400e2 in check_quick_select (param=0x7fb1ca60b220, idx=1, index_only=true, tree=0x7fb1840681f8, update_tbl_stats=true, mrr_flags=0x7fb1ca60aec4, bufsize=0x7fb1ca60aec8, cost=0x7fb1ca60afb0, is_ror_scan=0x7fb1ca60aec2) at /data/src/10.4/sql/opt_range.cc:11062
      #14 0x0000555fe2836ba4 in get_key_scans_params (param=0x7fb1ca60b220, tree=0x7fb184068000, index_read_must_be_used=false, update_tbl_stats=true, read_time=1.1003173634421728) at /data/src/10.4/sql/opt_range.cc:7365
      #15 0x0000555fe282b921 in SQL_SELECT::test_quick_select (this=0x7fb184017318, thd=0x7fb184000b00, keys_to_use=..., prev_tables=0, limit=18446744073709551615, force_quick_range=false, ordered_output=false, remove_false_parts_of_where=true, only_single_index_range_scan=false) at /data/src/10.4/sql/opt_range.cc:2895
      #16 0x0000555fe23d8ed9 in get_quick_record_count (thd=0x7fb184000b00, select=0x7fb184017318, table=0x7fb18414dc90, keys=0x7fb1840161a8, limit=18446744073709551615) at /data/src/10.4/sql/sql_select.cc:4648
      #17 0x0000555fe23db6c7 in make_join_statistics (join=0x7fb1840155b8, tables_list=..., keyuse_array=0x7fb1840158a8) at /data/src/10.4/sql/sql_select.cc:5370
      #18 0x0000555fe23d013c in JOIN::optimize_inner (this=0x7fb1840155b8) at /data/src/10.4/sql/sql_select.cc:2192
      #19 0x0000555fe23cddac in JOIN::optimize (this=0x7fb1840155b8) at /data/src/10.4/sql/sql_select.cc:1562
      #20 0x0000555fe23d8ba2 in mysql_select (thd=0x7fb184000b00, tables=0x7fb1840137c0, wild_num=0, fields=..., conds=0x7fb184014650, og_num=1, order=0x0, group=0x7fb1840148a0, having=0x7fb184014a98, proc_param=0x0, select_options=2147748608, result=0x7fb184015590, unit=0x7fb184004a28, select_lex=0x7fb1840131f8) at /data/src/10.4/sql/sql_select.cc:4590
      #21 0x0000555fe23c922a in handle_select (thd=0x7fb184000b00, lex=0x7fb184004960, result=0x7fb184015590, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:424
      #22 0x0000555fe2392bd2 in execute_sqlcom_select (thd=0x7fb184000b00, all_tables=0x7fb1840137c0) at /data/src/10.4/sql/sql_parse.cc:6605
      #23 0x0000555fe2387e4c in mysql_execute_command (thd=0x7fb184000b00) at /data/src/10.4/sql/sql_parse.cc:3884
      #24 0x0000555fe2396967 in mysql_parse (thd=0x7fb184000b00, rawbuf=0x7fb184013108 "SELECT a FROM t1\nWHERE pk < 0 AND b <= 'w'\nGROUP BY a HAVING a > 0", length=66, parser_state=0x7fb1ca60d180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8157
      #25 0x0000555fe2382043 in dispatch_command (command=COM_QUERY, thd=0x7fb184000b00, packet=0x7fb184137cc1 "SELECT a FROM t1\nWHERE pk < 0 AND b <= 'w'\nGROUP BY a HAVING a > 0", packet_length=66, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1829
      #26 0x0000555fe2380801 in do_command (thd=0x7fb184000b00) at /data/src/10.4/sql/sql_parse.cc:1362
      #27 0x0000555fe24f87d1 in do_handle_one_connection (connect=0x555fe5485db0) at /data/src/10.4/sql/sql_connect.cc:1403
      #28 0x0000555fe24f8535 in handle_one_connection (arg=0x555fe5485db0) at /data/src/10.4/sql/sql_connect.cc:1306
      #29 0x0000555fe2e214cb in pfs_spawn_thread (arg=0x555fe5404740) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #30 0x00007fb1d6dbe4a4 in start_thread (arg=0x7fb1ca60e700) at pthread_create.c:456
      #31 0x00007fb1d5306d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Non-debug doesn't crash, but the warnings are still there:

      10.4 e35676f5 non-debug

      2019-05-29 16:41:05 9 [Warning] InnoDB: Using a partial-field key prefix in search, index `b` of table `test`.`t1`. Last data field length 5 bytes, key ptr now exceeds key end by 1 bytes. Key value in the MySQL format:
      2019-05-29 16:41:05 9 [Warning] InnoDB: Using a partial-field key prefix in search, index `b` of table `test`.`t1`. Last data field length 5 bytes, key ptr now exceeds key end by 1 bytes. Key value in the MySQL format:
      

      The problem appeared in 10.4 tree with this revision:

      commit 5e36f5dd00d706baea7af623f09711d66ba0109c 24773bf38024d32c9af4e6bc09e67043318bba6e
      Author:     Varun Gupta
      AuthorDate: Tue May 28 15:43:12 2019 +0530
       
          MDEV-18741: Optimizer trace: multi-part key ranges are printed incorrectly
          
          Changed the function append_range_all_keyparts to use sel_arg_range_seq_init / sel_arg_range_seq_next to produce ranges.
          Also adjusted to print format for the ranges, now the ranges are printed as:
              (keypart1_min, keypart2_min,..)  OP (keypart1_name,keypart2_name, ..) OP (keypart1_max,keypart2_max, ..)
          
          Also added more tests for range and index merge access for optimizer trace
      

      Attachments

        Issue Links

          Activity

            People

              varun Varun Gupta (Inactive)
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.