Crash in test_if_skip_sort_order with DISTINCT, view, InnoDB, on 64bit
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
Critical
|
Igor Babaev |
Bug Description
#3 <signal handler called>
#4 0x000000000079b7ea in test_if_
order=
map=0x2fe6e08) at sql_select.cc:17834
#5 0x0000000000772075 in JOIN::optimize (this=0x3038190) at sql_select.cc:1617
#6 0x00000000005d2f59 in st_select_
this=0x2e1d510) at sql_lex.cc:3127
#7 0x000000000085b969 in JOIN::optimize_
this=0x3030070) at opt_subselect.
#8 0x0000000000771c01 in JOIN::optimize (this=0x3030070) at sql_select.cc:1566
#9 0x0000000000776c07 in mysql_select (thd=0x2e1ab88,
rref_
conds=
proc_param=0x0, select_
unit=0x2e1d028, select_
#10 0x000000000076d5dd in handle_select (thd=0x2e1ab88, lex=0x2e1cf88,
result=
#11 0x00000000006fc744 in execute_
all_
#12 0x00000000006f381a in mysql_execute_
at sql_parse.cc:2250
#13 0x00000000006ff124 in mysql_parse (thd=0x2e1ab88,
rawbuf=
at sql_parse.cc:6113
#14 0x00000000006f1032 in dispatch_command (command=COM_QUERY, thd=0x2e1ab88,
packet=
#15 0x00000000006f0366 in do_command (thd=0x2e1ab88) at sql_parse.cc:916
#16 0x00000000006ed2bc in handle_
at sql_connect.cc:1191
#17 0x00007fac5381ca4f in start_thread () from /lib64/
#18 0x00007fac52c0682d in clone () from /lib64/libc.so.6
I could only reproduce it on one of two machines that I currently have access to:
openSUSE 11.3 (x86_64) -- reproducible
Fedora 12 32-bit -- not reproducible
Judging by the indicative number on the top of the stack trace, my guess is it's 64bit that makes the difference. However, if you cannot repeat it, please let me know and I will try to find more machines to experiment with.
bzr version-info
revision-id: <email address hidden>
date: 2011-12-08 04:22:38 +0400
build-date: 2011-12-09 23:25:32 +0200
revno: 3337
branch-nick: maria-5.3
Also reproducible on 5.3.2 release if materialization
Minimal optimizer_switch: none
(It looks like materialization
Full optimizer_switch: index_merge=
EXPLAIN also crashes.
Test case:
--source include/
# t1 must be InnoDB
CREATE TABLE t1 ( pk INT PRIMARY KEY, a INT, KEY(a) )
ENGINE=InnoDB;
INSERT INTO t1 VALUES (0, 4),(8, 6);
CREATE TABLE t2 ( b INT, KEY(b) );
INSERT INTO t2 VALUES (7),(0);
# The view needs to be UNDEFINED or MERGE
CREATE VIEW view_t1 AS SELECT * FROM t1;
SELECT * FROM t1, t2
WHERE ( 2, 9 ) IN
( SELECT DISTINCT a, pk FROM view_t1 )
OR a = b;
Changed in maria: | |
milestone: | none → 5.3 |
assignee: | nobody → Timour Katchaounov (timour) |
Changed in maria: | |
status: | New → Confirmed |
importance: | Undecided → High |
Changed in maria: | |
importance: | High → Critical |
Changed in maria: | |
status: | Confirmed → In Progress |
Changed in maria: | |
status: | Confirmed → Fix Committed |
The crash is in test_if_ skip_sort_ order() in the line:
if (used_key_parts > used_index_parts)
used_pk_ parts= used_key_ parts-used_ index_parts;
rec_ per_key= keyinfo- >rec_per_ key[used_ key_parts- 1];
where used_key_parts == 0, which results in an access to >rec_per_ key[-1]
keyinfo-