Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.4, 11.8, 12.0(EOL)
-
None
Description
11.4 at git sha aa3578aa8a56b53318860c55c6f1d4163d36b069
An assertion failure results from the following SELECT query. Note that removing the LIMIT avoids the crash. Running as a stand-alone query, the query corresponding to the derived query below also does not crash.
Failing assert:
8104 DBUG_ASSERT(table_records == 0 ||
|
8105 sel <= s->table->opt_range_condition_rows /
|
8106 table_records);
|
Setup and SELECT:
create table t1 (
|
grp_id int,
|
value int,
|
index (grp_id)
|
);
|
insert into t1 select
|
A.seq, B.seq
|
from
|
seq_1_to_10000 A,
|
seq_1_to_100 B
|
;
|
create table t2 (a int);
|
insert into t2 select seq from seq_1_to_5;
|
analyze table t1,t2;
|
select * from t2, (select max(value), grp_id from t1 group by grp_id limit 1) DT where t2.a= DT.grp_id;
|
Crash:
Thread 12 "mariadbd" received signal SIGABRT, Aborted.
|
[Switching to Thread 0x7ffff41ac6c0 (LWP 28540)]
|
Downloading source file /usr/src/debug/glibc-2.40-26.fc41.x86_64/nptl/pthread_kill.c
|
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
|
44 return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
|
(gdb) bt
|
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
|
#1 0x00007ffff727f843 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:78
|
#2 0x00007ffff72263de in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
|
#3 0x00007ffff720d942 in __GI_abort () at abort.c:79
|
#4 0x00007ffff720d85e in __assert_fail_base (fmt=0x7ffff73c2cb0 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
|
assertion=assertion@entry=0x555556e46ed8 "table_records == 0 || sel <= s->table->opt_range_condition_rows / table_records",
|
file=file@entry=0x555556e45318 "/home/dgosselin/1-server/sql/sql_select.cc", line=line@entry=8104,
|
function=function@entry=0x555556e46ea0 "double apply_selectivity_for_table(JOIN_TAB*, uint)") at assert.c:96
|
#5 0x00007ffff721e507 in __assert_fail (
|
assertion=0x555556e46ed8 "table_records == 0 || sel <= s->table->opt_range_condition_rows / table_records",
|
file=0x555556e45318 "/home/dgosselin/1-server/sql/sql_select.cc", line=8104,
|
function=0x555556e46ea0 "double apply_selectivity_for_table(JOIN_TAB*, uint)") at assert.c:105
|
#6 0x0000555555788c12 in apply_selectivity_for_table (s=0x7fffa80a06b0, use_cond_selectivity=4)
|
at /home/dgosselin/1-server/sql/sql_select.cc:8104
|
#7 0x000055555578dadd in best_access_path (join=0x7fffa80360c8, s=0x7fffa80a06b0, remaining_tables=2, join_positions=0x7fffa80a0d60,
|
idx=1, disable_jbuf=false, record_count=5, pos=0x7fffa80a1698, loose_scan_pos=0x7fffa80a17e8)
|
at /home/dgosselin/1-server/sql/sql_select.cc:9672
|
#8 0x00005555557929f6 in get_costs_for_tables (join=0x7fffa80360c8, remaining_tables=2, idx=1, record_count=5,
|
trace_one_table=0x7ffff41a9870, pos=0x7fffa80a0d20, store_position=0x7ffff41a9770, allowed_tables=0x7ffff41a9780, stop_on_eq_ref=false)
|
at /home/dgosselin/1-server/sql/sql_select.cc:11451
|
#9 0x0000555555793cff in best_extension_by_limited_search (join=0x7fffa80360c8, remaining_tables=2, idx=1, record_count=5,
|
read_time=0.011669800000000001, search_depth=61, use_cond_selectivity=4, processed_eq_ref_tables=0x7ffff41a9968)
|
at /home/dgosselin/1-server/sql/sql_select.cc:12023
|
#10 0x0000555555794aab in best_extension_by_limited_search (join=0x7fffa80360c8, remaining_tables=3, idx=0, record_count=1, read_time=0,
|
search_depth=62, use_cond_selectivity=4, processed_eq_ref_tables=0x7ffff41a9b18) at /home/dgosselin/1-server/sql/sql_select.cc:12248
|
#11 0x0000555555790997 in greedy_search (join=0x7fffa80360c8, remaining_tables=3, search_depth=62, use_cond_selectivity=4)
|
at /home/dgosselin/1-server/sql/sql_select.cc:10677
|
#12 0x000055555578f832 in choose_plan (join=0x7fffa80360c8, join_tables=3, emb_sjm_nest=0x0)
|
at /home/dgosselin/1-server/sql/sql_select.cc:10186
|
#13 0x0000555555783c10 in make_join_statistics (join=0x7fffa80360c8, tables_list=..., keyuse_array=0x7fffa8036428)
|
at /home/dgosselin/1-server/sql/sql_select.cc:6331
|
#14 0x00005555557763eb in JOIN::optimize_inner (this=0x7fffa80360c8) at /home/dgosselin/1-server/sql/sql_select.cc:2708
|
#15 0x00005555557738c1 in JOIN::optimize (this=0x7fffa80360c8) at /home/dgosselin/1-server/sql/sql_select.cc:2003
|
#16 0x000055555578011a in mysql_select (thd=0x7fffa8000dc8, tables=0x7fffa8032978, fields=..., conds=0x7fffa80354d8, og_num=0, order=0x0,
|
group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x7fffa80360a0, unit=0x7fffa8005250, select_lex=0x7fffa8032340)
|
at /home/dgosselin/1-server/sql/sql_select.cc:5349
|
#17 0x000055555576d5b7 in handle_select (thd=0x7fffa8000dc8, lex=0x7fffa8005170, result=0x7fffa80360a0, setup_tables_done_option=0)
|
at /home/dgosselin/1-server/sql/sql_select.cc:642
|
#18 0x0000555555710b2c in execute_sqlcom_select (thd=0x7fffa8000dc8, all_tables=0x7fffa8032978)
|
at /home/dgosselin/1-server/sql/sql_parse.cc:6183
|
#19 0x0000555555709d76 in mysql_execute_command (thd=0x7fffa8000dc8, is_called_from_prepared_stmt=false)
|
at /home/dgosselin/1-server/sql/sql_parse.cc:3975
|
#20 0x0000555555715138 in mysql_parse (thd=0x7fffa8000dc8,
|
rawbuf=0x7fffa8032210 "select * from t2, (select max(value), grp_id from t1 group by grp_id limit 1) DT where t2.a= DT.grp_id",
|
length=104, parser_state=0x7ffff41ab120) at /home/dgosselin/1-server/sql/sql_parse.cc:7898
|
#21 0x0000555555703bbe in dispatch_command (command=COM_QUERY, thd=0x7fffa8000dc8,
|
packet=0x7fffa800b549 "select * from t2, (select max(value), grp_id from t1 group by grp_id limit 1) DT where t2.a= DT.grp_id",
|
packet_length=104, blocking=true) at /home/dgosselin/1-server/sql/sql_parse.cc:1904
|
#22 0x00005555557028c8 in do_command (thd=0x7fffa8000dc8, blocking=true) at /home/dgosselin/1-server/sql/sql_parse.cc:1417
|
#23 0x000055555590574e in do_handle_one_connection (connect=0x555558c981b8, put_in_cache=true)
|
at /home/dgosselin/1-server/sql/sql_connect.cc:1408
|
#24 0x00005555559054b2 in handle_one_connection (arg=0x555558c981b8) at /home/dgosselin/1-server/sql/sql_connect.cc:1320
|
#25 0x0000555555e7e344 in pfs_spawn_thread (arg=0x555558d6a108) at /home/dgosselin/1-server/storage/perfschema/pfs.cc:2201
|
#26 0x00007ffff727d724 in start_thread (arg=<optimized out>) at pthread_create.c:448
|
#27 0x00007ffff730180c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
|
Attachments
Issue Links
- relates to
-
MDEV-32138 Assertion `table_records == 0 || sel <= s->table->opt_range_condition_rows / table_records'
-
- Closed
-
-
MDEV-36321 Indexes on derived tables with GROUP BY produce wrong out_rows estimates
-
- In Testing
-