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

Assertion `key_read == 0' failed in TABLE::enable_keyread with SELECT SQ and WHERE SQ

    Details

      Description

      CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (4),(8);
       
      CREATE TABLE t2 (f2 INT, KEY(f2)) ENGINE=MyISAM;
      INSERT INTO t2 VALUES (6),(9);
       
      SELECT ( SELECT MAX(sq.f2) FROM t1 ) FROM ( SELECT * FROM t2 ) AS sq WHERE f2 = 2;

      Stack trace from 5.5 commit 86f46a3da4a6d82cb510dc4c270d46cfd6a8965b

      sql/table.h:1283: void TABLE::enable_keyread(): Assertion `key_read == 0' failed.
      150325  0:34:39 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007f02002a5311 in *__GI___assert_fail (assertion=0xd6a5f8 "key_read == 0", file=<optimized out>, line=1283, function=0xd6d830 "void TABLE::enable_keyread()") at assert.c:81
      #7  0x00000000006a05a0 in TABLE::enable_keyread (this=0x7f01fadb4860) at 5.5/sql/table.h:1283
      #8  0x000000000090a968 in find_key_for_maxmin (max_fl=true, ref=0x7f01fb7b3690, field=0x7f01fac59998, cond=0x0, range_fl=0x7f01fb7b430c, prefix_len=0x7f01fb7b4308) at 5.5/sql/opt_sum.cc:967
      #9  0x00000000009092e0 in opt_sum_query (thd=0x7f01fbd50060, tables=..., all_fields=..., conds=0x0) at 5.5/sql/opt_sum.cc:391
      #10 0x00000000006658dc in JOIN::optimize (this=0x7f01fad3fd48) at 5.5/sql/sql_select.cc:1172
      #11 0x000000000062b2d0 in st_select_lex::optimize_unflattened_subqueries (this=0x7f01fbd53a60, const_only=false) at 5.5/sql/sql_lex.cc:3506
      #12 0x000000000077ada2 in JOIN::optimize_unflattened_subqueries (this=0x7f01fad3f078) at 5.5/sql/opt_subselect.cc:4944
      #13 0x0000000000667667 in JOIN::optimize (this=0x7f01fad3f078) at 5.5/sql/sql_select.cc:1665
      #14 0x000000000066c45b in mysql_select (thd=0x7f01fbd50060, rref_pointer_array=0x7f01fbd53cd0, tables=0x7f01fad6a4f8, wild_num=0, fields=..., conds=0x7f01fad6ac78, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f01fad6ae88, unit=0x7f01fbd53380, select_lex=0x7f01fbd53a60) at 5.5/sql/sql_select.cc:3080
      #15 0x0000000000662fbd in handle_select (thd=0x7f01fbd50060, lex=0x7f01fbd532d0, result=0x7f01fad6ae88, setup_tables_done_option=0) at 5.5/sql/sql_select.cc:319
      #16 0x000000000063c1fc in execute_sqlcom_select (thd=0x7f01fbd50060, all_tables=0x7f01fad6a4f8) at 5.5/sql/sql_parse.cc:4689
      #17 0x00000000006353de in mysql_execute_command (thd=0x7f01fbd50060) at 5.5/sql/sql_parse.cc:2234
      #18 0x000000000063ece2 in mysql_parse (thd=0x7f01fbd50060, rawbuf=0x7f01fae87078 "SELECT ( SELECT MAX(sq.f2) FROM t1 ) FROM ( SELECT * FROM t2 ) AS sq WHERE f2 = 2", length=81, parser_state=0x7f01fb7b5620) at 5.5/sql/sql_parse.cc:5909
      #19 0x0000000000632925 in dispatch_command (command=COM_QUERY, thd=0x7f01fbd50060, packet=0x7f01fbe09061 "SELECT ( SELECT MAX(sq.f2) FROM t1 ) FROM ( SELECT * FROM t2 ) AS sq WHERE f2 = 2", packet_length=81) at 5.5/sql/sql_parse.cc:1079
      #20 0x0000000000631ab1 in do_command (thd=0x7f01fbd50060) at 5.5/sql/sql_parse.cc:793
      #21 0x0000000000734122 in do_handle_one_connection (thd_arg=0x7f01fbd50060) at 5.5/sql/sql_connect.cc:1266
      #22 0x0000000000733be1 in handle_one_connection (arg=0x7f01fbd50060) at 5.5/sql/sql_connect.cc:1181
      #23 0x0000000000b6c629 in pfs_spawn_thread (arg=0x7f01fbd71fc0) at 5.5/storage/perfschema/pfs.cc:1015
      #24 0x00007f02020a0b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
      #25 0x00007f020035670d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sanja Oleksandr Byelkin
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: