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

Assertion `cond_selectivity <= 1.000000001' failed in get_range_limit_read_cost with LIMIT .. OFFSET

    XMLWordPrintable

Details

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

    Description

      CREATE TABLE t1 (a INT, b VARCHAR(1), KEY(b), KEY(a));
      INSERT INTO t1 VALUES
      (3,'a'),(2,'g'),(5,'v'),(9,'n'),(6,'u'),
      (7,'s'),(0,'z'),(3,'z'),(NULL,'m'),(6,'r');
       
      CREATE TABLE t2 (pk INT PRIMARY KEY);
      INSERT INTO t2 VALUES (1),(2);
       
      SELECT STRAIGHT_JOIN pk FROM t1 JOIN t2 ON a = pk WHERE b >= 'A' ORDER BY pk LIMIT 8 OFFSET 1;
       
      # Cleanup
      DROP TABLE t1, t2;
      

      bb-11.0 63f36b2441

      mariadbd: /data/src/bb-11.0/sql/sql_select.cc:30339: bool get_range_limit_read_cost(const POSITION*, const TABLE*, uint, ha_rows, ha_rows, double*, double*): Assertion `cond_selectivity <= 1.000000001' failed.
      230107 15:31:55 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f340f96c662 in __GI___assert_fail (assertion=0x5627dcc807e8 "cond_selectivity <= 1.000000001", file=0x5627dcc7aca8 "/data/src/bb-11.0/sql/sql_select.cc", line=30339, function=0x5627dcc80808 "bool get_range_limit_read_cost(const POSITION*, const TABLE*, uint, ha_rows, ha_rows, double*, double*)") at assert.c:101
      #8  0x00005627db50fd9c in get_range_limit_read_cost (pos=0x7f33f8068e68, table=0x7f33f8227688, keynr=1, rows_limit_arg=9, rows_to_scan=9, read_cost=0x7f340a314120, read_rows=0x7f340a314128) at /data/src/bb-11.0/sql/sql_select.cc:30339
      #9  0x00005627db511a42 in test_if_cheaper_ordering (tab=0x7f33f8069d68, order=0x7f33f8018458, table=0x7f33f8227688, usable_keys=..., ref_key=-1, select_limit_arg=9, new_key=0x7f340a3142e8, new_key_direction=0x7f340a3142f4, new_select_limit=0x7f340a3142b8, new_used_key_parts=0x7f340a3142ec, saved_best_key_parts=0x7f340a3142f0) at /data/src/bb-11.0/sql/sql_select.cc:30699
      #10 0x00005627db4f6038 in test_if_skip_sort_order (tab=0x7f33f8069d68, order=0x7f33f8018458, select_limit=9, no_changes=false, map=0x7f33f8227720) at /data/src/bb-11.0/sql/sql_select.cc:25607
      #11 0x00005627db483ed7 in JOIN::optimize_stage2 (this=0x7f33f8018688) at /data/src/bb-11.0/sql/sql_select.cc:3305
      #12 0x00005627db47f28d in JOIN::optimize_inner (this=0x7f33f8018688) at /data/src/bb-11.0/sql/sql_select.cc:2594
      #13 0x00005627db47a6a0 in JOIN::optimize (this=0x7f33f8018688) at /data/src/bb-11.0/sql/sql_select.cc:1899
      #14 0x00005627db4902bb in mysql_select (thd=0x7f33f8000db8, tables=0x7f33f8015bc0, fields=..., conds=0x7f33f80178b0, og_num=1, order=0x7f33f8018458, group=0x0, having=0x0, proc_param=0x0, select_options=2164525826, result=0x7f33f8018660, unit=0x7f33f8005210, select_lex=0x7f33f80155d8) at /data/src/bb-11.0/sql/sql_select.cc:5111
      #15 0x00005627db470b2b in handle_select (thd=0x7f33f8000db8, lex=0x7f33f8005138, result=0x7f33f8018660, setup_tables_done_option=0) at /data/src/bb-11.0/sql/sql_select.cc:609
      #16 0x00005627db3c61b5 in execute_sqlcom_select (thd=0x7f33f8000db8, all_tables=0x7f33f8015bc0) at /data/src/bb-11.0/sql/sql_parse.cc:6263
      #17 0x00005627db3b2bb7 in mysql_execute_command (thd=0x7f33f8000db8, is_called_from_prepared_stmt=false) at /data/src/bb-11.0/sql/sql_parse.cc:3947
      #18 0x00005627db3cf2d4 in mysql_parse (thd=0x7f33f8000db8, rawbuf=0x7f33f80154c0 "SELECT STRAIGHT_JOIN pk FROM t1 JOIN t2 ON a = pk WHERE b >= 'A' ORDER BY pk LIMIT 8 OFFSET 1", length=93, parser_state=0x7f340a315390) at /data/src/bb-11.0/sql/sql_parse.cc:7998
      #19 0x00005627db3a677c in dispatch_command (command=COM_QUERY, thd=0x7f33f8000db8, packet=0x7f33f800ba49 "SELECT STRAIGHT_JOIN pk FROM t1 JOIN t2 ON a = pk WHERE b >= 'A' ORDER BY pk LIMIT 8 OFFSET 1", packet_length=93, blocking=true) at /data/src/bb-11.0/sql/sql_parse.cc:1894
      #20 0x00005627db3a3937 in do_command (thd=0x7f33f8000db8, blocking=true) at /data/src/bb-11.0/sql/sql_parse.cc:1407
      #21 0x00005627db71bdf2 in do_handle_one_connection (connect=0x5627e05daa48, put_in_cache=true) at /data/src/bb-11.0/sql/sql_connect.cc:1415
      #22 0x00005627db71b7e8 in handle_one_connection (arg=0x5627e05ca508) at /data/src/bb-11.0/sql/sql_connect.cc:1317
      #23 0x00005627dc033e61 in pfs_spawn_thread (arg=0x5627e05da5b8) at /data/src/bb-11.0/storage/perfschema/pfs.cc:2201
      #24 0x00007f340fe48ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #25 0x00007f340fa37aef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      (gdb) f 8
      #8  0x00005627db50fd9c in get_range_limit_read_cost (pos=0x7f33f8068e68, table=0x7f33f8227688, keynr=1, rows_limit_arg=9, rows_to_scan=9, 
          read_cost=0x7f340a314120, read_rows=0x7f340a314128) at /data/src/bb-11.0/sql/sql_select.cc:30339
      p 30339	      DBUG_ASSERT(cond_selectivity <= 1.000000001);
      (gdb) p cond_selectivity
      $1 = 1.1111111111111112
      

      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.