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

Assertion `0' failed in row_sel_convert_mysql_key_to_innobase

    XMLWordPrintable

Details

    Description

      Looks similar to MDEV-21245, but this one is in newer versions only, and happens on SELECT. MyISAM not affected.

      CREATE TABLE t (a VARCHAR(255), KEY k(a)) DEFAULT CHARSET=utf8 ENGINE=InnoDB;
      ALTER TABLE t CHANGE a a VARCHAR(3000);
      SELECT * FROM t WHERE a in ('');
      

      Leads to:

      10.6.0 bfb4761ca04704d68dba51f76d7c9967f880a6ee (Debug)

      2021-02-17 19:32:01 4 [Warning] InnoDB: Using a partial-field key prefix in search, index `k` of table `test`.`t`. Last data field length 9003 bytes, key ptr now exceeds key end by 5928 bytes. Key value in the MySQL format:  len 3075; hex 00000000000000000000 ... lots of zeroes ... 00000000000000000000; asc 
      mysqld: /test/10.6_dbg/storage/innobase/row/row0sel.cc:2652: void row_sel_convert_mysql_key_to_innobase(dtuple_t*, byte*, ulint, dict_index_t*, const byte*, ulint): Assertion `0' failed.
      

      10.6.0 bfb4761ca04704d68dba51f76d7c9967f880a6ee (Debug)

      Core was generated by `/test/MD110221-mariadb-10.6.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      [Current thread is 1 (Thread 0x14ff480bd700 (LWP 3147504))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      #1  0x00005593a004755c in my_write_core (sig=sig@entry=6) at /test/10.6_dbg/mysys/stacktrace.c:424
      #2  0x000055939f7df4de in handle_fatal_signal (sig=6) at /test/10.6_dbg/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #5  0x000014ff50724859 in __GI_abort () at abort.c:79
      #6  0x000014ff50724729 in __assert_fail_base (fmt=0x14ff508ba588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5593a035eb16 "0", file=0x5593a0449580 "/test/10.6_dbg/storage/innobase/row/row0sel.cc", line=2652, function=<optimized out>) at assert.c:92
      #7  0x000014ff50735f36 in __GI___assert_fail (assertion=assertion@entry=0x5593a035eb16 "0", file=file@entry=0x5593a0449580 "/test/10.6_dbg/storage/innobase/row/row0sel.cc", line=line@entry=2652, function=function@entry=0x5593a044a3d8 "void row_sel_convert_mysql_key_to_innobase(dtuple_t*, byte*, ulint, dict_index_t*, const byte*, ulint)") at assert.c:101
      #8  0x000055939fda31e3 in row_sel_convert_mysql_key_to_innobase (tuple=tuple@entry=0x14fef4028f28, buf=0x0, buf_len=0, index=index@entry=0x14fef4022af8, key_ptr=<optimized out>, key_len=3075) at /test/10.6_dbg/storage/innobase/row/row0sel.cc:2652
      #9  0x000055939fbdf041 in ha_innobase::records_in_range (this=0x14fef4026420, keynr=<optimized out>, min_key=0x14ff480ba3e0, max_key=0x14ff480ba400, pages=0x14ff480ba3b0) at /test/10.6_dbg/storage/innobase/handler/ha_innodb.cc:13560
      #10 0x000055939f6c15b2 in handler::multi_range_read_info_const (this=0x14fef4026420, keyno=keyno@entry=0, seq=0x14ff480ba5c0, seq_init_param=<optimized out>, n_ranges_arg=<optimized out>, bufsz=bufsz@entry=0x14ff480ba48c, flags=0x14ff480ba488, cost=0x14ff480ba5f0) at /test/10.6_dbg/sql/multi_range_read.cc:177
      #11 0x000055939f6c4d77 in DsMrr_impl::dsmrr_info_const (this=0x14fef40268f8, keyno=0, seq=<optimized out>, seq_init_param=<optimized out>, n_ranges=<optimized out>, bufsz=0x14ff480ba57c, flags=0x14ff480ba578, cost=0x14ff480ba5f0) at /test/10.6_dbg/sql/multi_range_read.cc:1708
      #12 0x000055939fbcc1ce in ha_innobase::multi_range_read_info_const (this=<optimized out>, keyno=<optimized out>, seq=<optimized out>, seq_init_param=<optimized out>, n_ranges=<optimized out>, bufsz=<optimized out>, flags=0x14ff480ba578, cost=0x14ff480ba5f0) at /test/10.6_dbg/storage/innobase/handler/ha_innodb.cc:19425
      #13 0x000055939f998e2f in check_quick_select (is_ror_scan=<synthetic pointer>, cost=0x14ff480ba5f0, bufsize=0x14ff480ba57c, mrr_flags=0x14ff480ba578, update_tbl_stats=true, tree=0x14fef4083150, index_only=false, idx=0, param=0x14ff480bacb0) at /test/10.6_dbg/sql/opt_range.cc:11505
      #14 get_key_scans_params (param=param@entry=0x14ff480bacb0, tree=tree@entry=0x14fef40830d0, index_read_must_be_used=index_read_must_be_used@entry=false, for_range_access=for_range_access@entry=true, read_time=read_time@entry=3.2000000000000002) at /test/10.6_dbg/sql/opt_range.cc:7462
      #15 0x000055939f9ac01a in SQL_SELECT::test_quick_select (this=this@entry=0x14fef4015d18, thd=thd@entry=0x14fef4000db8, keys_to_use=<optimized out>, prev_tables=prev_tables@entry=0, limit=limit@entry=18446744073709551615, force_quick_range=force_quick_range@entry=false, ordered_output=false, remove_false_parts_of_where=true, only_single_index_range_scan=false) at /test/10.6_dbg/sql/opt_range.cc:2930
      #16 0x000055939f593116 in get_quick_record_count (limit=18446744073709551615, keys=0x14fef4014c98, table=0x14fef4024008, select=0x14fef4015d18, thd=0x14fef4000db8) at /test/10.6_dbg/sql/sql_select.cc:4773
      #17 make_join_statistics (join=join@entry=0x14fef40141e8, tables_list=@0x14fef4012998: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14fef4014760, last = 0x14fef4014760, elements = 1}, <No data fields>}, keyuse_array=keyuse_array@entry=0x14fef40144d8) at /test/10.6_dbg/sql/sql_select.cc:5504
      #18 0x000055939f59a5b1 in JOIN::optimize_inner (this=this@entry=0x14fef40141e8) at /test/10.6_dbg/sql/sql_select.cc:2255
      #19 0x000055939f59a87c in JOIN::optimize (this=this@entry=0x14fef40141e8) at /test/10.6_dbg/sql/sql_select.cc:1627
      #20 0x000055939f59b1cd in mysql_select (thd=thd@entry=0x14fef4000db8, tables=0x14fef4012d48, fields=@0x14fef40128a8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14fef4012d00, last = 0x14fef4012d00, elements = 1}, <No data fields>}, conds=0x14fef4013610, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14fef40141c0, unit=0x14fef4004f88, select_lex=0x14fef4012758) at /test/10.6_dbg/sql/sql_select.cc:4715
      #21 0x000055939f59b4e2 in handle_select (thd=thd@entry=0x14fef4000db8, lex=lex@entry=0x14fef4004ec0, result=result@entry=0x14fef40141c0, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.6_dbg/sql/sql_select.cc:417
      #22 0x000055939f50e2b0 in execute_sqlcom_select (thd=thd@entry=0x14fef4000db8, all_tables=0x14fef4012d48) at /test/10.6_dbg/sql/sql_parse.cc:6138
      #23 0x000055939f51ade6 in mysql_execute_command (thd=thd@entry=0x14fef4000db8) at /test/10.6_dbg/sql/sql_parse.cc:3834
      #24 0x000055939f50721a in mysql_parse (thd=thd@entry=0x14fef4000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14ff480bc3d0) at /test/10.6_dbg/sql/sql_parse.cc:7906
      #25 0x000055939f51530b in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14fef4000db8, packet=packet@entry=0x14fef401aac9 "SELECT * FROM t WHERE a in ('')", packet_length=packet_length@entry=31) at /test/10.6_dbg/sql/sql_class.h:1295
      #26 0x000055939f51863d in do_command (thd=0x14fef4000db8) at /test/10.6_dbg/sql/sql_parse.cc:1365
      #27 0x000055939f6741ab in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5593a1f782a8, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
      #28 0x000055939f6748af in handle_one_connection (arg=arg@entry=0x5593a1f782a8) at /test/10.6_dbg/sql/sql_connect.cc:1312
      #29 0x000055939fb2827d in pfs_spawn_thread (arg=0x5593a1eac5f8) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
      #30 0x000014ff50c32609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #31 0x000014ff50821293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.4.18 (dbg), 10.5.9 (dbg), 10.6.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.2.37 (dbg), 10.2.37 (opt), 10.3.28 (dbg), 10.3.28 (opt), 10.4.18 (opt), 10.5.9 (opt), 10.6.0 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.33 (dbg), 5.7.33 (opt), 8.0.23 (dbg), 8.0.23 (opt)

      10.3.28 75538f94ca06915ddc22458b82b8e148e51dd0db (Debug)

      10.3.28>CREATE TABLE t (a VARCHAR(255), KEY k(a)) DEFAULT CHARSET=utf8 ENGINE=InnoDB;
      Query OK, 0 rows affected (0.018 sec)
      10.3.28>ALTER TABLE t CHANGE a a VARCHAR(3000);
      ERROR 1071 (42000): Specified key was too long; max key length is 3072 bytes
      10.3.28>SELECT * FROM t WHERE a in ('');
      Empty set (0.001 sec)
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              Roel Roel Van de Paar
              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.