[MDEV-4349] MWL#253: Server crashes in calculate_cond_selectivity_for_table with constant table, optimizer_use_condition_selectivity>1 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: Minor
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  0x00000000008e5560 in calculate_cond_selectivity_for_table (thd=0x2064800, table=0x7fc27c0ed680, cond=0x7fc27c01f740) at /data/bzr/maria-10.0-mwl253/sql/opt_range.cc:3367
#5  0x000000000064d945 in make_join_statistics (join=0x7fc27c01e1c0, tables_list=..., conds=0x7fc27c01f740, keyuse_array=0x7fc27c01e4c8) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:3857
#6  0x0000000000644bf3 in JOIN::optimize_inner (this=0x7fc27c01e1c0) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:1306
#7  0x0000000000643bc2 in JOIN::optimize (this=0x7fc27c01e1c0) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:1008
#8  0x000000000064b6cf in mysql_select (thd=0x2064800, rref_pointer_array=0x2067738, tables=0x7fc27c131fd0, wild_num=1, fields=..., conds=0x7fc27c01e018, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fc27c133d48, unit=0x2066e00, select_lex=0x20674d8) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:3220
#9  0x0000000000642031 in handle_select (thd=0x2064800, lex=0x2066d48, result=0x7fc27c133d48, setup_tables_done_option=0) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:376
#10 0x000000000061a175 in execute_sqlcom_select (thd=0x2064800, all_tables=0x7fc27c131fd0) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:4797
#11 0x000000000061277e in mysql_execute_command (thd=0x2064800) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:2266
#12 0x000000000061ca16 in mysql_parse (thd=0x2064800, rawbuf=0x7fc27c131d98 "SELECT * FROM t1 WHERE a IN ( SELECT b FROM t2 ) AND ( a > 3 )", length=62, parser_state=0x7fc2862b0500) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:5920
#13 0x000000000060faa2 in dispatch_command (command=COM_QUERY, thd=0x2064800, packet=0x2069d01 "SELECT * FROM t1 WHERE a IN ( SELECT b FROM t2 ) AND ( a > 3 )", packet_length=62) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:1091
#14 0x000000000060ecd0 in do_command (thd=0x2064800) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:810
#15 0x0000000000722226 in do_handle_one_connection (thd_arg=0x2064800) at /data/bzr/maria-10.0-mwl253/sql/sql_connect.cc:1266
#16 0x0000000000721c11 in handle_one_connection (arg=0x2064800) at /data/bzr/maria-10.0-mwl253/sql/sql_connect.cc:1181
#17 0x0000000000c9d340 in pfs_spawn_thread (arg=0x2011230) at /data/bzr/maria-10.0-mwl253/storage/perfschema/pfs.cc:1015
#18 0x00007fc29199de9a in start_thread (arg=0x7fc2862b1700) at pthread_create.c:308
#19 0x00007fc290c91cbd 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) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1);
 
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (2),(3);
 
SELECT * FROM t1 WHERE a IN ( SELECT b FROM t2 ) AND ( a > 3 );

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 fix is pushed into maria-10.0-mwl253

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