Assertion `!s->keys' failed with derived_with_keys=on , semijoin=off in maria-5.3

Bug #803851 reported by Philip Stoev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Fix Released
Critical
Igor Babaev

Bug Description

assertion:

mysqld: table.cc:5235: bool st_table::alloc_keys(uint): Assertion `!s->keys' failed.

#6 0x00000033b58296e6 in __assert_fail () from /lib64/libc.so.6
#7 0x000000000070c263 in st_table::alloc_keys (this=0x60fe880, key_count=1) at table.cc:5235
#8 0x0000000000725493 in generate_derived_keys_for_table (keyuse=0x60fff48, count=1, keys=1) at sql_select.cc:8273
#9 0x00000000007256ce in generate_derived_keys (keyuse_array=0x61553d0) at sql_select.cc:8345
#10 0x00000000007257f9 in sort_and_filter_keyuse (thd=0x603d098, keyuse=0x61553d0, skip_unprefixed_keyparts=true) at sql_select.cc:4677
#11 0x000000000073cd05 in JOIN::reoptimize (this=0x614f420, added_where=0x615e4c8, join_tables=3, save_to=0x0) at sql_select.cc:21464
#12 0x00000000008003ea in JOIN::choose_subquery_plan (this=0x614f420, join_tables=3) at opt_subselect.cc:4533
#13 0x00000000007480c4 in make_join_statistics (join=0x614f420, tables_list=..., conds=0x615d988, keyuse_array=0x61553d0) at sql_select.cc:3507
#14 0x000000000074a4a4 in JOIN::optimize (this=0x614f420) at sql_select.cc:1101
#15 0x000000000057a37a in st_select_lex::optimize_unflattened_subqueries (this=0x603f9f8) at sql_lex.cc:3172
#16 0x0000000000800e00 in JOIN::optimize_unflattened_subqueries (this=0x61491f0) at opt_subselect.cc:4200
#17 0x000000000074bde5 in JOIN::optimize (this=0x61491f0) at sql_select.cc:1489
#18 0x000000000074dfc3 in mysql_select (thd=0x603d098, rref_pointer_array=0x603fc18, tables=0x60c2ea0, wild_num=1, fields=..., conds=0x60c4890, og_num=0,
    order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147764736, result=0x6104230, unit=0x603f510, select_lex=0x603f9f8)
    at sql_select.cc:2872
#19 0x0000000000754442 in handle_select (thd=0x603d098, lex=0x603f470, result=0x6104230, setup_tables_done_option=0) at sql_select.cc:283
#20 0x00000000006a1744 in execute_sqlcom_select (thd=0x603d098, all_tables=0x60c2ea0) at sql_parse.cc:5082
#21 0x00000000006a33f7 in mysql_execute_command (thd=0x603d098) at sql_parse.cc:2227
#22 0x00000000006ac18f in mysql_parse (thd=0x603d098,
    rawbuf=0x60c2c40 "SELECT * FROM t3\nWHERE (f1) IN (\nSELECT v1.f1\nFROM v1 , t2\nWHERE t2.f1 = v1.f3\n)", length=80, found_semicolon=0x40eddf08)
    at sql_parse.cc:6083
#23 0x00000000006ad027 in dispatch_command (command=COM_QUERY, thd=0x603d098,
    packet=0x60b98c9 "SELECT * FROM t3\nWHERE (f1) IN (\nSELECT v1.f1\nFROM v1 , t2\nWHERE t2.f1 = v1.f3\n)", packet_length=80) at sql_parse.cc:1206
#24 0x00000000006ae635 in do_command (thd=0x603d098) at sql_parse.cc:904
#25 0x00000000006990eb in handle_one_connection (arg=0x603d098) at sql_connect.cc:1178
#26 0x00000033b600673d in start_thread () from /lib64/libpthread.so.0
#27 0x00000033b58d40cd in clone () from /lib64/libc.so.6

EXPLIN: crashes

minimal optimizer_switch required: semijoin=off,derived_with_keys=on

full optimizer switch in effect:
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=on,mrr_cost_based=off,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on

test case:

SET SESSION optimizer_switch='semijoin=off,derived_with_keys=on';
SELECT @@optimizer_switch;
CREATE TABLE t1 (f1 int, f3 int) ;
INSERT INTO t1 VALUES (2,2),(3,3);

CREATE TABLE t2 (f1 int) ;
INSERT INTO t2 VALUES (1),(1);

CREATE TABLE t3 (f1 int) ;
INSERT INTO t3 VALUES (1),(1);

CREATE VIEW v1 AS SELECT f1 , MAX(f3) AS f3 FROM t1 GROUP BY f1;

SELECT * FROM t3
WHERE (f1) IN (
        SELECT v1.f1
        FROM v1 , t2
        WHERE t2.f1 = v1.f3
);

Changed in maria:
milestone: none → 5.3
assignee: nobody → Igor Babaev (igorb-seattle)
Changed in maria:
status: New → Confirmed
importance: Undecided → Critical
Changed in maria:
status: Confirmed → In Progress
Changed in maria:
status: In Progress → Fix Committed
Changed in maria:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.