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

Assertion failure in best_access_path upon IN exceeding IN_PREDICATE_CONVERSION_THRESHOLD, derived_with_keys=off

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • N/A
    • 11.0.0
    • Optimizer
    • None

    Description

      CREATE TABLE lineitem (l_orderkey int);
      INSERT INTO lineitem VALUES (1),(2);
      CREATE TABLE orders (o_orderkey int);
      INSERT INTO orders VALUES (3),(4);
       
      SET IN_PREDICATE_CONVERSION_THRESHOLD= 2;
      SET OPTIMIZER_SWITCH= 'derived_with_keys=off';
       
      SELECT * FROM lineitem JOIN orders ON (l_orderkey = o_orderkey) WHERE l_orderkey IN (1, 2, 3);
       
      # Cleanup
      DROP TABLE lineitem, orders;
      

      bb-11.0 1a09c9bef8aa

      mariadbd: /data/src/bb-11.0/sql/sql_select.cc:8768: void best_access_path(JOIN*, JOIN_TAB*, table_map, const POSITION*, uint, bool, double, POSITION*, POSITION*): Assertion `(key_dependent & (s->key_dependent | s->embedded_dependent)) == key_dependent' failed.
      221227 23:01:34 [ERROR] mysqld got signal 6 ;
       
      #8  0x0000560feb9ba286 in best_access_path (join=0x6290000e9440, s=0x62900026d278, remaining_tables=7, join_positions=0x62900026d8b0, idx=0, disable_jbuf=true, record_count=1, pos=0x62900026e1f0, loose_scan_pos=0x62900026e318) at /data/src/bb-11.0/sql/sql_select.cc:8768
      #9  0x0000560feb9c9321 in get_costs_for_tables (join=0x6290000e9440, remaining_tables=7, idx=0, record_count=1, trace_one_table=0x7f60d551c770, pos=0x62900026d870, store_position=0x7f60d551c690, allowed_tables=0x7f60d551c6d0, stop_on_eq_ref=false) at /data/src/bb-11.0/sql/sql_select.cc:10705
      #10 0x0000560feb9cacfb in best_extension_by_limited_search (join=0x6290000e9440, remaining_tables=7, idx=0, record_count=1, read_time=0, search_depth=62, use_cond_selectivity=4, processed_eq_ref_tables=0x7f60d551c950) at /data/src/bb-11.0/sql/sql_select.cc:10962
      #11 0x0000560feb9c3aa8 in greedy_search (join=0x6290000e9440, remaining_tables=7, search_depth=62, use_cond_selectivity=4) at /data/src/bb-11.0/sql/sql_select.cc:9933
      #12 0x0000560feb9c0873 in choose_plan (join=0x6290000e9440, join_tables=7, emb_sjm_nest=0x0) at /data/src/bb-11.0/sql/sql_select.cc:9454
      #13 0x0000560feb9a015e in make_join_statistics (join=0x6290000e9440, tables_list=..., keyuse_array=0x6290000e9798) at /data/src/bb-11.0/sql/sql_select.cc:6053
      #14 0x0000560feb970dd6 in JOIN::optimize_inner (this=0x6290000e9440) at /data/src/bb-11.0/sql/sql_select.cc:2568
      #15 0x0000560feb967963 in JOIN::optimize (this=0x6290000e9440) at /data/src/bb-11.0/sql/sql_select.cc:1899
      #16 0x0000560feb993ad2 in mysql_select (thd=0x62b00007e218, tables=0x6290000e6988, fields=..., conds=0x6290000e8900, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x6290000e9410, unit=0x62b000082670, select_lex=0x6290000e6360) at /data/src/bb-11.0/sql/sql_select.cc:5112
      #17 0x0000560feb9548ee in handle_select (thd=0x62b00007e218, lex=0x62b000082598, result=0x6290000e9410, setup_tables_done_option=0) at /data/src/bb-11.0/sql/sql_select.cc:609
      #18 0x0000560feb81eb88 in execute_sqlcom_select (thd=0x62b00007e218, all_tables=0x6290000e6988) at /data/src/bb-11.0/sql/sql_parse.cc:6263
      #19 0x0000560feb802591 in mysql_execute_command (thd=0x62b00007e218, is_called_from_prepared_stmt=false) at /data/src/bb-11.0/sql/sql_parse.cc:3947
      #20 0x0000560feb82e0e7 in mysql_parse (thd=0x62b00007e218, rawbuf=0x6290000e6238 "SELECT * FROM lineitem JOIN orders ON (l_orderkey = o_orderkey) WHERE l_orderkey IN (1, 2, 3)", length=93, parser_state=0x7f60d551ea40) at /data/src/bb-11.0/sql/sql_parse.cc:7998
      #21 0x0000560feb7ee374 in dispatch_command (command=COM_QUERY, thd=0x62b00007e218, packet=0x629000253219 "SELECT * FROM lineitem JOIN orders ON (l_orderkey = o_orderkey) WHERE l_orderkey IN (1, 2, 3)", packet_length=93, blocking=true) at /data/src/bb-11.0/sql/sql_parse.cc:1894
      #22 0x0000560feb7e977c in do_command (thd=0x62b00007e218, blocking=true) at /data/src/bb-11.0/sql/sql_parse.cc:1407
      #23 0x0000560febe71828 in do_handle_one_connection (connect=0x608000002638, put_in_cache=true) at /data/src/bb-11.0/sql/sql_connect.cc:1415
      #24 0x0000560febe70e16 in handle_one_connection (arg=0x6080000025b8) at /data/src/bb-11.0/sql/sql_connect.cc:1317
      #25 0x0000560feceeb092 in pfs_spawn_thread (arg=0x617000004d98) at /data/src/bb-11.0/storage/perfschema/pfs.cc:2201
      #26 0x00007f60df0eaea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #27 0x00007f60decd9aef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      The test case is scalable in regard to IN_PREDICATE_CONVERSION_THRESHOLD (the IN list just has to be longer than the value).

      Not reproducible on the baseline.

      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.