[MDEV-14880] Assertion `inj_cond_list.elements' failed in JOIN::inject_best_splitting_cond Created: 2018-01-06  Updated: 2018-01-09  Resolved: 2018-01-09

Status: Closed
Project: MariaDB Server
Component/s: Optimizer, Views
Affects Version/s: 10.3
Fix Version/s: 10.3.4

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


 Description   

CREATE TABLE t1 (pk1 INT PRIMARY KEY, f INT) ENGINE=Aria;
INSERT INTO t1 VALUES (1,0),(2,0);
 
CREATE TABLE t2 (pk2 INT PRIMARY KEY) ENGINE=Aria;
INSERT INTO t2 VALUES (1),(2),(3);
 
CREATE VIEW v2 AS SELECT pk2, COUNT(*) AS cnt FROM t2 GROUP BY pk2;
 
SELECT * FROM t1 INNER JOIN v2 ON pk1 = pk2 WHERE f <> 5;

10.3 fa7d85bb87e796f1c

mysqld: /data/src/10.3/sql/opt_split.cc:1030: bool JOIN::inject_best_splitting_cond(table_map): Assertion `inj_cond_list.elements' failed.
180106 21:01:50 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fed1d695ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x00005623a8ba3183 in JOIN::inject_best_splitting_cond (this=0x7fecfc019870, remaining_tables=3) at /data/src/10.3/sql/opt_split.cc:1030
#9  0x00005623a8ba33b3 in st_join_table::fix_splitting (this=0x7fecfc05cea0, spl_plan=0x7fecfc05e848, remaining_tables=3) at /data/src/10.3/sql/opt_split.cc:1083
#10 0x00005623a8ba34b6 in JOIN::fix_all_splittings_in_plan (this=0x7fecfc019220) at /data/src/10.3/sql/opt_split.cc:1128
#11 0x00005623a8a038e9 in JOIN::get_best_combination (this=0x7fecfc019220) at /data/src/10.3/sql/sql_select.cc:9057
#12 0x00005623a89edb09 in JOIN::optimize_stage2 (this=0x7fecfc019220) at /data/src/10.3/sql/sql_select.cc:1590
#13 0x00005623a89eda1a in JOIN::optimize_inner (this=0x7fecfc019220) at /data/src/10.3/sql/sql_select.cc:1569
#14 0x00005623a89ec245 in JOIN::optimize (this=0x7fecfc019220) at /data/src/10.3/sql/sql_select.cc:1141
#15 0x00005623a89f579e in mysql_select (thd=0x7fecfc000b00, tables=0x7fecfc014d90, wild_num=1, fields=..., conds=0x7fecfc016650, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fecfc019200, unit=0x7fecfc004838, select_lex=0x7fecfc004f70) at /data/src/10.3/sql/sql_select.cc:3821
#16 0x00005623a89e9824 in handle_select (thd=0x7fecfc000b00, lex=0x7fecfc004770, result=0x7fecfc019200, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:375
#17 0x00005623a89b4fc5 in execute_sqlcom_select (thd=0x7fecfc000b00, all_tables=0x7fecfc014d90) at /data/src/10.3/sql/sql_parse.cc:6511
#18 0x00005623a89ab759 in mysql_execute_command (thd=0x7fecfc000b00) at /data/src/10.3/sql/sql_parse.cc:3744
#19 0x00005623a89b88f8 in mysql_parse (thd=0x7fecfc000b00, rawbuf=0x7fecfc014b58 "SELECT * FROM t1 INNER JOIN v2 ON pk1 = pk2 WHERE f <> 5", length=56, parser_state=0x7fed18105610, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7968
#20 0x00005623a89a626d in dispatch_command (command=COM_QUERY, thd=0x7fecfc000b00, packet=0x7fecfc11ec21 "SELECT * FROM t1 INNER JOIN v2 ON pk1 = pk2 WHERE f <> 5", packet_length=56, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1825
#21 0x00005623a89a4ca1 in do_command (thd=0x7fecfc000b00) at /data/src/10.3/sql/sql_parse.cc:1369
#22 0x00005623a8afdcf4 in do_handle_one_connection (connect=0x5623abf08410) at /data/src/10.3/sql/sql_connect.cc:1401
#23 0x00005623a8afda81 in handle_one_connection (arg=0x5623abf08410) at /data/src/10.3/sql/sql_connect.cc:1307
#24 0x00005623a8f8dcdc in pfs_spawn_thread (arg=0x5623abfa9890) at /data/src/10.3/storage/perfschema/pfs.cc:1863
#25 0x00007fed1f36c494 in start_thread (arg=0x7fed18106700) at pthread_create.c:333
#26 0x00007fed1d75293f in clone () from /lib/x86_64-linux-gnu/libc.so.6



 Comments   
Comment by Alice Sherepa [ 2018-01-08 ]

Reproducible after commit fa7d85bb87e796f (merge bb-10.2-ext into 10.3 ), not reproducible in bb-10.2-ext (6d49ef49e577)
in bb-10.2-ext, :

EXPLAIN SELECT * FROM t1 INNER JOIN v2 ON pk1 = pk2 WHERE f <> 5; #ARIA

id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	PRIMARY	<derived2>	ALL	NULL	NULL	NULL	NULL	3	
1	PRIMARY	t1	eq_ref	PRIMARY	PRIMARY	4	v2.pk2	1	Using where
2	DERIVED	t2	index	NULL	PRIMARY	4	NULL	3	Using index

explain extended SELECT * FROM t1 INNER JOIN v2 ON pk1 = pk2 WHERE f <> 5; #INNODB

id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	PRIMARY	t1	ALL	PRIMARY	NULL	NULL	NULL	2	100.00	Using where
1	PRIMARY	<derived2>	ref	key0	key0	4	test.t1.pk1	2	100.00	
2	LATERAL DERIVED	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.pk1	1	100.00	Using index

in 10.3

explain extended SELECT * FROM t1 INNER JOIN v2 ON pk1 = pk2 WHERE f <> 5; #INNODB

id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	PRIMARY	t1	ALL	PRIMARY	NULL	NULL	NULL	2	100.00	Using where
1	PRIMARY	<derived2>	ref	key0	key0	4	test.t1.pk1	2	100.00	
2	DERIVED	t2	index	PRIMARY	PRIMARY	4	NULL	3	100.00	Using index; Using temporary; Using filesort

Comment by Igor Babaev [ 2018-01-09 ]

A fix for this bug was pushed into the 10.3 tree.

Generated at Thu Feb 08 08:17:00 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.