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

Assertion `d >= 0' failed in COST_ADD with join_cache_level > 2 and partitions

    XMLWordPrintable

Details

    Description

      --source include/have_partition.inc
       
      SET join_cache_level= 3;
       
      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (1),(2);
      CREATE TABLE t2 (b INT, c INT);
      INSERT INTO t2 VALUES (3,4),(5,6);
      CREATE TABLE t3 (d INT, e INT) PARTITION BY RANGE COLUMNS (d) (p1 VALUES LESS THAN (1000), pn VALUES LESS THAN (MAXVALUE));
      ANALYZE TABLE t1, t2, t3 PERSISTENT FOR ALL;
       
      SELECT * FROM t1 LEFT JOIN (t2 JOIN t3 ON t2.b = t3.e) ON t2.c = 1;
       
      # Cleanup
      DROP TABLE t1, t2, t3;
      

      11.0 f2b4972b

      mariadbd: /data/src/11.0/sql/optimizer_costs.h:133: double COST_ADD(double, double): Assertion `d >= 0' failed.
      230807 16:10:58 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007f79c0453df2 in __GI___assert_fail (assertion=0x558bbe975e20 "d >= 0", file=0x558bbe975d80 "/data/src/11.0/sql/optimizer_costs.h", line=133, function=0x558bbe975de0 "double COST_ADD(double, double)") at ./assert/assert.c:101
      #10 0x0000558bbc9c0b48 in COST_ADD (c=0.02, d=-nan(0x8000000000000)) at /data/src/11.0/sql/optimizer_costs.h:133
      #11 0x0000558bbca129bb in best_access_path (join=0x629000285420, s=0x62900028ab28, remaining_tables=4, join_positions=0x62900028b1f8, idx=2, disable_jbuf=false, record_count=2, pos=0x62900028bf20, loose_scan_pos=0x62900028c070) at /data/src/11.0/sql/sql_select.cc:9196
      #12 0x0000558bbca1e3e0 in get_costs_for_tables (join=0x629000285420, remaining_tables=4, idx=2, record_count=2, trace_one_table=0x7f79b8d53e60, pos=0x62900028b1a8, store_position=0x7f79b8d53d80, allowed_tables=0x7f79b8d53dc0, stop_on_eq_ref=false) at /data/src/11.0/sql/sql_select.cc:11116
      #13 0x0000558bbca1f69f in best_extension_by_limited_search (join=0x629000285420, remaining_tables=4, idx=2, record_count=2, read_time=0.03104523, search_depth=60, use_cond_selectivity=4, processed_eq_ref_tables=0x7f79b8d54180) at /data/src/11.0/sql/sql_select.cc:11373
      #14 0x0000558bbca21130 in best_extension_by_limited_search (join=0x629000285420, remaining_tables=6, idx=1, record_count=2, read_time=0.010348410000000001, search_depth=61, use_cond_selectivity=4, processed_eq_ref_tables=0x7f79b8d545a0) at /data/src/11.0/sql/sql_select.cc:11599
      #15 0x0000558bbca21130 in best_extension_by_limited_search (join=0x629000285420, remaining_tables=7, idx=0, record_count=1, read_time=0, search_depth=62, use_cond_selectivity=4, processed_eq_ref_tables=0x7f79b8d54880) at /data/src/11.0/sql/sql_select.cc:11599
      #16 0x0000558bbca1a0f4 in greedy_search (join=0x629000285420, remaining_tables=7, search_depth=62, use_cond_selectivity=4) at /data/src/11.0/sql/sql_select.cc:10344
      #17 0x0000558bbca17b52 in choose_plan (join=0x629000285420, join_tables=7, emb_sjm_nest=0x0) at /data/src/11.0/sql/sql_select.cc:9863
      #18 0x0000558bbc9fd7ed in make_join_statistics (join=0x629000285420, tables_list=..., keyuse_array=0x629000285788) at /data/src/11.0/sql/sql_select.cc:6119
      #19 0x0000558bbc9d92b2 in JOIN::optimize_inner (this=0x629000285420) at /data/src/11.0/sql/sql_select.cc:2607
      #20 0x0000558bbc9d231f in JOIN::optimize (this=0x629000285420) at /data/src/11.0/sql/sql_select.cc:1935
      #21 0x0000558bbc9f3db3 in mysql_select (thd=0x62b00007e218, tables=0x6290000e6988, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x6290002853f0, unit=0x62b000082698, select_lex=0x6290000e6330) at /data/src/11.0/sql/sql_select.cc:5168
      #22 0x0000558bbc9c3ac2 in handle_select (thd=0x62b00007e218, lex=0x62b0000825c0, result=0x6290002853f0, setup_tables_done_option=0) at /data/src/11.0/sql/sql_select.cc:626
      #23 0x0000558bbc8eacbe in execute_sqlcom_select (thd=0x62b00007e218, all_tables=0x6290000e6988) at /data/src/11.0/sql/sql_parse.cc:6279
      #24 0x0000558bbc8d910c in mysql_execute_command (thd=0x62b00007e218, is_called_from_prepared_stmt=false) at /data/src/11.0/sql/sql_parse.cc:3949
      #25 0x0000558bbc8f5720 in mysql_parse (thd=0x62b00007e218, rawbuf=0x6290000e6238 "SELECT * FROM t1 LEFT JOIN (t2 JOIN t3 ON t2.b = t3.e) ON t2.c = 1", length=66, parser_state=0x7f79b8d569e0) at /data/src/11.0/sql/sql_parse.cc:8019
      #26 0x0000558bbc8cb6a8 in dispatch_command (command=COM_QUERY, thd=0x62b00007e218, packet=0x629000258219 "SELECT * FROM t1 LEFT JOIN (t2 JOIN t3 ON t2.b = t3.e) ON t2.c = 1", packet_length=66, blocking=true) at /data/src/11.0/sql/sql_parse.cc:1894
      #27 0x0000558bbc8c83c1 in do_command (thd=0x62b00007e218, blocking=true) at /data/src/11.0/sql/sql_parse.cc:1407
      #28 0x0000558bbcd8bf1c in do_handle_one_connection (connect=0x608000002d38, put_in_cache=true) at /data/src/11.0/sql/sql_connect.cc:1416
      #29 0x0000558bbcd8b8dd in handle_one_connection (arg=0x608000002cb8) at /data/src/11.0/sql/sql_connect.cc:1318
      #30 0x0000558bbd964f2c in pfs_spawn_thread (arg=0x617000005b98) at /data/src/11.0/storage/perfschema/pfs.cc:2201
      #31 0x00007f79c04a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #32 0x00007f79c05285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The failure belongs to 11.x with optimizer costs.

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              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.