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

Assertion `!created && key_to_save < (int)s->keys' failed in TABLE::use_index

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.3
    • Fix Version/s: 10.3.2
    • Component/s: Optimizer, Views
    • Labels:
      None

      Description

      CREATE TABLE t1 (a INT, b INT, KEY(a));
      CREATE TABLE t2 (c INT);
       
      CREATE VIEW v1 AS SELECT a, b FROM t1 STRAIGHT_JOIN t2;
      CREATE VIEW v2 AS SELECT a, max(b) as bmax FROM v1 GROUP BY a;
      CREATE VIEW v3 AS SELECT v2.* FROM t1 JOIN v2 ON t1.b = v2.bmax ;
       
      SELECT * FROM v3 JOIN t1 ON (bmax = b);
      

      10.3 016c35a7f2f4a2

      mysqld: /data/src/10.3/sql/table.cc:6932: void TABLE::use_index(int): Assertion `!created && key_to_save < (int)s->keys' failed.
      170904 19:28:47 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f4decf74ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x00005630b197e36c in TABLE::use_index (this=0x7f4dcc0454f8, key_to_save=0) at /data/src/10.3/sql/table.cc:6932
      #9  0x00005630b18ca53f in JOIN::drop_unused_derived_keys (this=0x7f4dcc041540) at /data/src/10.3/sql/sql_select.cc:10820
      #10 0x00005630b18aef7f in JOIN::optimize_stage2 (this=0x7f4dcc041540) at /data/src/10.3/sql/sql_select.cc:1569
      #11 0x00005630b18aee08 in JOIN::optimize_inner (this=0x7f4dcc041540) at /data/src/10.3/sql/sql_select.cc:1541
      #12 0x00005630b18ad6f4 in JOIN::optimize (this=0x7f4dcc041540) at /data/src/10.3/sql/sql_select.cc:1123
      #13 0x00005630b18b679e in mysql_select (thd=0x7f4dcc000b00, tables=0x7f4dcc014c18, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f4dcc03f480, unit=0x7f4dcc0047c0, select_lex=0x7f4dcc004f00) at /data/src/10.3/sql/sql_select.cc:3723
      #14 0x00005630b18aadbc in handle_select (thd=0x7f4dcc000b00, lex=0x7f4dcc0046f8, result=0x7f4dcc03f480, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:378
      #15 0x00005630b187626e in execute_sqlcom_select (thd=0x7f4dcc000b00, all_tables=0x7f4dcc014c18) at /data/src/10.3/sql/sql_parse.cc:6466
      #16 0x00005630b186c7ef in mysql_execute_command (thd=0x7f4dcc000b00) at /data/src/10.3/sql/sql_parse.cc:3731
      #17 0x00005630b1879bd4 in mysql_parse (thd=0x7f4dcc000b00, rawbuf=0x7f4dcc014a08 "SELECT * FROM v3 JOIN t1 ON (bmax = b)", length=38, parser_state=0x7f4de81b1610, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7921
      #18 0x00005630b186732e in dispatch_command (command=COM_QUERY, thd=0x7f4dcc000b00, packet=0x7f4dcc00af11 "SELECT * FROM v3 JOIN t1 ON (bmax = b)", packet_length=38, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1819
      #19 0x00005630b1865d90 in do_command (thd=0x7f4dcc000b00) at /data/src/10.3/sql/sql_parse.cc:1370
      #20 0x00005630b19bc646 in do_handle_one_connection (connect=0x5630b4b454f0) at /data/src/10.3/sql/sql_connect.cc:1418
      #21 0x00005630b19bc3d3 in handle_one_connection (arg=0x5630b4b454f0) at /data/src/10.3/sql/sql_connect.cc:1324
      #22 0x00005630b1e341dc in pfs_spawn_thread (arg=0x5630b4be5ef0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #23 0x00007f4deeeb9494 in start_thread (arg=0x7f4de81b2700) at pthread_create.c:333
      #24 0x00007f4ded03193f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      The failure appeared in 10.3 tree with this revision:

      commit b14e2b044b6483f22d9c33e6697479fbd859f747
      Author: Igor Babaev <igor@askmonty.org>
      Date:   Thu Aug 3 21:19:19 2017 -0700
       
          This first patch prepared for the task MDEV-13369:
          "Optimization for equi-joins of derived tables with GROUP BY"
          should be considered rather as a 'proof of concept'.
      

        Attachments

          Activity

            People

            Assignee:
            igor Igor Babaev
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.