Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
11.0(EOL)
-
None
Description
CREATE TABLE t1 (a INT); |
INSERT INTO t1 VALUES (1),(2); |
|
CREATE TABLE t2 (id INT PRIMARY KEY); |
INSERT INTO t2 VALUES (2),(3); |
|
SET optimizer_switch = 'derived_with_keys=off'; |
SET optimizer_use_condition_selectivity = 1; |
|
SELECT t1.* FROM t1 JOIN (SELECT id, COUNT(*) FROM t2 GROUP BY id) sq ON sq.id = t1.a; |
|
# Cleanup
|
DROP TABLE t1, t2; |
11.0 aac88fc2 |
mariadbd: /data/src/11.0/sql/sql_select.cc:7858: double apply_selectivity_for_table(JOIN_TAB*, uint): Assertion `dbl_records <= s->records' failed.
|
230531 14:32:58 [ERROR] mysqld got signal 6 ;
|
|
0x559068d6a7c0 "dbl_records <= s->records", file=file@entry=0x559068d65ae0 "/data/src/11.0/sql/sql_select.cc", line=line@entry=7858, function=function@entry=0x559068d6a680 "double apply_selectivity_for_table(JOIN_TAB*, uint)") at ./assert/assert.c:92
|
#9 0x00007fc7e8a53df2 in __GI___assert_fail (assertion=0x559068d6a7c0 "dbl_records <= s->records", file=0x559068d65ae0 "/data/src/11.0/sql/sql_select.cc", line=7858, function=0x559068d6a680 "double apply_selectivity_for_table(JOIN_TAB*, uint)") at ./assert/assert.c:101
|
#10 0x0000559066de65fd in apply_selectivity_for_table (s=0x629000271640, use_cond_selectivity=1) at /data/src/11.0/sql/sql_select.cc:7858
|
#11 0x0000559066deeb58 in best_access_path (join=0x62900026ca70, s=0x629000271640, remaining_tables=2, join_positions=0x629000271c88, idx=1, disable_jbuf=false, record_count=2, pos=0x629000272550, loose_scan_pos=0x629000272690) at /data/src/11.0/sql/sql_select.cc:9346
|
#12 0x0000559066df82c9 in get_costs_for_tables (join=0x62900026ca70, remaining_tables=2, idx=1, record_count=2, trace_one_table=0x7fc7e0f6b2e0, pos=0x629000271c48, store_position=0x7fc7e0f6b200, allowed_tables=0x7fc7e0f6b240, stop_on_eq_ref=false) at /data/src/11.0/sql/sql_select.cc:11059
|
#13 0x0000559066df9580 in best_extension_by_limited_search (join=0x62900026ca70, remaining_tables=2, idx=1, record_count=2, read_time=0.010348410000000001, search_depth=61, use_cond_selectivity=1, processed_eq_ref_tables=0x7fc7e0f6b600) at /data/src/11.0/sql/sql_select.cc:11316
|
#14 0x0000559066dfafce in best_extension_by_limited_search (join=0x62900026ca70, remaining_tables=3, idx=0, record_count=1, read_time=0, search_depth=62, use_cond_selectivity=1, processed_eq_ref_tables=0x7fc7e0f6b8d0) at /data/src/11.0/sql/sql_select.cc:11541
|
#15 0x0000559066df3ff5 in greedy_search (join=0x62900026ca70, remaining_tables=3, search_depth=62, use_cond_selectivity=1) at /data/src/11.0/sql/sql_select.cc:10287
|
#16 0x0000559066df1ae9 in choose_plan (join=0x62900026ca70, join_tables=3, emb_sjm_nest=0x0) at /data/src/11.0/sql/sql_select.cc:9808
|
#17 0x0000559066dd84d3 in make_join_statistics (join=0x62900026ca70, tables_list=..., keyuse_array=0x62900026cdd8) at /data/src/11.0/sql/sql_select.cc:6097
|
#18 0x0000559066db3dda in JOIN::optimize_inner (this=0x62900026ca70) at /data/src/11.0/sql/sql_select.cc:2579
|
#19 0x0000559066dace47 in JOIN::optimize (this=0x62900026ca70) at /data/src/11.0/sql/sql_select.cc:1907
|
#20 0x0000559066dceab3 in mysql_select (thd=0x62b00007e218, tables=0x6290000e69b8, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x6290000ea068, unit=0x62b000082660, select_lex=0x6290000e6350) at /data/src/11.0/sql/sql_select.cc:5146
|
#21 0x0000559066d9e6e8 in handle_select (thd=0x62b00007e218, lex=0x62b000082588, result=0x6290000ea068, setup_tables_done_option=0) at /data/src/11.0/sql/sql_select.cc:618
|
#22 0x0000559066cc3ac4 in execute_sqlcom_select (thd=0x62b00007e218, all_tables=0x6290000e69b8) at /data/src/11.0/sql/sql_parse.cc:6279
|
#23 0x0000559066cb1eeb in mysql_execute_command (thd=0x62b00007e218, is_called_from_prepared_stmt=false) at /data/src/11.0/sql/sql_parse.cc:3949
|
#24 0x0000559066cce574 in mysql_parse (thd=0x62b00007e218, rawbuf=0x6290000e6238 "SELECT t1.* FROM t1 JOIN (SELECT id, COUNT(*) FROM t2 GROUP BY id) sq ON sq.id = t1.a", length=85, parser_state=0x7fc7e0f6da20) at /data/src/11.0/sql/sql_parse.cc:8014
|
#25 0x0000559066ca4460 in dispatch_command (command=COM_QUERY, thd=0x62b00007e218, packet=0x629000258219 "SELECT t1.* FROM t1 JOIN (SELECT id, COUNT(*) FROM t2 GROUP BY id) sq ON sq.id = t1.a", packet_length=85, blocking=true) at /data/src/11.0/sql/sql_parse.cc:1894
|
#26 0x0000559066ca1183 in do_command (thd=0x62b00007e218, blocking=true) at /data/src/11.0/sql/sql_parse.cc:1407
|
#27 0x00005590671691a4 in do_handle_one_connection (connect=0x608000002d38, put_in_cache=true) at /data/src/11.0/sql/sql_connect.cc:1416
|
#28 0x0000559067168b65 in handle_one_connection (arg=0x608000002cb8) at /data/src/11.0/sql/sql_connect.cc:1318
|
#29 0x0000559067d5d4bc in pfs_spawn_thread (arg=0x617000005b98) at /data/src/11.0/storage/perfschema/pfs.cc:2201
|
#30 0x00007fc7e8aa7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
|
#31 0x00007fc7e8b285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
|
Reproducible with at least InnoDB, MyISAM, Aria.
Not reproducible on 10.11.
The failure started happening on 11.0 after
commit 10a974adc9b250431cac44555c7aa9354e5840df
|
Merge: f74bb51b30d e8c7222ba3a
|
Author: Sergei Petrunia
|
Date: Wed Feb 15 12:03:12 2023 +0300
|
|
Merge 11.0-selectivity into 11.0
|