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

Server crashes in SEL_ARG::rb_insert with index_merge+index_merge_sort_union, FORCE INDEX

    XMLWordPrintable

Details

    Description

      #2  0x000000000082eeae in handle_fatal_signal (sig=11) at signal_handler.cc:273
      #3  <signal handler called>
      #4  0x00000000007ec0b6 in SEL_ARG::rb_insert (this=0x7fcafc03a408, leaf=0x7fcafc03a498) at opt_range.cc:9557
      #5  0x00000000007ebb3b in SEL_ARG::insert (this=0x7fcafc03a408, key=0x7fcafc03a498) at opt_range.cc:9400
      #6  0x00000000007eadf6 in key_or (param=0x7fcb16e60b70, key1=0x7fcafc03a408, key2=0x7fcafc033d78) at opt_range.cc:8971
      #7  0x00000000007e119a in merge_same_index_scans (param=0x7fcb16e60b70, imerge=0x7fcafc038678, imerge_trp=0x7fcafc03a3b8, read_time=10.919500474043771) at opt_range.cc:4810
      #8  0x00000000007e0a33 in get_best_disjunct_quick (param=0x7fcb16e60b70, imerge=0x7fcafc038678, read_time=10.919500474043771) at opt_range.cc:4644
      #9  0x00000000007ddeed in SQL_SELECT::test_quick_select (this=0x7fcafc032038, thd=0x2fd9480, keys_to_use=..., prev_tables=0, limit=18446744073709551615, force_quick_range=false, ordered_output=false) at opt_range.cc:3198
      #10 0x0000000000714933 in get_quick_record_count (thd=0x2fd9480, select=0x7fcafc032038, table=0x7fcafc026940, keys=0x7fcafc030c88, limit=18446744073709551615) at sql_select.cc:3039
      #11 0x00000000007166bd in make_join_statistics (join=0x7fcafc02ead8, tables_list=..., conds=0x7fcafc02cf78, keyuse_array=0x7fcafc02ede0) at sql_select.cc:3583
      #12 0x000000000070dabd in JOIN::optimize (this=0x7fcafc02ead8) at sql_select.cc:1158
      #13 0x000000000071460f in mysql_select (thd=0x2fd9480, rref_pointer_array=0x2fdc1e8, tables=0x7fcafc02c888, wild_num=1, fields=..., conds=0x7fcafc02cf78, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147764736, result=0x7fcafc023418, unit=0x2fdba18, select_lex=0x2fdbf40) at sql_select.cc:2976
      #14 0x000000000070b04f in handle_select (thd=0x2fd9480, lex=0x2fdb978, result=0x7fcafc023418, setup_tables_done_option=0) at sql_select.cc:288
      #15 0x0000000000696507 in execute_sqlcom_select (thd=0x2fd9480, all_tables=0x7fcafc02c888) at sql_parse.cc:5172
      #16 0x000000000068d2c6 in mysql_execute_command (thd=0x2fd9480) at sql_parse.cc:2305
      #17 0x0000000000698f81 in mysql_parse (thd=0x2fd9480, rawbuf=0x7fcafc022ea8 "SELECT * FROM state FORCE INDEX ( PRIMARY, population_rate, area_rate, code ) \nWHERE pk = 1 OR population_rate = 1 OR ( area_rate IN ( 1,2 ) OR area_rate IS NULL ) AND ( population_rate = 25 OR area_r"..., length=253, found_semicolon=0x7fcb16e647d8) at sql_parse.cc:6173
      #18 0x000000000068aa6a in dispatch_command (command=COM_QUERY, thd=0x2fd9480, packet=0x30641b1 "SELECT * FROM state FORCE INDEX ( PRIMARY, population_rate, area_rate, code ) \nWHERE pk = 1 OR population_rate = 1 OR ( area_rate IN ( 1,2 ) OR area_rate IS NULL ) AND ( population_rate = 25 OR area_r"..., packet_length=254) at sql_parse.cc:1243
      #19 0x0000000000689d08 in do_command (thd=0x2fd9480) at sql_parse.cc:923
      #20 0x0000000000686763 in handle_one_connection (arg=0x2fd9480) at sql_connect.cc:1231
      #21 0x00007fcb18b7ce9a in start_thread (arg=0x7fcb16e65700) at pthread_create.c:308
      #22 0x00007fcb180a5cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

      Stack trace from:

      revision-id: sergii@pisem.net-20130521074210-lcv22xh6audhc5a9
      revno: 3659
      branch-nick: 5.3

      Also reproducible on current 5.5, 10.0. Not reproducible on MySQL 5.6.

      Minimal optimizer_switch: index_merge=on,index_merge_sort_union=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,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

      Test case:

      SET optimizer_switch = 'index_merge=on,index_merge_sort_union=on';
       
      CREATE TABLE state (
        pk int,
        code char(2),
        population_rate int,
        area_rate int,
        primary key (pk),
        index (code),
        key (population_rate),
        key (area_rate)
      );
       
      INSERT INTO state VALUES  (1,'WI',20, 23), (2, 'WA', 13, 18);
       
      SELECT * FROM state FORCE INDEX ( PRIMARY, population_rate, area_rate, code ) 
      WHERE pk = 1 OR population_rate = 1 OR ( area_rate IN ( 1,2 ) OR area_rate IS NULL ) AND ( population_rate = 25 OR area_rate BETWEEN 2 AND 25 OR code BETWEEN 'MA' AND 'TX'  )
      ;

      EXPLAIN also crashes.

      Attachments

        1. mdev4556.diff
          4 kB
          Patryk Pomykalski
        2. mdev4556-wrong_result.test
          51 kB
          Elena Stepanova

        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.