Crash in JOIN::optimize in maria-5.3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
Undecided
|
Sergey Petrunia |
Bug Description
Not repeatable in maria-5.3
Backtrace:
#4 <signal handler called>
#5 0x08306051 in JOIN::optimize (this=0xae6845a0) at sql_select.cc:1094
#6 0x0830b1bc in mysql_select (thd=0x9a2cbc8, rref_pointer_
order=0x0, group=0x0, having=0x0, proc_param=0x0, select_
at sql_select.cc:2667
#7 0x083039d9 in handle_select (thd=0x9a2cbc8, lex=0x9a2e268, result=0xae60a3e0, setup_tables_
#8 0x082a1477 in execute_
#9 0x08298486 in mysql_execute_
#10 0x082a3a12 in mysql_parse (thd=0x9a2cbc8,
rawbuf=
#11 0x0829611b in dispatch_command (command=COM_QUERY, thd=0x9a2cbc8,
packet=
#12 0x082955c8 in do_command (thd=0x9a2cbc8) at sql_parse.cc:903
#13 0x082926a6 in handle_
#14 0x00821919 in start_thread () from /lib/libpthread
#15 0x0076acce in clone () from /lib/libc.so.6
bzr version-info:
revision-id: <email address hidden>
date: 2011-02-20 11:35:26 +0300
build-date: 2011-02-24 14:18:39 +0200
revno: 2922
branch-nick: maria-5.3-mwl90
explain:
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 1 Using where
1 PRIMARY t3 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 13 const,<
3 SUBQUERY t1 ALL NULL NULL NULL NULL 5
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
test case:
CREATE TABLE t1 ( f2 int(11), f3 int(11)) ;
INSERT INTO t1 VALUES ('1','1'
CREATE TABLE t2 ( f3 int(11)) ;
CREATE TABLE t3 ( f1 int(11), f2 int(11), f3 int(11)) ;
INSERT INTO t3 VALUES ('964',
SELECT f2 FROM t3
WHERE ( f1 , f3 ) IN (
SELECT MIN( f3 ) , f3
FROM t2
) AND f3 = '0'
AND ( f3 , f3 ) IN (
SELECT f3 , COUNT( f2 )
FROM t1
);
Changed in maria: | |
milestone: | none → 5.3 |
assignee: | nobody → Sergey Petrunia (sergefp) |
Changed in maria: | |
status: | New → Fix Committed |
Changed in maria: | |
status: | Fix Committed → Fix Released |
The same crash was observed with maria-5.3 and maria-5.3-mwl128, but with a vastly different data set and query.
Unfortunately, it was not possible to extract an MTR test case. So, in order to repeat, mount the attached datadir and execute;
SELECT n_nationkey FROM nation JOIN supplier JOIN partsupp ON s_suppkey = ps_suppkey JOIN lineitem ON ps_partkey = l_partkey AND ps_suppkey = l_suppkey JOIN orders JOIN customer ON o_custkey = c_custkey WHERE ps_partkey = 199;
If the datadir is dumped and loaded fresh, the query stops crashing and starts reporting "Impossible where", which is due to ps_partkey not having a value of 199.