Crash with join_cache_hashed with semijoin and join_cache_level=3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
Medium
|
Igor Babaev |
Bug Description
The following example causes a crash in 5.3. The reason to set a
debug trace is because it forces the call to print_keyuse() via:
update_ref_and_keys -> print_keyuse_array -> print_keyuse.
create table t1 (a int not null);
set @@optimizer_
set join_cache_level=3;
SET @@debug = 'd:t:O,
explain
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in (
select a from t1 where a in ( select a from t1)
)))))
drop table t1;
Changed in maria: | |
assignee: | nobody → Igor Babaev (igorb-seattle) |
milestone: | none → 5.3 |
importance: | Undecided → High |
Changed in maria: | |
status: | Confirmed → In Progress |
Changed in maria: | |
status: | In Progress → Fix Committed |
importance: | High → Medium |
Changed in maria: | |
status: | Fix Committed → Fix Released |
The same example, but without setting a debug trace causes
a crash in 5.3-mwl89 in a different (but related) place, when
update_ref_and_keys is called for the first subquery
(counted from the outside->in). The call stack in 5.3-mwl89 is:
#0 add_key_field at sql_select.cc:3677 statistics at sql_select.cc:2955 lex::optimize_ unflattened_ subqueries at sql_lex.cc:3140 unflattened_ subqueries at opt_subselect. cc:3617
#1 add_key_fields at sql_select.cc:3981
#2 update_ref_and_keys at sql_select.cc:4332
#3 make_join_
#4 JOIN::optimize at sql_select.cc:952
#5 st_select_
#6 JOIN::optimize_
#7 JOIN::optimize at sql_select.cc:1447
#8 mysql_select
The reason for the difference is that 5.3-mwl89 optimizes subqueries
early during JOIN::optimize of the outer query.