[MDEV-4366] MWL#253: Server crashes in calculate_cond_selectivity_for_table on JOIN with AND conditions, optimizer_use_condition_selectivity > 2 Created: 2013-04-03  Updated: 2013-04-06  Resolved: 2013-04-06

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  0x00000000008e56f0 in calculate_cond_selectivity_for_table (thd=0x2740800, table=0x7f35d4019460, cond=0x7f35d4133070) at /data/bzr/maria-10.0-mwl253/sql/opt_range.cc:3372
#5  0x000000000064d8ab in make_join_statistics (join=0x7f35d4133590, tables_list=..., conds=0x7f35d4133070, keyuse_array=0x7f35d4133898) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:3839
#6  0x0000000000644c03 in JOIN::optimize_inner (this=0x7f35d4133590) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:1306
#7  0x0000000000643bd2 in JOIN::optimize (this=0x7f35d4133590) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:1008
#8  0x000000000064b6df in mysql_select (thd=0x2740800, rref_pointer_array=0x2743738, tables=0x7f35d4131e48, wild_num=0, fields=..., conds=0x7f35d4133070, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f35d4133570, unit=0x2742e00, select_lex=0x27434d8) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:3220
#9  0x0000000000642041 in handle_select (thd=0x2740800, lex=0x2742d48, result=0x7f35d4133570, setup_tables_done_option=0) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:376
#10 0x000000000061a185 in execute_sqlcom_select (thd=0x2740800, all_tables=0x7f35d4131e48) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:4797
#11 0x000000000061278e in mysql_execute_command (thd=0x2740800) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:2266
#12 0x000000000061ca26 in mysql_parse (thd=0x2740800, rawbuf=0x7f35d4131c88 "SELECT 1 FROM t1, t2 WHERE pk = 6 AND a = 2 AND b = 10", length=54, parser_state=0x7f35dda7b500) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:5920
#13 0x000000000060fab2 in dispatch_command (command=COM_QUERY, thd=0x2740800, packet=0x2745d01 "SELECT 1 FROM t1, t2 WHERE pk = 6 AND a = 2 AND b = 10", packet_length=54) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:1091
#14 0x000000000060ece0 in do_command (thd=0x2740800) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:810
#15 0x00000000007222f2 in do_handle_one_connection (thd_arg=0x2740800) at /data/bzr/maria-10.0-mwl253/sql/sql_connect.cc:1266
#16 0x0000000000721cdd in handle_one_connection (arg=0x2740800) at /data/bzr/maria-10.0-mwl253/sql/sql_connect.cc:1181
#17 0x0000000000c9d560 in pfs_spawn_thread (arg=0x26ed230) at /data/bzr/maria-10.0-mwl253/storage/perfschema/pfs.cc:1015
#18 0x00007f35e9168e9a in start_thread (arg=0x7f35dda7c700) at pthread_create.c:308
#19 0x00007f35e845ccbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

revision-id: igor@askmonty.org-20130403170723-juwfxjyutiobl0uc
revno: 3513
branch-nick: maria-10.0-mwl253

SET optimizer_use_condition_selectivity = 3;
 
CREATE TABLE t1 (pk INT PRIMARY KEY, a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES 
(1,4),(2,6),(3,3),(4,5),(5,3),(6,4),(7,2),(8,9);
 
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1),(7);
 
SELECT 1 FROM t1, t2 WHERE pk = 6 AND a = 2 AND b = 10;

Also reproducible with InnoDB.
Reproducible with the default optimizer_switch as well as with all OFF values.
EXPLAIN also crashes.



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

A fix for the bug has been pushed into maria-10.0-mwl253.

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