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

SQ pushdown: Server crashes in make_join_statistics with materialization+semijoin, IN subqueries, constant table, impossible condition

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.0.4
    • Component/s: None
    • Labels:
      None

      Description

      #3  <signal handler called>
      #4  0x00000000006f1c52 in make_join_statistics (join=0x7fcda40257c8, tables_list=..., conds=0x7fcda402b2f8, keyuse_array=0x7fcda4025ad8) at 10.0-mdev83/sql/sql_select.cc:3758
      #5  0x00000000006e483e in JOIN::optimize_inner (this=0x7fcda40257c8) at 10.0-mdev83/sql/sql_select.cc:1314
      #6  0x00000000006e2ef2 in JOIN::optimize (this=0x7fcda40257c8) at 10.0-mdev83/sql/sql_select.cc:1008
      #7  0x00000000006ef234 in mysql_select (thd=0x4b8acc0, rref_pointer_array=0x4b8dc78, tables=0x7fcda4018bf0, wild_num=1, fields=..., conds=0x7fcda40255b8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fcda40257a8, unit=0x4b8d340, select_lex=0x4b8da18) at 10.0-mdev83/sql/sql_select.cc:3233
      #8  0x00000000006e0328 in handle_select (thd=0x4b8acc0, lex=0x4b8d288, result=0x7fcda40257a8, setup_tables_done_option=0) at 10.0-mdev83/sql/sql_select.cc:376
      #9  0x000000000069bd17 in execute_sqlcom_select (thd=0x4b8acc0, all_tables=0x7fcda4018bf0) at 10.0-mdev83/sql/sql_parse.cc:4804
      #10 0x000000000068f1cd in mysql_execute_command (thd=0x4b8acc0) at 10.0-mdev83/sql/sql_parse.cc:2268
      #11 0x000000000069fd97 in mysql_parse (thd=0x4b8acc0, rawbuf=0x7fcda4018878 "SELECT * FROM t1 AS outer_t1, t2 \nWHERE outer_t1.a = b AND outer_t1.a IN ( \nSELECT c FROM t1 AS inner_t1, t3 \nWHERE ( inner_t1.a = 7 ) AND inner_t1.a != outer_t1.a OR ( 2 ) IN ( \nSELECT a FROM t1 WHER"..., length=209, parser_state=0x7fcdadb68520) at 10.0-mdev83/sql/sql_parse.cc:5927
      #12 0x000000000068a8d9 in dispatch_command (command=COM_QUERY, thd=0x4b8acc0, packet=0x4b8f2d1 "SELECT * FROM t1 AS outer_t1, t2 \nWHERE outer_t1.a = b AND outer_t1.a IN ( \nSELECT c FROM t1 AS inner_t1, t3 \nWHERE ( inner_t1.a = 7 ) AND inner_t1.a != outer_t1.a OR ( 2 ) IN ( \nSELECT a FROM t1 WHER"..., packet_length=209) at 10.0-mdev83/sql/sql_parse.cc:1091
      #13 0x000000000068969b in do_command (thd=0x4b8acc0) at 10.0-mdev83/sql/sql_parse.cc:810
      #14 0x000000000084695c in do_handle_one_connection (thd_arg=0x4b8acc0) at 10.0-mdev83/sql/sql_connect.cc:1266
      #15 0x00000000008464a4 in handle_one_connection (arg=0x4b8acc0) at 10.0-mdev83/sql/sql_connect.cc:1181
      #16 0x0000000000c26a2d in pfs_spawn_thread (arg=0x4b07fd0) at 10.0-mdev83/storage/perfschema/pfs.cc:1015
      #17 0x00007fcdb9255e9a in start_thread (arg=0x7fcdadb69700) at pthread_create.c:308
      #18 0x00007fcdb8549cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

      bzr version-info

      revision-id: timour@askmonty.org-20130528122232-kisslvdw5vhrna0q
      revno: 3550
      branch-nick: 10.0-mdev83

      Not reproducible on maria-10.0-mwl253 revno 3545, 10.0 revno 3752, current 10.0-base revno 3640.

      Minimal optimizer_switch: materialization=on,semijoin=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,exists_to_in=off,expensive_pred_static_pushdown=off

      EXPLAIN also crashes.

      Test case:

      SET optimizer_switch = 'materialization=on,semijoin=on';
       
      CREATE TABLE t1 (a INT) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (0),(8);
      CREATE TABLE t2 (b INT) ENGINE=MyISAM;
      INSERT INTO t2 VALUES (0),(8);
      CREATE TABLE t3 (c INT) ENGINE=MyISAM;
      INSERT INTO t3 VALUES (7);
       
      SELECT * FROM t1 AS outer_t1, t2 
      WHERE outer_t1.a = b AND outer_t1.a IN ( 
        SELECT c FROM t1 AS inner_t1, t3 
        WHERE ( inner_t1.a = 7 ) AND inner_t1.a != outer_t1.a OR ( 2 ) IN ( 
          SELECT a FROM t1 WHERE 0 
        ) 
      );

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              timour Timour Katchaounov (Inactive)
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: