[MDEV-4348] MWL#253: Server crashes in Item_equal::contains with optimizer_use_condition_selectivity>1, merge view (or FROM SQ) Created: 2013-04-01  Updated: 2013-04-03  Resolved: 2013-04-03

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Igor Babaev
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-4145 Take into account the selectivity of ... Closed

 Description   

#3  <signal handler called>
#4  0x000000000081b3d6 in Item_equal::contains (this=0x7f2b040257c8, field=0x0) at /data/bzr/maria-10.0-mwl253/sql/item_cmpfunc.cc:5689
#5  0x0000000000655150 in table_multi_eq_cond_selectivity (join=0x7f2b04024278, idx=1, s=0x7f2b04025ef8, rem_tables=0, keyparts=1, ref_keyuse_steps=0x7f2b0e9f8c40) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:6966
#6  0x00000000006557fa in table_cond_selectivity (join=0x7f2b04024278, idx=1, s=0x7f2b04025ef8, rem_tables=0) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:7087
#7  0x0000000000655e56 in best_extension_by_limited_search (join=0x7f2b04024278, remaining_tables=2, idx=1, record_count=2, read_time=2.4043945312499999, search_depth=61, prune_level=1, use_cond_selectivity=3) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:7327
#8  0x0000000000655f5d in best_extension_by_limited_search (join=0x7f2b04024278, remaining_tables=3, idx=0, record_count=1, read_time=0, search_depth=62, prune_level=1, use_cond_selectivity=3) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:7334
#9  0x0000000000654580 in greedy_search (join=0x7f2b04024278, remaining_tables=3, search_depth=62, prune_level=1, use_cond_selectivity=3) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:6648
#10 0x0000000000653b95 in choose_plan (join=0x7f2b04024278, join_tables=3) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:6225
#11 0x000000000064dae1 in make_join_statistics (join=0x7f2b04024278, tables_list=..., conds=0x7f2b04133210, keyuse_array=0x7f2b04024580) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:3882
#12 0x0000000000644bf3 in JOIN::optimize_inner (this=0x7f2b04024278) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:1306
#13 0x0000000000643bc2 in JOIN::optimize (this=0x7f2b04024278) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:1008
#14 0x000000000064b6cf in mysql_select (thd=0x3df5800, rref_pointer_array=0x3df8738, tables=0x7f2b04131eb0, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f2b04023f00, unit=0x3df7e00, select_lex=0x3df84d8) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:3220
#15 0x0000000000642031 in handle_select (thd=0x3df5800, lex=0x3df7d48, result=0x7f2b04023f00, setup_tables_done_option=0) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:376
#16 0x000000000061a175 in execute_sqlcom_select (thd=0x3df5800, all_tables=0x7f2b04131eb0) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:4797
#17 0x000000000061277e in mysql_execute_command (thd=0x3df5800) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:2266
#18 0x000000000061ca16 in mysql_parse (thd=0x3df5800, rawbuf=0x7f2b04131c88 "SELECT * FROM v1 INNER JOIN t2 ON ( a = c AND b = d )", length=53, parser_state=0x7f2b0e9fa500) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:5920
#19 0x000000000060faa2 in dispatch_command (command=COM_QUERY, thd=0x3df5800, packet=0x3dfad01 "SELECT * FROM v1 INNER JOIN t2 ON ( a = c AND b = d )", packet_length=53) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:1091
#20 0x000000000060ecd0 in do_command (thd=0x3df5800) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:810
#21 0x0000000000722226 in do_handle_one_connection (thd_arg=0x3df5800) at /data/bzr/maria-10.0-mwl253/sql/sql_connect.cc:1266
#22 0x0000000000721c11 in handle_one_connection (arg=0x3df5800) at /data/bzr/maria-10.0-mwl253/sql/sql_connect.cc:1181
#23 0x0000000000c9d340 in pfs_spawn_thread (arg=0x3da2230) at /data/bzr/maria-10.0-mwl253/storage/perfschema/pfs.cc:1015
#24 0x00007f2b1a0e7e9a in start_thread (arg=0x7f2b0e9fb700) at pthread_create.c:308
#25 0x00007f2b193dbcbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

revision-id: igor@askmonty.org-20130401181718-qs2gbk9nd8t3rnvq
revno: 3509
branch-nick: maria-10.0-mwl253

Test case:

SET optimizer_use_condition_selectivity=3;
 
CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
INSERT t1 VALUES (7, 1),(0, 7);
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
 
CREATE TABLE t2 (c INT, d INT, KEY(d)) ENGINE=MyISAM;
INSERT INTO t2 VALUES 
(0,4),(8,6),(1,3),(8,5),(9,3),(2,2),(6,2),
(1,9),(6,3),(2,8),(4,1),(8,8),(4,8),(4,5);
 
SELECT * FROM v1 INNER JOIN t2 ON ( a = c AND b = d );

Also reproducible with a FROM subquery instead of the view.
Also reproducible with InnoDB and Aria.
Reproducible with optimizer_use_condition_selectivity = 2 | 3 | 4.

EXPLAIN also crashes.

Optimizer_switch (default):

index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off



 Comments   
Comment by Igor Babaev [ 2013-04-03 ]

The bug is fixed and the the fix is pushed into maria-10.0-mwl253.

Generated at Thu Feb 08 06:55:43 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.