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

Server crashes in get_quick_keys with not_null_range_scan

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.5
    • 10.5.1
    • Optimizer
    • None

    Description

      CREATE TABLE t1 (a INT, KEY(a));
      INSERT INTO t1 VALUES (8),(9);
       
      CREATE TABLE t2 (pk INT, b INT, PRIMARY KEY(pk));
      INSERT INTO t2 VALUES (1,1),(2,2);
       
      SET optimizer_switch = 'not_null_range_scan=on';
      SELECT * FROM t1 LEFT JOIN t2 ON a = pk WHERE b >= 0 AND pk IS NULL;
       
      # Cleanup
      DROP TABLE t1, t2;
      

      10.5 8b97eba3

      #3  <signal handler called>
      #4  0x00005562be8e180d in get_quick_keys (param=0x7f35ed6f39f0, quick=0x7f35dc0783a0, key=0x7f35dc0773c8, key_tree=0x0, min_key=0x7f35dc0773f0 "\245\245\245\245\245\245\217\217\245\245\245\245\245\245\217\217\003", min_key_flag=0, max_key=0x7f35dc0773f8 "\245\245\245\245\245\245\217\217\003", max_key_flag=0) at /data/src/10.5/sql/opt_range.cc:11291
      #5  0x00005562be8e186a in get_quick_keys (param=0x7f35ed6f39f0, quick=0x7f35dc0783a0, key=0x7f35dc0773c8, key_tree=0x5562bfea0bc0 <null_element>, min_key=0x7f35dc0773f0 "\245\245\245\245\245\245\217\217\245\245\245\245\245\245\217\217\003", min_key_flag=0, max_key=0x7f35dc0773f8 "\245\245\245\245\245\245\217\217\003", max_key_flag=0) at /data/src/10.5/sql/opt_range.cc:11296
      #6  0x00005562be8e169d in get_quick_select (param=0x7f35ed6f39f0, idx=0, key_tree=0x5562bfea0bc0 <null_element>, mrr_flags=32565, mrr_buf_size=3191248429, parent_alloc=0x0) at /data/src/10.5/sql/opt_range.cc:11259
      #7  0x00005562be8f08e4 in TRP_RANGE::make_quick (this=0x7f35dc077668, param=0x7f35ed6f39f0, retrieve_full_rows=true, parent_alloc=0x0) at /data/src/10.5/sql/opt_range.cc:2246
      #8  0x00005562be8cca45 in SQL_SELECT::test_quick_select (this=0x7f35dc073440, thd=0x7f35dc000b00, keys_to_use=..., prev_tables=0, limit=18446744073709551615, force_quick_range=false, ordered_output=false, remove_false_parts_of_where=true, only_single_index_range_scan=false) at /data/src/10.5/sql/opt_range.cc:3007
      #9  0x00005562be44f696 in get_quick_record_count (thd=0x7f35dc000b00, select=0x7f35dc073440, table=0x7f35dc130b30, keys=0x7f35dc017930, limit=18446744073709551615) at /data/src/10.5/sql/sql_select.cc:4706
      #10 0x00005562be451ea4 in make_join_statistics (join=0x7f35dc0166b8, tables_list=..., keyuse_array=0x7f35dc0169a8) at /data/src/10.5/sql/sql_select.cc:5431
      #11 0x00005562be4465c8 in JOIN::optimize_inner (this=0x7f35dc0166b8) at /data/src/10.5/sql/sql_select.cc:2258
      #12 0x00005562be443ece in JOIN::optimize (this=0x7f35dc0166b8) at /data/src/10.5/sql/sql_select.cc:1604
      #13 0x00005562be44f35f in mysql_select (thd=0x7f35dc000b00, tables=0x7f35dc013ba8, fields=..., conds=0x7f35dc015c48, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f35dc016690, unit=0x7f35dc004a50, select_lex=0x7f35dc0135b8) at /data/src/10.5/sql/sql_select.cc:4648
      #14 0x00005562be43ef88 in handle_select (thd=0x7f35dc000b00, lex=0x7f35dc004990, result=0x7f35dc016690, setup_tables_done_option=0) at /data/src/10.5/sql/sql_select.cc:428
      #15 0x00005562be4049c1 in execute_sqlcom_select (thd=0x7f35dc000b00, all_tables=0x7f35dc013ba8) at /data/src/10.5/sql/sql_parse.cc:6219
      #16 0x00005562be3faa40 in mysql_execute_command (thd=0x7f35dc000b00) at /data/src/10.5/sql/sql_parse.cc:3904
      #17 0x00005562be409682 in mysql_parse (thd=0x7f35dc000b00, rawbuf=0x7f35dc0134c8 "SELECT * FROM t1 LEFT JOIN t2 ON a = pk WHERE b >= 0 AND pk IS NULL", length=67, parser_state=0x7f35ed6f5570, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7988
      #18 0x00005562be3f4741 in dispatch_command (command=COM_QUERY, thd=0x7f35dc000b00, packet=0x7f35dc008461 "SELECT * FROM t1 LEFT JOIN t2 ON a = pk WHERE b >= 0 AND pk IS NULL", packet_length=67, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1846
      #19 0x00005562be3f2e9b in do_command (thd=0x7f35dc000b00) at /data/src/10.5/sql/sql_parse.cc:1364
      #20 0x00005562be593469 in do_handle_one_connection (connect=0x5562c21a71f0, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1422
      #21 0x00005562be593198 in handle_one_connection (arg=0x5562c21a71f0) at /data/src/10.5/sql/sql_connect.cc:1319
      #22 0x00005562beaef0fb in pfs_spawn_thread (arg=0x5562c21279a0) at /data/src/10.5/storage/perfschema/pfs.cc:1869
      #23 0x00007f35f4cd24a4 in start_thread (arg=0x7f35ed6f6700) at pthread_create.c:456
      #24 0x00007f35f2e06d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      EXPLAIN also crashes.

      Reproducible with at least MyISAM and InnoDB.
      Reproducible both on debug and non-debug builds.

      Attachments

        Issue Links

          Activity

            People

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