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

Sporadic assertion `cond_selectivity <= 1.0' failure in get_range_limit_read_cost

    XMLWordPrintable

Details

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

    Description

      Notes:

      • Fix for MDEV-30088 is already in the branch
      • The failure is sporadic, run with --repeat=N. It usually fails for me within 5 attempts, but it can vary on different machines and builds.

      --source include/have_innodb.inc
       
      CREATE TABLE t (a CHAR(8), b INT, c TIMESTAMP, KEY(b,c)) ENGINE=InnoDB;
      INSERT INTO t VALUES
      ('g',1,'1980-09-26'),('l',2,'1979-10-07'),('e',3,'1992-04-22'),
      ('v',9,'1975-09-21'),('w',3,'1973-10-06'),('y',8,'1986-10-28'),
      ('a',4,'2015-02-15'),('v',9,'1980-01-13'),('f',1,'1972-02-27'),
      ('z',7,'1981-05-25'),('z',8,'1980-06-14'),('c',9,'1985-01-24'),
      ('x',5,'1999-12-14'),('h',3,'1994-12-18'),('j',6,'1985-08-17'),
      ('b',6,'1989-08-02'),('h',6,'2024-07-06'),('h',4,'2024-02-10'),
      ('s',1,'1981-07-21'),('c',2,'1988-09-16'),('e',3,'1981-08-26'),
      ('a',2,'1986-05-23'),('l',0,'1997-12-19'),('b',5,'2018-05-01'),
      ('q',2,'1990-01-01'),('v',9,'1982-10-12'),('x',2,'2005-04-29'),
      ('f',8,'2005-08-20'),('d',3,'2002-01-24'),('b',9,'1982-02-04'),
      ('a',4,'1978-04-12'),('c',9,'1984-06-08'),('n',9,'1983-10-19'),
      ('l',1,'2023-01-05'),('f',2,'1988-11-18'),('a',9,'1977-11-11'),
      ('k',2,'1980-09-27'),('i',7,'1988-08-09'),('e',4,'1992-07-30'),
      ('l',5,'1980-01-01'),('h',5,'2011-12-24'),('d',6,'2035-03-28'),
      ('h',7,'1994-05-14'),('y',1,'1990-01-01'),('x',6,'1981-09-12'),
      ('x',9,'1980-01-01'),('s',9,'1995-11-09'),('i',4,'1980-01-01'),
      ('p',4,'1980-01-01'),('a',6,'2026-05-05'),('c',6,'1991-09-23'),
      ('l',8,'1980-01-01'),('n',4,'1999-09-15'),('b',1,'2011-07-23'),
      ('a',9,'1980-01-01'),('a',0,'1977-12-21'),('v',6,'1986-10-29'),
      ('r',0,'1997-03-27'),('a',9,'2000-05-05'),('x',1,'1990-01-01'),
      ('n',7,'1985-08-01'),('m',6,'1994-09-14'),('s',9,'2009-09-27'),
      ('r',8,'2028-10-30'),('e',6,'1982-08-31'),('x',0,'1989-12-21'),
      ('d',0,'1984-06-24'),('r',6,'1982-02-11'),('a',3,'1997-10-22'),
      ('s',9,'2007-08-29'),('a',3,'1990-01-01'),('o',1,'2015-02-10'),
      ('x',0,'1978-08-30'),('k',5,'1989-06-15'),('b',0,'1984-08-21'),
      ('v',0,'1990-01-01'),('a',9,'1993-06-23'),('n',5,'1979-11-10'),
      ('o',8,'2024-08-31'),('k',6,'1983-12-25'),('y',5,'2013-02-19'),
      ('a',9,'1989-12-03'),('k',4,'1973-08-07'),('o',7,'1988-03-19'),
      ('o',3,'2007-01-07'),('t',6,'1990-02-22'),('f',4,'2032-10-22'),
      ('p',0,'1977-09-12'),('f',3,'2036-11-26'),('a',9,'2008-06-26'),
      ('k',2,'2004-09-11'),('x',1,'2005-07-28'),('s',8,'2027-08-28'),
      ('a',8,'2000-06-11'),('a',7,'2005-05-20'),('u',9,'1980-01-01'),
      ('v',5,'1990-01-01'),('x',7,'1984-11-01'),('a',1,'2006-05-14');
       
      SELECT b FROM t WHERE a > 'a' GROUP BY b HAVING b >= 6 OR b <= 0;
       
      # Cleanup
      DROP TABLE t;
      

      bb-11.0 552965e1c1

      mariadbd: /data/src/bb-11.0/sql/sql_select.cc:30327: bool get_range_limit_read_cost(const POSITION*, const TABLE*, uint, ha_rows, ha_rows, double*, double*): Assertion `cond_selectivity <= 1.0' failed.
      221228 21:46:27 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f01df0b2662 in __GI___assert_fail (assertion=0x55c3ace16713 "cond_selectivity <= 1.0", file=0x55c3ace10ca8 "/data/src/bb-11.0/sql/sql_select.cc", line=30327, function=0x55c3ace16730 "bool get_range_limit_read_cost(const POSITION*, const TABLE*, uint, ha_rows, ha_rows, double*, double*)") at assert.c:101
      #8  0x000055c3ab6a6b5c in get_range_limit_read_cost (pos=0x7f01a8018fd8, table=0x7f01a8227398, keynr=0, rows_limit_arg=100, rows_to_scan=100, read_cost=0x7f01d15f3120, read_rows=0x7f01d15f3128) at /data/src/bb-11.0/sql/sql_select.cc:30327
      #9  0x000055c3ab6a87d0 in test_if_cheaper_ordering (tab=0x7f01a8231b00, order=0x7f01a80167b8, table=0x7f01a8227398, usable_keys=..., ref_key=-1, select_limit_arg=100, new_key=0x7f01d15f32e8, new_key_direction=0x7f01d15f32f4, new_select_limit=0x7f01d15f32b8, new_used_key_parts=0x7f01d15f32ec, saved_best_key_parts=0x7f01d15f32f0) at /data/src/bb-11.0/sql/sql_select.cc:30686
      #10 0x000055c3ab68cdf8 in test_if_skip_sort_order (tab=0x7f01a8231b00, order=0x7f01a80167b8, select_limit=18446744073709551615, no_changes=false, map=0x7f01a8227428) at /data/src/bb-11.0/sql/sql_select.cc:25595
      #11 0x000055c3ab61ac84 in JOIN::optimize_stage2 (this=0x7f01a80179b0) at /data/src/bb-11.0/sql/sql_select.cc:3278
      #12 0x000055c3ab616267 in JOIN::optimize_inner (this=0x7f01a80179b0) at /data/src/bb-11.0/sql/sql_select.cc:2594
      #13 0x000055c3ab61167a in JOIN::optimize (this=0x7f01a80179b0) at /data/src/bb-11.0/sql/sql_select.cc:1899
      #14 0x000055c3ab6272b7 in mysql_select (thd=0x7f01a8000db8, tables=0x7f01a8015b88, fields=..., conds=0x7f01a8016468, og_num=1, order=0x0, group=0x7f01a80167b8, having=0x7f01a8016f90, proc_param=0x0, select_options=2164525824, result=0x7f01a8017988, unit=0x7f01a8005210, select_lex=0x7f01a80155a0) at /data/src/bb-11.0/sql/sql_select.cc:5112
      #15 0x000055c3ab607b05 in handle_select (thd=0x7f01a8000db8, lex=0x7f01a8005138, result=0x7f01a8017988, setup_tables_done_option=0) at /data/src/bb-11.0/sql/sql_select.cc:609
      #16 0x000055c3ab55d18f in execute_sqlcom_select (thd=0x7f01a8000db8, all_tables=0x7f01a8015b88) at /data/src/bb-11.0/sql/sql_parse.cc:6263
      #17 0x000055c3ab549b91 in mysql_execute_command (thd=0x7f01a8000db8, is_called_from_prepared_stmt=false) at /data/src/bb-11.0/sql/sql_parse.cc:3947
      #18 0x000055c3ab5662ae in mysql_parse (thd=0x7f01a8000db8, rawbuf=0x7f01a80154c0 "SELECT b FROM t WHERE a > 'a' GROUP BY b HAVING b >= 6 OR b <= 0", length=64, parser_state=0x7f01d15f4390) at /data/src/bb-11.0/sql/sql_parse.cc:7998
      #19 0x000055c3ab53d756 in dispatch_command (command=COM_QUERY, thd=0x7f01a8000db8, packet=0x7f01a800ba49 "SELECT b FROM t WHERE a > 'a' GROUP BY b HAVING b >= 6 OR b <= 0", packet_length=64, blocking=true) at /data/src/bb-11.0/sql/sql_parse.cc:1894
      #20 0x000055c3ab53a911 in do_command (thd=0x7f01a8000db8, blocking=true) at /data/src/bb-11.0/sql/sql_parse.cc:1407
      #21 0x000055c3ab8b2c98 in do_handle_one_connection (connect=0x55c3b0effe98, put_in_cache=true) at /data/src/bb-11.0/sql/sql_connect.cc:1415
      #22 0x000055c3ab8b268e in handle_one_connection (arg=0x55c3b0eed328) at /data/src/bb-11.0/sql/sql_connect.cc:1317
      #23 0x000055c3ac1cad07 in pfs_spawn_thread (arg=0x55c3b0effa08) at /data/src/bb-11.0/storage/perfschema/pfs.cc:2201
      #24 0x00007f01df58eea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #25 0x00007f01df17daef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Could not reproduce 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.