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

Server crashes in update_ref_and_keys / JOIN::reoptimize

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.3
    • Fix Version/s: 10.3.2
    • Component/s: Optimizer, Views
    • Labels:
      None

      Description

      CREATE TABLE t1 (i INT, c VARCHAR(8), KEY(c));
      INSERT INTO t1 VALUES (1,'foo'),(9,'bar');
       
      CREATE TABLE t2 (a INT);
      INSERT INTO t2 VALUES (1),(2),(3),(4);
       
      CREATE TABLE t3 (c VARCHAR(8));
      INSERT INTO t3 VALUES ('abc'),('def');
       
      CREATE OR REPLACE VIEW v AS  
        SELECT c AS val FROM t1 WHERE i IN ( SELECT i FROM t1 JOIN t2 ) GROUP BY val ;
       
      SELECT * FROM t3 WHERE c IN ( SELECT val FROM v ) ;
      

      10.3 016c35a7f2f4a288542f5fcb0e182c05238398e6

      #3  <signal handler called>
      #4  0x00005617ac8daae5 in update_ref_and_keys (thd=0x7f6bf8000b00, keyuse=0x7f6c09bcfb20, join_tab=0x7f6bf8046968, tables=3, cond=0x7f6bf8050718, normal_tables=18446744073709551615, select_lex=0x7f6bf80172e0, sargables=0x7f6c09bcfb18) at /data/src/10.3/sql/sql_select.cc:5683
      #5  0x00005617ac90edb3 in JOIN::reoptimize (this=0x7f6bf803fa38, added_where=0x7f6bf8050718, join_tables=7, save_to=0x0) at /data/src/10.3/sql/sql_select.cc:25939
      #6  0x00005617ac8e3324 in JOIN::push_splitting_cond_into_derived (this=0x7f6bf803fa38, thd=0x7f6bf8000b00, cond=0x7f6bf8050718) at /data/src/10.3/sql/sql_select.cc:9078
      #7  0x00005617ac8e34b1 in JOIN::improve_chosen_plan (this=0x7f6bf803eca8, thd=0x7f6bf8000b00) at /data/src/10.3/sql/sql_select.cc:9105
      #8  0x00005617ac8d7899 in make_join_statistics (join=0x7f6bf803eca8, tables_list=..., keyuse_array=0x7f6bf803ef98) at /data/src/10.3/sql/sql_select.cc:4516
      #9  0x00005617ac8ccd3c in JOIN::optimize_inner (this=0x7f6bf803eca8) at /data/src/10.3/sql/sql_select.cc:1528
      #10 0x00005617ac8cb6f4 in JOIN::optimize (this=0x7f6bf803eca8) at /data/src/10.3/sql/sql_select.cc:1123
      #11 0x00005617ac8d479e in mysql_select (thd=0x7f6bf8000b00, tables=0x7f6bf8014c30, wild_num=1, fields=..., conds=0x7f6bf8016600, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f6bf801a938, unit=0x7f6bf80047c0, select_lex=0x7f6bf8004f00) at /data/src/10.3/sql/sql_select.cc:3723
      #12 0x00005617ac8c8dbc in handle_select (thd=0x7f6bf8000b00, lex=0x7f6bf80046f8, result=0x7f6bf801a938, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:378
      #13 0x00005617ac89426e in execute_sqlcom_select (thd=0x7f6bf8000b00, all_tables=0x7f6bf8014c30) at /data/src/10.3/sql/sql_parse.cc:6466
      #14 0x00005617ac88a7ef in mysql_execute_command (thd=0x7f6bf8000b00) at /data/src/10.3/sql/sql_parse.cc:3731
      #15 0x00005617ac897bd4 in mysql_parse (thd=0x7f6bf8000b00, rawbuf=0x7f6bf8014a08 "SELECT * FROM t3 WHERE c IN ( SELECT val FROM v )", length=49, parser_state=0x7f6c09bd1610, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7921
      #16 0x00005617ac88532e in dispatch_command (command=COM_QUERY, thd=0x7f6bf8000b00, packet=0x7f6bf800af11 "SELECT * FROM t3 WHERE c IN ( SELECT val FROM v ) ", packet_length=50, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1819
      #17 0x00005617ac883d90 in do_command (thd=0x7f6bf8000b00) at /data/src/10.3/sql/sql_parse.cc:1370
      #18 0x00005617ac9da646 in do_handle_one_connection (connect=0x5617afd31500) at /data/src/10.3/sql/sql_connect.cc:1418
      #19 0x00005617ac9da3d3 in handle_one_connection (arg=0x5617afd31500) at /data/src/10.3/sql/sql_connect.cc:1324
      #20 0x00005617ace521dc in pfs_spawn_thread (arg=0x5617afdd1f00) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #21 0x00007f6c1187f494 in start_thread (arg=0x7f6c09bd2700) at pthread_create.c:333
      #22 0x00007f6c0f9f793f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Non-debug crashes in a similar way.

      The problem appeared in bb-10.2-ext and later in 10.3 tree with this revision:

      commit bf75dcac89d1496032015526dc6ce78d327e329f
      Author: Igor Babaev <igor@askmonty.org>
      Date:   Thu Aug 10 14:25:19 2017 -0700
       
          This is a modification of the first patch committed for mdev-13369
          developed to cover the case of mdev-13389: "Optimization for equi-joins
          of derived tables with window functions".
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              igor Igor Babaev
              Reporter:
              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.