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

Assertion `table->key_read == 0' fails in close_thread_table on EXPLAIN with GROUP BY and HAVING in EXISTS SQ, InnoDB

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Duplicate
    • 10.0.1, 5.5.29
    • 10.0.4, 5.5.32
    • None
    • None

    Description

      mysqld: maria-5.5/sql/sql_base.cc:1604: bool close_thread_table(THD*, TABLE**): Assertion `table->key_read == 0' failed.
      130115  2:59:33 [ERROR] mysqld got signal 6 ;

      #6  0x00007fc574266d4d in __GI___assert_fail (assertion=0xd0e164 "table->key_read == 0", file=<optimized out>, line=1604, function=<optimized out>) at assert.c:81
      #7  0x00000000005acbd6 in close_thread_table (thd=0x352fa20, table_ptr=0x352fad8) at /maria-5.5/sql/sql_base.cc:1604
      #8  0x00000000005ac481 in close_open_tables (thd=0x352fa20) at /maria-5.5/sql/sql_base.cc:1377
      #9  0x00000000005acb0c in close_thread_tables (thd=0x352fa20) at /maria-5.5/sql/sql_base.cc:1589
      #10 0x0000000000614557 in mysql_execute_command (thd=0x352fa20) at /maria-5.5/sql/sql_parse.cc:4530
      #11 0x000000000061731d in mysql_parse (thd=0x352fa20, rawbuf=0x362d4b8 "EXPLAIN \nSELECT * FROM t1\nWHERE EXISTS ( SELECT b FROM t2, t3\nGROUP BY b\nHAVING b != 3 )", length=88, parser_state=0x7fc563b4b500) at /maria-5.5/sql/sql_parse.cc:5741
      #12 0x000000000060aade in dispatch_command (command=COM_QUERY, thd=0x352fa20, packet=0x36931a1 "", packet_length=89) at /maria-5.5/sql/sql_parse.cc:1055
      #13 0x0000000000609d95 in do_command (thd=0x352fa20) at /maria-5.5/sql/sql_parse.cc:794
      #14 0x000000000070d0a3 in do_handle_one_connection (thd_arg=0x352fa20) at /maria-5.5/sql/sql_connect.cc:1253
      #15 0x000000000070ca8e in handle_one_connection (arg=0x352fa20) at /maria-5.5/sql/sql_connect.cc:1168
      #16 0x0000000000b92d63 in pfs_spawn_thread (arg=0x3691f00) at /maria-5.5/storage/perfschema/pfs.cc:1015
      #17 0x00007fc574faaefc in start_thread (arg=0x7fc563b4c700) at pthread_create.c:304
      #18 0x00007fc57431cf4d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
      #19 0x0000000000000000 in ?? ()

      The failure appeared in maria/5.5 with the following revision:

      revno: 3511 [merge]
      revision-id: psergey@askmonty.org-20120828112037-16ga9yq0akyd0fzc
      committer: Sergey Petrunya <psergey@askmonty.org>
      timestamp: Tue 2012-08-28 15:20:37 +0400
      message:
        Merge
          ------------------------------------------------------------
          revno: 3501.1.1
          committer: Sergey Petrunya <psergey@askmonty.org>
          timestamp: Tue 2012-08-28 15:15:05 +0400
          message:
            MDEV-430: Server crashes in select_describe on EXPLAIN with materialization+semijoin, etc
            - Don't do early cleanup of uncorrelated subqueries if we're running an EXPLAIN.

      Test case:

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (a INT) ENGINE=InnoDB;
      CREATE TABLE t2 (b INT PRIMARY KEY, c INT) ENGINE=InnoDB;
      CREATE TABLE t3 (d INT) ENGINE=InnoDB;
       
      EXPLAIN 
      SELECT * FROM t1
      WHERE EXISTS ( SELECT b FROM t2, t3
      GROUP BY b
      HAVING b != 3 );

      Minimal optimizer_switch: in_to_exists=on
      Full optimizer_switch (default):

      index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off

      Not reproducible on MariaDB 5.3, MySQL 5.6.
      Not reproducible with MyISAM instead of InnoDB.
      Only EXPLAIN causes the failure, SELECT works.

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              elenst Elena Stepanova
              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.