[MDEV-4367] MWL#253: Assertion `join->best_read < double(...)' fails in greedy_search with STRAIGHT_JOIN, constant table, optimizer_use_condition_selectivity>1, derived_merge=on 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: 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   

mysqld: /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:6673: bool greedy_search(JOIN*, table_map, uint, uint, uint): Assertion `join->best_read < double(1.79769313486231570815e+308L)' failed.
130403 23:30:07 [ERROR] mysqld got signal 6 ;

#6  0x00007f37e81930ee in __assert_fail_base (fmt=<optimized out>, assertion=0xd69908 "join->best_read < double(1.79769313486231570815e+308L)", file=0xd68fc0 "/data/bzr/maria-10.0-mwl253/sql/sql_select.cc", line=<optimized out>, function=<optimized out>) at assert.c:94
#7  0x00007f37e8193192 in __GI___assert_fail (assertion=0xd69908 "join->best_read < double(1.79769313486231570815e+308L)", file=0xd68fc0 "/data/bzr/maria-10.0-mwl253/sql/sql_select.cc", line=6673, function=0xd6c1c0 "bool greedy_search(JOIN*, table_map, uint, uint, uint)") at assert.c:103
#8  0x00000000006546bd in greedy_search (join=0x7f37d4023b58, remaining_tables=7, search_depth=62, prune_level=1, use_cond_selectivity=3) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:6673
#9  0x0000000000653c6d in choose_plan (join=0x7f37d4023b58, join_tables=7) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:6242
#10 0x000000000064dbb9 in make_join_statistics (join=0x7f37d4023b58, tables_list=..., conds=0x7f37d4022180, keyuse_array=0x7f37d4023e60) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:3899
#11 0x0000000000644c03 in JOIN::optimize_inner (this=0x7f37d4023b58) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:1306
#12 0x0000000000643bd2 in JOIN::optimize (this=0x7f37d4023b58) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:1008
#13 0x000000000064b6df in mysql_select (thd=0x2e39800, rref_pointer_array=0x2e3c738, tables=0x7f37d4132008, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f37d4023010, unit=0x2e3be00, select_lex=0x2e3c4d8) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:3220
#14 0x0000000000642041 in handle_select (thd=0x2e39800, lex=0x2e3bd48, result=0x7f37d4023010, setup_tables_done_option=0) at /data/bzr/maria-10.0-mwl253/sql/sql_select.cc:376
#15 0x000000000061a185 in execute_sqlcom_select (thd=0x2e39800, all_tables=0x7f37d4132008) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:4797
#16 0x000000000061278e in mysql_execute_command (thd=0x2e39800) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:2266
#17 0x000000000061ca26 in mysql_parse (thd=0x2e39800, rawbuf=0x7f37d4131d98 "SELECT * FROM t1 STRAIGHT_JOIN ( SELECT * FROM t2, t3 WHERE c = b AND b > 'z' ) AS alias", length=88, parser_state=0x7f37dd876500) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:5920
#18 0x000000000060fab2 in dispatch_command (command=COM_QUERY, thd=0x2e39800, packet=0x2e3ed01 "SELECT * FROM t1 STRAIGHT_JOIN ( SELECT * FROM t2, t3 WHERE c = b AND b > 'z' ) AS alias", packet_length=88) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:1091
#19 0x000000000060ece0 in do_command (thd=0x2e39800) at /data/bzr/maria-10.0-mwl253/sql/sql_parse.cc:810
#20 0x00000000007222f2 in do_handle_one_connection (thd_arg=0x2e39800) at /data/bzr/maria-10.0-mwl253/sql/sql_connect.cc:1266
#21 0x0000000000721cdd in handle_one_connection (arg=0x2e39800) at /data/bzr/maria-10.0-mwl253/sql/sql_connect.cc:1181
#22 0x0000000000c9d560 in pfs_spawn_thread (arg=0x2de6230) at /data/bzr/maria-10.0-mwl253/storage/perfschema/pfs.cc:1015
#23 0x00007f37e8f63e9a in start_thread (arg=0x7f37dd877700) at pthread_create.c:308
#24 0x00007f37e8257cbd 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_switch = 'derived_merge=on';
SET optimizer_use_condition_selectivity=3;
 
CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('j'),('k');
 
CREATE TABLE t2 (b VARCHAR(1)) ENGINE=MyISAM;
INSERT INTO t2 VALUES ('x'),('y');
 
CREATE TABLE t3 (c VARCHAR(1), KEY(c)) ENGINE=MyISAM;
 
SELECT * FROM t1 STRAIGHT_JOIN ( SELECT * FROM t2, t3 WHERE c = b AND b > 'z' ) AS alias;

Minimal optimizer_switch: 'derived_merge=on'
EXPLAIN also crashes.



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

The following query without derived tables causes triggers the same assertion failure for the same reason:
select * from t1 straight_join (t2 JOIN t3 ON c = b AND b > 'z');

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.