Crash in JOIN_CACHE::get_offset with join_cache_level=6 in maria 5.3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
High
|
Igor Babaev |
Bug Description
The following query:
SELECT MAX( table2 . `col_varchar_key` ) AS field1 FROM ( C AS table1 STRAIGHT_JOIN ( ( B AS table2 RIGHT JOIN CC AS table3 ON (( table3 .`pk` > table2 . `pk` ) AND (table3 .`pk` <= table2 . `col_int_key` ) ) ) ) ON (( table3 . `col_varchar_key` = table2 . `col_varchar_nokey` ) AND ( table3 . `pk` = table2 . `col_int_key` ) ) ) HAVING field1 <= 'm';
causes the following crash:
# 2010-08-24T10:45:49 #3 0x0828048a in handle_segfault (sig=11) at mysqld.cc:2706
# 2010-08-24T10:45:49 #4 <signal handler called>
# 2010-08-24T10:45:49 #5 0x082dbc46 in JOIN_CACHE:
# 2010-08-24T10:45:49 #6 0x082dbd22 in JOIN_CACHE:
# 2010-08-24T10:45:49 #7 0x082d90ed in JOIN_CACHE:
# 2010-08-24T10:45:49 at sql_join_
# 2010-08-24T10:45:49 #8 0x082da6c3 in JOIN_CACHE_
# 2010-08-24T10:45:49 #9 0x082d9f1d in bka_range_seq_next (rseq=0x99e1e468, range=0x9a1dcaa8) at sql_join_
# 2010-08-24T10:45:49 #10 0x08499998 in DsMrr_impl:
# 2010-08-24T10:45:49 #11 0x084989a7 in DsMrr_impl:
# 2010-08-24T10:45:49 buf=0x99e1e4ec) at multi_range_
# 2010-08-24T10:45:49 #12 0x0866a751 in ha_innobase:
# 2010-08-24T10:45:49 at handler/
# 2010-08-24T10:45:49 #13 0x082da42c in JOIN_CACHE_
# 2010-08-24T10:45:49 #14 0x082da17d in JOIN_CACHE_
# 2010-08-24T10:45:49 #15 0x082d9352 in JOIN_CACHE:
# 2010-08-24T10:45:49 #16 0x082d9484 in JOIN_CACHE:
# 2010-08-24T10:45:49 #17 0x0831f382 in sub_select_cache (join=0x99e25260, join_tab=
# 2010-08-24T10:45:49 #18 0x0831f59b in sub_select (join=0x99e25260, join_tab=
# 2010-08-24T10:45:49 #19 0x0831eb55 in do_select (join=0x99e25260, fields=0x99e2a02c, table=0x0, procedure=0x0) at sql_select.cc:12636
# 2010-08-24T10:45:49 #20 0x08304ed7 in JOIN::exec (this=0x99e25260) at sql_select.cc:2355
# 2010-08-24T10:45:49 #21 0x0830560d in mysql_select (thd=0xbcc5828, rref_pointer_
# 2010-08-24T10:45:49 group=0x0, having=0x99e21938, proc_param=0x0, select_
# 2010-08-24T10:45:49 #22 0x082fdbff in handle_select (thd=0xbcc5828, lex=0xbcc6ea8, result=0x99ec7b60, setup_tables_
# 2010-08-24T10:45:49 #23 0x0829c1a4 in execute_
# 2010-08-24T10:45:49 #24 0x08292b7c in mysql_execute_
# 2010-08-24T10:45:49 #25 0x0829e365 in mysql_parse (thd=0xbcc5828,
# 2010-08-24T10:45:49 inBuf=0x99e2d6c8 "SELECT MAX( table2 . `col_varchar_key` ) AS field1 FROM ( C AS table1 STRAIGHT_JOIN ( ( B AS table2 RIGHT JOIN CC AS table3 ON (( table3 .`pk` > table2 . `pk` ) AND (table3 .`pk` <= table2 . `col_int_key` ) ) ) ) ON (( table3 . `col_varchar_key` = table2 . `col_varchar_nokey` ) AND ( table3 . `pk` = table2 . `col_int_key` ) ) ) HAVING field1 <= 'm'", length=357, found_semicolon
# 2010-08-24T10:45:49 #26 0x08290632 in dispatch_command (command=COM_QUERY, thd=0xbcc5828, packet=0xbcc7849 "", packet_length=359) at sql_parse.cc:1184
# 2010-08-24T10:45:49 #27 0x0828fb20 in do_command (thd=0xbcc5828) at sql_parse.cc:890
# 2010-08-24T10:45:49 #28 0x0828cb58 in handle_
# 2010-08-24T10:45:49 #29 0x00a08919 in start_thread () from /lib/libpthread
# 2010-08-24T10:45:49 #30 0x001ede5e in clone () from /lib/libc.so.6
bzr version-info:
revision-id: <email address hidden>
date: 2010-08-19 19:52:58 +0200
build-date: 2010-08-24 10:48:53 +0300
revno: 2821
branch-nick: maria-5.3-dsmrr-cpk
Changed in maria: | |
status: | Confirmed → Fix Committed |
Changed in maria: | |
status: | Fix Committed → Fix Released |
Test case:
--source include/ have_innodb. inc
SET SESSION join_cache_level=6;
CREATE TABLE `CC` ( key`,`col_ int_key` ) key`,`col_ int_key` ) key`,`col_ int_key` )
`pk` int(11) NOT NULL AUTO_INCREMENT,
`col_int_key` int(11) DEFAULT NULL,
`col_varchar_key` varchar(1) DEFAULT NULL,
PRIMARY KEY (`pk`),
KEY `col_varchar_key` (`col_varchar_
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
INSERT INTO `CC` VALUES (29,4,'c');
INSERT INTO `CC` VALUES (17,0,'z');
CREATE TABLE `C` (
`pk` int(11) NOT NULL AUTO_INCREMENT,
`col_int_key` int(11) DEFAULT NULL,
`col_varchar_key` varchar(1) DEFAULT NULL,
PRIMARY KEY (`pk`),
KEY `col_varchar_key` (`col_varchar_
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
INSERT INTO `C` VALUES (11,0,NULL);
INSERT INTO `C` VALUES (18,5,'y');
CREATE TABLE `B` (
`pk` int(11) NOT NULL AUTO_INCREMENT,
`col_int_key` int(11) DEFAULT NULL,
`col_varchar_key` varchar(1) DEFAULT NULL,
PRIMARY KEY (`pk`),
KEY `col_varchar_key` (`col_varchar_
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
INSERT INTO `B` VALUES (1,7,'f');
SELECT table2 .`col_varchar_key`
FROM C STRAIGHT_JOIN ( B table2 JOIN CC table3 ON table2 .`pk` ) ON table3 .`col_varchar_key` AND table3 .`pk` = table2 .`col_int_key` ;