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

LP:802965 - Crash in do_copy_not_null with semijoin=on in maria-5.3

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      Repeatable on maria-5.3, maria-5.3-subqueries-mwl90.

      backtrace:

      #3 <signal handler called>
      #4 0x0000000000850244 in do_copy_not_null (copy=0xa55e708) at field_conv.cc:240
      #5 0x00000000007568ae in store_key_field::copy_inner (this=0xa55e6e0) at sql_select.h:1322
      #6 0x0000000000638330 in store_key::copy (this=0xa55e6e0) at sql_select.h:1263
      #7 0x000000000071d09d in cp_buffer_from_ref (thd=0xa4a23c8, table=0xa564158, ref=0xa5baca8) at sql_select.cc:18363
      #8 0x0000000000728d83 in cmp_buffer_with_ref (thd=0xa4a23c8, table=0xa564158, tab_ref=0xa5baca8) at sql_select.cc:18345
      #9 0x00000000007290fd in join_read_key2 (thd=0xa4a23c8, tab=0xa5baa90, table=0xa564158, table_ref=0xa5baca8) at sql_select.cc:15459
      #10 0x00000000007292db in join_read_key (tab=0xa5baa90) at sql_select.cc:15442
      #11 0x0000000000733510 in sub_select (join=0xa5ad0a0, join_tab=0xa5baa90, end_of_records=false) at sql_select.cc:14901
      #12 0x000000000072a2c6 in evaluate_join_record (join=0xa5ad0a0, join_tab=0xa5ba778, error=0) at sql_select.cc:15099
      #13 0x0000000000733560 in sub_select (join=0xa5ad0a0, join_tab=0xa5ba778, end_of_records=false) at sql_select.cc:14904
      #14 0x000000000072a2c6 in evaluate_join_record (join=0xa5ad0a0, join_tab=0xa5ba460, error=0) at sql_select.cc:15099
      #15 0x0000000000733560 in sub_select (join=0xa5ad0a0, join_tab=0xa5ba460, end_of_records=false) at sql_select.cc:14904
      #16 0x000000000072a2c6 in evaluate_join_record (join=0xa5ad0a0, join_tab=0xa5ba148, error=0) at sql_select.cc:15099
      #17 0x0000000000733560 in sub_select (join=0xa5ad0a0, join_tab=0xa5ba148, end_of_records=false) at sql_select.cc:14904
      #18 0x000000000072a2c6 in evaluate_join_record (join=0xa5ad0a0, join_tab=0xa5b9e30, error=0) at sql_select.cc:15099
      #19 0x0000000000733560 in sub_select (join=0xa5ad0a0, join_tab=0xa5b9e30, end_of_records=false) at sql_select.cc:14904
      #20 0x0000000000734894 in do_select (join=0xa5ad0a0, fields=0xa4a4e30, table=0x0, procedure=0x0) at sql_select.cc:14569
      #21 0x0000000000754016 in JOIN::exec (this=0xa5ad0a0) at sql_select.cc:2665
      #22 0x000000000074df6e in mysql_select (thd=0xa4a23c8, rref_pointer_array=0xa4a4f48, tables=0xa527090, wild_num=1, fields=..., conds=0xa5675f8, og_num=0,
      order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147764736, result=0xa5677e0, unit=0xa4a4840, select_lex=0xa4a4d28)
      at sql_select.cc:2886
      #23 0x0000000000754348 in handle_select (thd=0xa4a23c8, lex=0xa4a47a0, result=0xa5677e0, setup_tables_done_option=0) at sql_select.cc:283
      #24 0x00000000006a1744 in execute_sqlcom_select (thd=0xa4a23c8, all_tables=0xa527090) at sql_parse.cc:5082
      #25 0x00000000006a33f7 in mysql_execute_command (thd=0xa4a23c8) at sql_parse.cc:2227
      #26 0x00000000006ac18f in mysql_parse (thd=0xa4a23c8,
      rawbuf=0xa526d60 "SELECT *\nFROM t2 , t1\nWHERE t2.f1 IN\n(\nSELECT SQ1_alias1.f1\nFROM t1 AS SQ1_alias1 \nLEFT JOIN t2 AS SQ1_alias2 JOIN t2 AS SQ1_alias3 ON SQ1_alias3.f1 ON SQ1_alias3.f1 )\nAND t1.f1 = t2.f1", length=186, found_semicolon=0x4129df08) at sql_parse.cc:6083
      #27 0x00000000006ad027 in dispatch_command (command=COM_QUERY, thd=0xa4a23c8, packet=0xa51d8a9 "", packet_length=187) at sql_parse.cc:1206
      #28 0x00000000006ae635 in do_command (thd=0xa4a23c8) at sql_parse.cc:904
      #29 0x00000000006990eb in handle_one_connection (arg=0xa4a23c8) at sql_connect.cc:1178
      #30 0x00000033b600673d in start_thread () from /lib64/libpthread.so.0
      #31 0x00000033b58d40cd in clone () from /lib64/libc.so.6

      optimizer switch in effect:

      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=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=on,mrr_cost_based=off,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on

      explain:

      id select_type table type possible_keys key key_len ref rows Extra
      1 PRIMARY SQ1_alias1 index NULL PRIMARY 4 NULL 4 Using where; Using index; Start temporary
      1 PRIMARY SQ1_alias2 index NULL PRIMARY 4 NULL 2 Using index
      1 PRIMARY SQ1_alias3 index NULL PRIMARY 4 NULL 2 Using where; Using index
      1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.SQ1_alias1.f1 1 Using index
      1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.SQ1_alias1.f1 1 Using index; End temporary

      test case:

      SET SESSION optimizer_switch='semijoin=on,materialization=off,firstmatch=off,loosescan=off';

      CREATE TABLE t2 ( f1 int NOT NULL , PRIMARY KEY (f1)) ;
      INSERT IGNORE INTO t2 VALUES (19),(20);

      CREATE TABLE t1 ( f1 int NOT NULL , PRIMARY KEY (f1)) ;
      INSERT IGNORE INTO t1 VALUES (21),(22),(23),(24);

      SELECT *
      FROM t2 , t1
      WHERE t2.f1 IN
      (
      SELECT SQ1_alias1.f1
      FROM t1 AS SQ1_alias1
      LEFT JOIN t2 AS SQ1_alias2 JOIN t2 AS SQ1_alias3 ON SQ1_alias3.f1 ON SQ1_alias3.f1 )
      AND t1.f1 = t2.f1 ;

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 802965

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 802965

              People

              • Assignee:
                psergey Sergei Petrunia
                Reporter:
                philipstoev Philip Stoev
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: