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

Assertion failure: prev_range_last_block_records < stats.block_size

Details

    • Bug
    • Status: Stalled (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.5, 10.6, 10.11, 11.4, 11.7(EOL), 11.8
    • 10.5, 10.6, 10.11, 11.4
    • Optimizer
    • None

    Description

      The following .test file

      create table t1 (
      kp1 int,
      kp2 int,
      kp3 int,
      kp4 int,
      key key1(kp1, kp2, kp3,kp4)
      );
      insert into t1 values (1,1,1,1),(2,2,2,2),(3,3,3,3);
      explain select * from t1 where 
      kp1 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) and
      kp2 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) and
      kp3 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
      

      fails an assertion:

      mariadbd: /home/psergey/dev-git/10.5-mdev9750/sql/multi_range_read.cc:221: virtual ha_rows handler::multi_range_read_info_const(uint, RANGE_SEQ_IF*, void*, uint, uint*, uint*, Cost_estimate*): Assertion `prev_range_last_block_records < stats.block_size' failed.
      ...
      #7  0x00007fefab7b1502 in __GI___assert_fail (assertion=0x55adadc42e38 "prev_range_last_block_records < stats.block_size", file=0x55adadc42de0 "/home/psergey/dev-git/10.5-mdev9750/sql/multi_range_read.cc", line=221, function=0x55adadc43380 <handler::multi_range_read_info_const(unsigned int, st_range_seq_if*, void*, unsigned int, unsigned int*, unsigned int*, Cost_estimate*)::__PRETTY_FUNCTION__> "virtual ha_rows handler::multi_range_read_info_const(uint, RANGE_SEQ_IF*, void*, uint, uint*, uint*, Cost_estimate*)") at assert.c:101
      #8  0x000055adad0190b3 in handler::multi_range_read_info_const (this=0x7fef940fa8b0, keyno=0, seq=0x7fefa6344070, seq_init_param=0x7fefa63440a0, n_ranges_arg=0, bufsz=0x7fefa6343f84, flags=0x7fefa6343f80, cost=0x7fefa6344720) at /home/psergey/dev-git/10.5-mdev9750/sql/multi_range_read.cc:220
      #9  0x000055adad01cc78 in DsMrr_impl::dsmrr_info_const (this=0x7fef940fadb0, keyno=0, seq=0x7fefa6344070, seq_init_param=0x7fefa63440a0, n_ranges=0, bufsz=0x7fefa6344638, flags=0x7fefa6344634, cost=0x7fefa6344720) at /home/psergey/dev-git/10.5-mdev9750/sql/multi_range_read.cc:1708
      #10 0x000055adada2a6d9 in ha_myisam::multi_range_read_info_const (this=0x7fef940fa8b0, keyno=0, seq=0x7fefa6344070, seq_init_param=0x7fefa63440a0, n_ranges=0, bufsz=0x7fefa6344638, flags=0x7fefa6344634, cost=0x7fefa6344720) at /home/psergey/dev-git/10.5-mdev9750/storage/myisam/ha_myisam.cc:2600
      #11 0x000055adad324b17 in check_quick_select (param=0x7fefa63449b0, idx=0, index_only=true, tree=0x7fef9405b328, update_tbl_stats=true, mrr_flags=0x7fefa6344634, bufsize=0x7fefa6344638, cost=0x7fefa6344720, is_ror_scan=0x7fefa6344632) at /home/psergey/dev-git/10.5-mdev9750/sql/opt_range.cc:11476
      #12 0x000055adad31a70c in get_key_scans_params (param=0x7fefa63449b0, tree=0x7fef9405abd8, index_read_must_be_used=false, for_range_access=true, read_time=1.6039541127654382) at /home/psergey/dev-git/10.5-mdev9750/sql/opt_range.cc:7461
      #13 0x000055adad30efb4 in SQL_SELECT::test_quick_select (this=0x7fef94058c98, thd=0x7fef94000d78, 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 /home/psergey/dev-git/10.5-mdev9750/sql/opt_range.cc:2931
      #14 0x000055adace7023f in get_quick_record_count (thd=0x7fef94000d78, select=0x7fef94058c98, table=0x7fef94223838, keys=0x7fef94057b38, limit=18446744073709551615) at /home/psergey/dev-git/10.5-mdev9750/sql/sql_select.cc:4763
      #15 0x000055adace72bd1 in make_join_statistics (join=0x7fef94056ab0, tables_list=..., keyuse_array=0x7fef94056da0) at /home/psergey/dev-git/10.5-mdev9750/sql/sql_select.cc:5494
      #16 0x000055adace67046 in JOIN::optimize_inner (this=0x7fef94056ab0) at /home/psergey/dev-git/10.5-mdev9750/sql/sql_select.cc:2255
      #17 0x000055adace64b07 in JOIN::optimize (this=0x7fef94056ab0) at /home/psergey/dev-git/10.5-mdev9750/sql/sql_select.cc:1627
      

      Attachments

        Issue Links

          Activity

            igor, is the code in multi_range_read.cc yours or Monty's ?

            psergei Sergei Petrunia added a comment - igor , is the code in multi_range_read.cc yours or Monty's ?
            alice Alice Sherepa added a comment -

            the same test fails on current 10.5-10.7:

            ./mtr main.range_notembedded --mysqld=--optimizer-switch='not_null_range_scan=on'
            

            10.5 b69191bbb2278fce92b470

            mariadbd: /10.5/src/sql/multi_range_read.cc:220: virtual ha_rows handler::multi_range_read_info_const(uint, RANGE_SEQ_IF*, void*, uint, uint*, uint*, Cost_estimate*): Assertion `prev_range_last_block_records < stats.block_size' failed.
            220222 12:31:02 [ERROR] mysqld got signal 6 ;
             
            Server version: 10.5.16-MariaDB-debug-log
             
            ??:0(__assert_fail)[0x7fad64f50f36]
            sql/multi_range_read.cc:238(handler::multi_range_read_info_const(unsigned int, st_range_seq_if*, void*, unsigned int, unsigned int*, unsigned int*, Cost_estimate*))[0x558fcbb753fb]
            sql/multi_range_read.cc:1708(DsMrr_impl::dsmrr_info_const(unsigned int, st_range_seq_if*, void*, unsigned int, unsigned int*, unsigned int*, Cost_estimate*))[0x558fcbb813d4]
            myisam/ha_myisam.cc:2600(ha_myisam::multi_range_read_info_const(unsigned int, st_range_seq_if*, void*, unsigned int, unsigned int*, unsigned int*, Cost_estimate*))[0x558fcd2a5fae]
            sql/opt_range.cc:11595(check_quick_select(PARAM*, unsigned int, bool, SEL_ARG*, bool, unsigned int*, unsigned int*, Cost_estimate*, bool*))[0x558fcc2ac09e]
            sql/opt_range.cc:7482(get_key_scans_params(PARAM*, SEL_TREE*, bool, bool, double))[0x558fcc29052c]
            sql/opt_range.cc:2933(SQL_SELECT::test_quick_select(THD*, Bitmap<64u>, unsigned long long, unsigned long long, bool, bool, bool, bool))[0x558fcc27319d]
            sql/sql_select.cc:4839(get_quick_record_count(THD*, SQL_SELECT*, TABLE*, Bitmap<64u> const*, unsigned long long))[0x558fcb73c463]
            sql/sql_select.cc:5566(make_join_statistics(JOIN*, List<TABLE_LIST>&, st_dynamic_array*))[0x558fcb743331]
            sql/sql_select.cc:2311(JOIN::optimize_inner())[0x558fcb721d66]
            sql/sql_select.cc:1669(JOIN::optimize())[0x558fcb71b14c]
            sql/sql_select.cc:4781(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x558fcb73bb68]
            sql/sql_select.cc:27551(mysql_explain_union(THD*, st_select_lex_unit*, select_result*))[0x558fcb7e518a]
            sql/sql_parse.cc:6253(execute_sqlcom_select(THD*, TABLE_LIST*))[0x558fcb6745b5]
            sql/sql_parse.cc:4005(mysql_execute_command(THD*))[0x558fcb663e07]
            sql/sql_parse.cc:8100(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x558fcb6801c0]
            sql/sql_parse.cc:1894(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x558fcb65607b]
            sql/sql_parse.cc:1370(do_command(THD*))[0x558fcb6529ba]
            sql/sql_connect.cc:1418(do_handle_one_connection(CONNECT*, bool))[0x558fcba9ea8f]
            sql/sql_connect.cc:1314(handle_one_connection)[0x558fcba9e2a8]
            perfschema/pfs.cc:2203(pfs_spawn_thread)[0x558fcc7c1738]
            nptl/pthread_create.c:478(start_thread)[0x7fad65469609]
            ??:0(clone)[0x7fad6503c293]
             
            Query (0x62b0000382a8): explain select * from t1 where 
            kp1 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) and
            kp2 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) and
            kp3 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) and
            kp4 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
            

            alice Alice Sherepa added a comment - the same test fails on current 10.5-10.7: ./mtr main.range_notembedded --mysqld=--optimizer-switch='not_null_range_scan=on' 10.5 b69191bbb2278fce92b470 mariadbd: /10.5/src/sql/multi_range_read.cc:220: virtual ha_rows handler::multi_range_read_info_const(uint, RANGE_SEQ_IF*, void*, uint, uint*, uint*, Cost_estimate*): Assertion `prev_range_last_block_records < stats.block_size' failed. 220222 12:31:02 [ERROR] mysqld got signal 6 ;   Server version: 10.5.16-MariaDB-debug-log   ??:0(__assert_fail)[0x7fad64f50f36] sql/multi_range_read.cc:238(handler::multi_range_read_info_const(unsigned int, st_range_seq_if*, void*, unsigned int, unsigned int*, unsigned int*, Cost_estimate*))[0x558fcbb753fb] sql/multi_range_read.cc:1708(DsMrr_impl::dsmrr_info_const(unsigned int, st_range_seq_if*, void*, unsigned int, unsigned int*, unsigned int*, Cost_estimate*))[0x558fcbb813d4] myisam/ha_myisam.cc:2600(ha_myisam::multi_range_read_info_const(unsigned int, st_range_seq_if*, void*, unsigned int, unsigned int*, unsigned int*, Cost_estimate*))[0x558fcd2a5fae] sql/opt_range.cc:11595(check_quick_select(PARAM*, unsigned int, bool, SEL_ARG*, bool, unsigned int*, unsigned int*, Cost_estimate*, bool*))[0x558fcc2ac09e] sql/opt_range.cc:7482(get_key_scans_params(PARAM*, SEL_TREE*, bool, bool, double))[0x558fcc29052c] sql/opt_range.cc:2933(SQL_SELECT::test_quick_select(THD*, Bitmap<64u>, unsigned long long, unsigned long long, bool, bool, bool, bool))[0x558fcc27319d] sql/sql_select.cc:4839(get_quick_record_count(THD*, SQL_SELECT*, TABLE*, Bitmap<64u> const*, unsigned long long))[0x558fcb73c463] sql/sql_select.cc:5566(make_join_statistics(JOIN*, List<TABLE_LIST>&, st_dynamic_array*))[0x558fcb743331] sql/sql_select.cc:2311(JOIN::optimize_inner())[0x558fcb721d66] sql/sql_select.cc:1669(JOIN::optimize())[0x558fcb71b14c] sql/sql_select.cc:4781(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x558fcb73bb68] sql/sql_select.cc:27551(mysql_explain_union(THD*, st_select_lex_unit*, select_result*))[0x558fcb7e518a] sql/sql_parse.cc:6253(execute_sqlcom_select(THD*, TABLE_LIST*))[0x558fcb6745b5] sql/sql_parse.cc:4005(mysql_execute_command(THD*))[0x558fcb663e07] sql/sql_parse.cc:8100(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x558fcb6801c0] sql/sql_parse.cc:1894(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x558fcb65607b] sql/sql_parse.cc:1370(do_command(THD*))[0x558fcb6529ba] sql/sql_connect.cc:1418(do_handle_one_connection(CONNECT*, bool))[0x558fcba9ea8f] sql/sql_connect.cc:1314(handle_one_connection)[0x558fcba9e2a8] perfschema/pfs.cc:2203(pfs_spawn_thread)[0x558fcc7c1738] nptl/pthread_create.c:478(start_thread)[0x7fad65469609] ??:0(clone)[0x7fad6503c293]   Query (0x62b0000382a8): explain select * from t1 where kp1 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) and kp2 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) and kp3 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) and kp4 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
            danblack Daniel Black added a comment -

            no longer crashing on 10.5-4a158ec167028060000f4087db69703aab3c42a5 with original test file or ./mtr main.range_notembedded -mysqld=-optimizer-switch='not_null_range_scan=on'.

            danblack Daniel Black added a comment - no longer crashing on 10.5-4a158ec167028060000f4087db69703aab3c42a5 with original test file or ./mtr main.range_notembedded - mysqld= -optimizer-switch='not_null_range_scan=on'.

            Both the test case from the original description and the comment fail as described on all of 10.5-11.8.

            elenst Elena Stepanova added a comment - Both the test case from the original description and the comment fail as described on all of 10.5-11.8.

            People

              monty Michael Widenius
              psergei Sergei Petrunia
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.