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

Server crashes in ha_partition::index_blocks / get_key_scans_params

    XMLWordPrintable

Details

    Description

      Set to blocker because it's a recent regression in GA, otherwise it could have been ranked down as a corner case.
      See also MDEV-31445. They must be related, but I'm not sure both would be fixed by the same patch, so I'm filing this one separately.

      --source include/have_partition.inc
       
      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (1),(2);
       
      CREATE TABLE t2 (b INT, c INT, KEY(c)) PARTITION BY LIST (b) (PARTITION p0 VALUES IN (1,2), PARTITION p1 VALUES IN (3,4));
      INSERT INTO t2 VALUES (1,1),(2,2);
       
      SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE t2.b = 5 AND t2.c = 10;
       
      # Cleanup
      DROP TABLE t1, t2;
      

      11.0 5fb2c031

      #3  <signal handler called>
      #4  0x00005641f0d4bd92 in ha_partition::index_blocks (this=0x61d000258ab8, index=0, ranges=1, rows=0) at /data/src/11.0/sql/ha_partition.cc:12207
      #5  0x00005641ef966ae8 in check_quick_select (param=0x7f882ea67310, idx=0, limit=18446744073709551615, index_only=false, tree=0x621000111e30, update_tbl_stats=true, mrr_flags=0x7f882ea66980, bufsize=0x7f882ea66990, cost=0x7f882ea66aa0, is_ror_scan=0x7f882ea66970) at /data/src/11.0/sql/opt_range.cc:11972
      #6  0x00005641ef94a86d in get_key_scans_params (param=0x7f882ea67310, tree=0x621000111d90, index_read_must_be_used=false, for_range_access=true, read_time=0.02, limit=18446744073709551615, using_table_scan=true) at /data/src/11.0/sql/opt_range.cc:7762
      #7  0x00005641ef92c7b8 in SQL_SELECT::test_quick_select (this=0x62900028c9e8, thd=0x62b00007e218, 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/11.0/sql/opt_range.cc:2975
      #8  0x00005641efdc5b67 in get_quick_record_count (thd=0x62b00007e218, select=0x62900028c9e8, table=0x6190000a0a98, keys=0x62900028abe8, limit=18446744073709551615) at /data/src/11.0/sql/sql_select.cc:5226
      #9  0x00005641efdcd097 in make_join_statistics (join=0x6290000e9340, tables_list=..., keyuse_array=0x6290000e96a8) at /data/src/11.0/sql/sql_select.cc:5993
      #10 0x00005641efdaa7d8 in JOIN::optimize_inner (this=0x6290000e9340) at /data/src/11.0/sql/sql_select.cc:2607
      #11 0x00005641efda3845 in JOIN::optimize (this=0x6290000e9340) at /data/src/11.0/sql/sql_select.cc:1935
      #12 0x00005641efdc52d9 in mysql_select (thd=0x62b00007e218, tables=0x6290000e6978, fields=..., conds=0x6290000e8868, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x6290000e9310, unit=0x62b000082660, select_lex=0x6290000e6320) at /data/src/11.0/sql/sql_select.cc:5168
      #13 0x00005641efd94fe8 in handle_select (thd=0x62b00007e218, lex=0x62b000082588, result=0x6290000e9310, setup_tables_done_option=0) at /data/src/11.0/sql/sql_select.cc:626
      #14 0x00005641efcba74e in execute_sqlcom_select (thd=0x62b00007e218, all_tables=0x6290000e6978) at /data/src/11.0/sql/sql_parse.cc:6279
      #15 0x00005641efca8b75 in mysql_execute_command (thd=0x62b00007e218, is_called_from_prepared_stmt=false) at /data/src/11.0/sql/sql_parse.cc:3949
      #16 0x00005641efcc51fe in mysql_parse (thd=0x62b00007e218, rawbuf=0x6290000e6238 "SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE t2.b = 5 AND t2.c = 10", length=62, parser_state=0x7f882ea69a20) at /data/src/11.0/sql/sql_parse.cc:8014
      #17 0x00005641efc9b0ea in dispatch_command (command=COM_QUERY, thd=0x62b00007e218, packet=0x629000258219 "SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE t2.b = 5 AND t2.c = 10", packet_length=62, blocking=true) at /data/src/11.0/sql/sql_parse.cc:1894
      #18 0x00005641efc97e03 in do_command (thd=0x62b00007e218, blocking=true) at /data/src/11.0/sql/sql_parse.cc:1407
      #19 0x00005641f0161336 in do_handle_one_connection (connect=0x608000002d38, put_in_cache=true) at /data/src/11.0/sql/sql_connect.cc:1416
      #20 0x00005641f0160cf7 in handle_one_connection (arg=0x608000002cb8) at /data/src/11.0/sql/sql_connect.cc:1318
      #21 0x00005641f0d58a1c in pfs_spawn_thread (arg=0x617000005b98) at /data/src/11.0/storage/perfschema/pfs.cc:2201
      #22 0x00007f88362a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #23 0x00007f88363285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The failure started happening after this commit in 11.0:

      commit 07b02ab40ecdbdf09dc9b975e9efe5a1bea0f133
      Author: Monty
      Date:   Fri May 26 17:26:42 2023 +0300
       
          MDEV-31356: Range cost calculations does not take into account join_buffer
      

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.