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

Assertion `join->best_read < double(1.7...e+308L)' failed in greedy_search / choose_plan / 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

      Note: The test case is similar to MDEV-13709, and the problem appeared around the same time, so it might well be a duplicate. But the crash and the introducing revision are different, so I'm filing it separately just in case.

      CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (9),(5),(1);
       
      CREATE TABLE t2 (b INT) ENGINE=MyISAM;
       
      CREATE TABLE t3 (c VARCHAR(8), d INT) ENGINE=MyISAM;
      INSERT INTO t3 VALUES ('foo',2),('bar',6);
       
      CREATE OR REPLACE VIEW v AS SELECT a FROM t1, t2 GROUP BY a;
       
      SELECT * FROM t3 WHERE d IN ( SELECT * FROM v ) AND c LIKE 'z%' OR c IS NULL ;
      

      10.3 016c35a7f2f4a288542f5fcb0e182c05238398e6

      mysqld: /data/src/10.3/sql/sql_select.cc:7429: bool greedy_search(JOIN*, table_map, uint, uint, uint): Assertion `join->best_read < double(1.79769313486231570815e+308L)' failed.
      170902  1:27:18 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f337e4d7ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000055ea73ed736a in greedy_search (join=0x7f336803bce8, remaining_tables=2, search_depth=62, prune_level=1, use_cond_selectivity=1) at /data/src/10.3/sql/sql_select.cc:7429
      #9  0x000055ea73ed67d4 in choose_plan (join=0x7f336803bce8, join_tables=2) at /data/src/10.3/sql/sql_select.cc:6999
      #10 0x000055ea73f0702d in JOIN::reoptimize (this=0x7f336803bce8, added_where=0x7f3368043330, join_tables=2, save_to=0x0) at /data/src/10.3/sql/sql_select.cc:25994
      #11 0x000055ea73edb324 in JOIN::push_splitting_cond_into_derived (this=0x7f336803bce8, thd=0x7f3368000b00, cond=0x7f3368043330) at /data/src/10.3/sql/sql_select.cc:9078
      #12 0x000055ea73edb4b1 in JOIN::improve_chosen_plan (this=0x7f336803b790, thd=0x7f3368000b00) at /data/src/10.3/sql/sql_select.cc:9105
      #13 0x000055ea73ecf899 in make_join_statistics (join=0x7f336803b790, tables_list=..., keyuse_array=0x7f336803ba80) at /data/src/10.3/sql/sql_select.cc:4516
      #14 0x000055ea73ec4d3c in JOIN::optimize_inner (this=0x7f336803b790) at /data/src/10.3/sql/sql_select.cc:1528
      #15 0x000055ea73ec36f4 in JOIN::optimize (this=0x7f336803b790) at /data/src/10.3/sql/sql_select.cc:1123
      #16 0x000055ea73e67039 in st_select_lex::optimize_unflattened_subqueries (this=0x7f3368004f00, const_only=false) at /data/src/10.3/sql/sql_lex.cc:3922
      #17 0x000055ea74031714 in JOIN::optimize_unflattened_subqueries (this=0x7f336803b238) at /data/src/10.3/sql/opt_subselect.cc:5130
      #18 0x000055ea73ec6b40 in JOIN::optimize_stage2 (this=0x7f336803b238) at /data/src/10.3/sql/sql_select.cc:2052
      #19 0x000055ea73ec4e08 in JOIN::optimize_inner (this=0x7f336803b238) at /data/src/10.3/sql/sql_select.cc:1541
      #20 0x000055ea73ec36f4 in JOIN::optimize (this=0x7f336803b238) at /data/src/10.3/sql/sql_select.cc:1123
      #21 0x000055ea73ecc79e in mysql_select (thd=0x7f3368000b00, tables=0x7f3368014c68, wild_num=1, fields=..., conds=0x7f3368016ef8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f336801a498, unit=0x7f33680047c0, select_lex=0x7f3368004f00) at /data/src/10.3/sql/sql_select.cc:3723
      #22 0x000055ea73ec0dbc in handle_select (thd=0x7f3368000b00, lex=0x7f33680046f8, result=0x7f336801a498, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:378
      #23 0x000055ea73e8c26e in execute_sqlcom_select (thd=0x7f3368000b00, all_tables=0x7f3368014c68) at /data/src/10.3/sql/sql_parse.cc:6466
      #24 0x000055ea73e827ef in mysql_execute_command (thd=0x7f3368000b00) at /data/src/10.3/sql/sql_parse.cc:3731
      #25 0x000055ea73e8fbd4 in mysql_parse (thd=0x7f3368000b00, rawbuf=0x7f3368014a08 "SELECT * FROM t3 WHERE d IN ( SELECT * FROM v ) AND c LIKE 'z%' OR c IS NULL", length=76, parser_state=0x7f337876e610, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7921
      #26 0x000055ea73e7d32e in dispatch_command (command=COM_QUERY, thd=0x7f3368000b00, packet=0x7f336800af11 "SELECT * FROM t3 WHERE d IN ( SELECT * FROM v ) AND c LIKE 'z%' OR c IS NULL ", packet_length=77, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1819
      #27 0x000055ea73e7bd90 in do_command (thd=0x7f3368000b00) at /data/src/10.3/sql/sql_parse.cc:1370
      #28 0x000055ea73fd2646 in do_handle_one_connection (connect=0x55ea77ca04f0) at /data/src/10.3/sql/sql_connect.cc:1418
      #29 0x000055ea73fd23d3 in handle_one_connection (arg=0x55ea77ca04f0) at /data/src/10.3/sql/sql_connect.cc:1324
      #30 0x000055ea7444a1dc in pfs_spawn_thread (arg=0x55ea77d40ef0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #31 0x00007f338041c494 in start_thread (arg=0x7f337876f700) at pthread_create.c:333
      #32 0x00007f337e59493f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      No visible problem on a non-debug build.

      The failure appeared in bb-10.2-ext / 10.3 trees with this revision:

      commit b14e2b044b6483f22d9c33e6697479fbd859f747
      Author: Igor Babaev <igor@askmonty.org>
      Date:   Thu Aug 3 21:19:19 2017 -0700
       
          This first patch prepared for the task MDEV-13369:
          "Optimization for equi-joins of derived tables with GROUP BY"
          should be considered rather as a 'proof of concept'.
      

        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.