[MDEV-30088] Assertion `cond_selectivity <= 1.0' failed in get_range_limit_read_cost Created: 2022-11-24  Updated: 2023-02-10  Resolved: 2022-12-27

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: N/A
Fix Version/s: 11.0.0

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: None
Environment:

bb-11.0 7874b40b0f695bad19b7a424650cda6e140342cc


Issue Links:
Problem/Incident
is caused by MDEV-26974 Improve selectivity and related costs... Closed
Relates

 Description   

CREATE TABLE tm (a TIMESTAMP, KEY(a)) ENGINE=MRG_MyISAM;
ANALYZE TABLE tm PERSISTENT FOR ALL;
SELECT a, COUNT(*) FROM tm WHERE a >= '2000-01-01 00:00:00' GROUP BY a;
 
# Cleanup
DROP TABLE tm;

bb-11.0 7874b40b

mariadbd: /data/src/bb-11.0/sql/sql_select.cc:30228: bool get_range_limit_read_cost(const POSITION*, const TABLE*, uint, ha_rows, ha_rows, double*, double*): Assertion `cond_selectivity <= 1.0' failed.
221124 18:02:40 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fcf817fd662 in __GI___assert_fail (assertion=0x55c92cafae6b "cond_selectivity <= 1.0", file=0x55c92caf62e8 "/data/src/bb-11.0/sql/sql_select.cc", line=30228, function=0x55c92cafae88 "bool get_range_limit_read_cost(const POSITION*, const TABLE*, uint, ha_rows, ha_rows, double*, double*)") at assert.c:101
#8  0x000055c92be8451c in get_range_limit_read_cost (pos=0x7fcf6c018858, table=0x7fcf6c102b08, keynr=0, rows_limit_arg=1, rows_to_scan=1, read_cost=0x7fcf7c1a6280, read_rows=0x7fcf7c1a6288) at /data/src/bb-11.0/sql/sql_select.cc:30228
#9  0x000055c92be8571d in test_if_cheaper_ordering (tab=0x7fcf6c05f4d0, order=0x7fcf6c016978, table=0x7fcf6c102b08, usable_keys=..., ref_key=-1, select_limit_arg=1, new_key=0x7fcf7c1a6428, new_key_direction=0x7fcf7c1a6434, new_select_limit=0x7fcf7c1a63f8, new_used_key_parts=0x7fcf7c1a642c, saved_best_key_parts=0x7fcf7c1a6430) at /data/src/bb-11.0/sql/sql_select.cc:30588
#10 0x000055c92be776b9 in test_if_skip_sort_order (tab=0x7fcf6c05f4d0, order=0x7fcf6c016978, select_limit=18446744073709551615, no_changes=false, map=0x7fcf6c102b98) at /data/src/bb-11.0/sql/sql_select.cc:25493
#11 0x000055c92be3b28e in JOIN::optimize_stage2 (this=0x7fcf6c017370) at /data/src/bb-11.0/sql/sql_select.cc:3266
#12 0x000055c92be38dcd in JOIN::optimize_inner (this=0x7fcf6c017370) at /data/src/bb-11.0/sql/sql_select.cc:2582
#13 0x000055c92be368ce in JOIN::optimize (this=0x7fcf6c017370) at /data/src/bb-11.0/sql/sql_select.cc:1890
#14 0x000055c92be41653 in mysql_select (thd=0x7fcf6c000db8, tables=0x7fcf6c015d20, fields=..., conds=0x7fcf6c016638, og_num=1, order=0x0, group=0x7fcf6c016978, having=0x0, proc_param=0x0, select_options=2164525824, result=0x7fcf6c017348, unit=0x7fcf6c0051e0, select_lex=0x7fcf6c015578) at /data/src/bb-11.0/sql/sql_select.cc:5093
#15 0x000055c92be31a61 in handle_select (thd=0x7fcf6c000db8, lex=0x7fcf6c005108, result=0x7fcf6c017348, setup_tables_done_option=0) at /data/src/bb-11.0/sql/sql_select.cc:608
#16 0x000055c92bde1b49 in execute_sqlcom_select (thd=0x7fcf6c000db8, all_tables=0x7fcf6c015d20) at /data/src/bb-11.0/sql/sql_parse.cc:6263
#17 0x000055c92bdd8fac in mysql_execute_command (thd=0x7fcf6c000db8, is_called_from_prepared_stmt=false) at /data/src/bb-11.0/sql/sql_parse.cc:3947
#18 0x000055c92bde626e in mysql_parse (thd=0x7fcf6c000db8, rawbuf=0x7fcf6c015490 "SELECT a, COUNT(*) FROM tm WHERE a >= '2000-01-01 00:00:00' GROUP BY a", length=70, parser_state=0x7fcf7c1a73c0) at /data/src/bb-11.0/sql/sql_parse.cc:7998
#19 0x000055c92bdd3251 in dispatch_command (command=COM_QUERY, thd=0x7fcf6c000db8, packet=0x7fcf6c00ba19 "SELECT a, COUNT(*) FROM tm WHERE a >= '2000-01-01 00:00:00' GROUP BY a", packet_length=70, blocking=true) at /data/src/bb-11.0/sql/sql_parse.cc:1894
#20 0x000055c92bdd1df8 in do_command (thd=0x7fcf6c000db8, blocking=true) at /data/src/bb-11.0/sql/sql_parse.cc:1407
#21 0x000055c92bf92cfb in do_handle_one_connection (connect=0x55c92fb62a68, put_in_cache=true) at /data/src/bb-11.0/sql/sql_connect.cc:1416
#22 0x000055c92bf92a91 in handle_one_connection (arg=0x55c92fb52528) at /data/src/bb-11.0/sql/sql_connect.cc:1318
#23 0x000055c92c44de8e in pfs_spawn_thread (arg=0x55c92fb625d8) at /data/src/bb-11.0/storage/perfschema/pfs.cc:2201
#24 0x00007fcf81cd9ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#25 0x00007fcf818c8aef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95



 Comments   
Comment by Michael Widenius [ 2022-12-27 ]

Fixed in bb-11.0 tree

Comment by Michael Widenius [ 2022-12-27 ]

Fixed in bb-11.0. Will be pushed later today

Generated at Thu Feb 08 10:13:34 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.