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

Exists2In: Assertion `in_subs->has_strategy()' failed in JOIN::choose_subquery_plan on 2nd execution of PS with exists_to_in+semijoin, EXISTS subquery, MERGE view or FROM subquery

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 10.0.2
    • None
    • None

    Description

      10.0-exists2in/sql/opt_subselect.cc:5302: bool JOIN::choose_subquery_plan(table_map): Assertion `in_subs->has_strategy()' failed.
      [ERROR] mysqld got signal 6 ;

      #6  0x00007f251068bd4d in __GI___assert_fail (assertion=0xe13668 "in_subs->has_strategy()", file=<optimized out>, line=5302, function=<optimized out>) at assert.c:81
      #7  0x00000000007666ab in JOIN::choose_subquery_plan (this=0x412fec8, join_tables=1) at 10.0-exists2in/sql/opt_subselect.cc:5302
      #8  0x000000000064f66a in make_join_statistics (join=0x412fec8, tables_list=..., conds=0x0, keyuse_array=0x41301f0) at 10.0-exists2in/sql/sql_select.cc:3874
      #9  0x0000000000646438 in JOIN::optimize_inner (this=0x412fec8) at 10.0-exists2in/sql/sql_select.cc:1280
      #10 0x0000000000645414 in JOIN::optimize (this=0x412fec8) at 10.0-exists2in/sql/sql_select.cc:994
      #11 0x0000000000607dcb in st_select_lex::optimize_unflattened_subqueries (this=0x41266c0, const_only=false) at 10.0-exists2in/sql/sql_lex.cc:3491
      #12 0x0000000000765838 in JOIN::optimize_unflattened_subqueries (this=0x412d7e8) at 10.0-exists2in/sql/opt_subselect.cc:4900
      #13 0x0000000000647e67 in JOIN::optimize_inner (this=0x412d7e8) at 10.0-exists2in/sql/sql_select.cc:1709
      #14 0x0000000000645414 in JOIN::optimize (this=0x412d7e8) at 10.0-exists2in/sql/sql_select.cc:994
      #15 0x000000000064d0f2 in mysql_select (thd=0x40f6890, rref_pointer_array=0x4126970, tables=0x4128628, wild_num=0, fields=..., conds=0x413f3f8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184064, result=0x4145678, unit=0x4125fc8, select_lex=0x41266c0) at 10.0-exists2in/sql/sql_select.cc:3193
      #16 0x000000000064387e in handle_select (thd=0x40f6890, lex=0x4125f18, result=0x4145678, setup_tables_done_option=0) at 10.0-exists2in/sql/sql_select.cc:362
      #17 0x000000000061b13b in execute_sqlcom_select (thd=0x40f6890, all_tables=0x4128628) at 10.0-exists2in/sql/sql_parse.cc:4937
      #18 0x00000000006137a8 in mysql_execute_command (thd=0x40f6890) at 10.0-exists2in/sql/sql_parse.cc:2421
      #19 0x0000000000635b95 in Prepared_statement::execute (this=0x40fea60, expanded_query=0x7f2503b39c30, open_cursor=false) at 10.0-exists2in/sql/sql_prepare.cc:3914
      #20 0x0000000000634c2c in Prepared_statement::execute_loop (this=0x40fea60, expanded_query=0x7f2503b39c30, open_cursor=false, packet=0x0, packet_end=0x0) at 10.0-exists2in/sql/sql_prepare.cc:3570
      #21 0x0000000000632ce3 in mysql_sql_stmt_execute (thd=0x40f6890) at 10.0-exists2in/sql/sql_prepare.cc:2732
      #22 0x00000000006137d9 in mysql_execute_command (thd=0x40f6890) at 10.0-exists2in/sql/sql_parse.cc:2431
      #23 0x000000000061d9f6 in mysql_parse (thd=0x40f6890, rawbuf=0x412e238 "EXECUTE stmt", length=12, parser_state=0x7f2503b3a4e0) at 10.0-exists2in/sql/sql_parse.cc:6056
      #24 0x000000000061099a in dispatch_command (command=COM_QUERY, thd=0x40f6890, packet=0x4100aa1 "EXECUTE stmt", packet_length=12) at 10.0-exists2in/sql/sql_parse.cc:1216
      #25 0x000000000060fb93 in do_command (thd=0x40f6890) at 10.0-exists2in/sql/sql_parse.cc:945
      #26 0x000000000071a57a in do_handle_one_connection (thd_arg=0x40f6890) at 10.0-exists2in/sql/sql_connect.cc:1254

      branch: 10.0-exists2in
      revision-id: sanja@montyprogram.com-20121129184233-zxp9qe77tfcupomh
      date: 2012-11-29 20:42:33 +0200
      revno: 3486

      Minimal optimizer_switch: in_to_exists=on,semijoin=on,exists_to_in=on
      Full optimizer_switch (default + exists_to_in=on):

      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=on

      Test case:

      SET optimizer_switch='in_to_exists=on,semijoin=on,exists_to_in=on';
       
      CREATE TABLE t1 (a INT) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (1),(2);
       
      CREATE TABLE t2 (b INT) ENGINE=MyISAM;
      INSERT INTO t2 VALUES (4),(6);
       
      CREATE ALGORITHM=MERGE VIEW v AS 
      SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t2 WHERE b = a );
       
      PREPARE stmt FROM ' SELECT * FROM v ';
       
      EXECUTE stmt;
      EXECUTE stmt;

      A variation with a subquery instead of the view also fails.

      Attachments

        Issue Links

          Activity

            Item_exists_subselect::exists2in_processor called only on second execution.

            sanja Oleksandr Byelkin added a comment - Item_exists_subselect::exists2in_processor called only on second execution.

            The problem is that on the first call when we try to convert outer most view SELECT it has no condition then the condition appear on the most outer level but the select level where the condition put disappear at the same moment (view substitution).

            sanja Oleksandr Byelkin added a comment - The problem is that on the first call when we try to convert outer most view SELECT it has no condition then the condition appear on the most outer level but the select level where the condition put disappear at the same moment (view substitution).

            People

              sanja Oleksandr Byelkin
              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.