Bug #37842 | Assertion in DsMrr_impl::dsmrr_init, at handler.cc:4307 | ||
---|---|---|---|
Submitted: | 3 Jul 2008 17:05 | Modified: | 20 Nov 2010 23:07 |
Reporter: | Philip Stoev | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S1 (Critical) |
Version: | 6.0 | OS: | Any |
Assigned to: | Sergey Petrunya | CPU Architecture: | Any |
[3 Jul 2008 17:05]
Philip Stoev
[3 Jul 2008 17:56]
Philip Stoev
Test case: CREATE TABLE t1 ( `pk` int(11) NOT NULL AUTO_INCREMENT, `int_key` int(11) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `int_key` (`int_key`) ) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,9),(2,3),(3,8),(4,6),(5,9),(6,5),(7,5),(8,9),(9,1),(10,10); SELECT `pk` FROM t1 AS OUTR WHERE `int_key` = ALL ( SELECT `int_key` FROM t1 AS INNR WHERE INNR . `pk` >= 9 ); The inner query must use a >= to cause the bug. The exact relationship between the inner and the outer query is not important, both "= ALL" and "NOT IN" crash.
[3 Jul 2008 18:05]
Philip Stoev
The crash also happens if the same table is not used twice: SELECT `pk` FROM B AS OUTR WHERE `pk` NOT IN ( SELECT `int_nokey` FROM CC AS INNR WHERE INNR . `int_key` IS NOT NULL ) OR OUTR . `pk` IS NOT NULL
[11 Jul 2008 21:03]
Philip Stoev
Same crash happens for Innodb but a different query: --source include/have_innodb.inc DROP TABLE IF EXISTS `C`; CREATE TABLE `C` ( `pk` int(11) NOT NULL AUTO_INCREMENT, `int_nokey` int(11) NOT NULL, `int_key` int(11) NOT NULL, `date_key` date NOT NULL, `date_nokey` date NOT NULL, `time_key` time NOT NULL, `time_nokey` time NOT NULL, `datetime_key` datetime NOT NULL, `datetime_nokey` datetime NOT NULL, `varchar_key` varchar(1) NOT NULL, `varchar_nokey` varchar(1) NOT NULL, PRIMARY KEY (`pk`), KEY `int_key` (`int_key`), KEY `date_key` (`date_key`), KEY `time_key` (`time_key`), KEY `datetime_key` (`datetime_key`), KEY `varchar_key` (`varchar_key`) ) ENGINE=InnoDB; INSERT INTO `C` VALUES (1,5,5,'2003-12-26','2003-12-26','08:05:38','08:05:38','0000-00-00 00:00:00','0000-00-00 00:00:00','',''), (2,5,5,'0000-00-00','0000-00-00','15:34:08','15:34:08','0000-00-00 00:00:00','0000-00-00 00:00:00','p','p'), (3,0,0,'0000-00-00','0000-00-00','00:00:00','00:00:00','2009-09-14 08:36:26','2009-09-14 08:36:26','',''), (4,6,6,'2006-03-07','2006-03-07','00:00:00','00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','e','e'), (5,0,0,'2006-07-08','2006-07-08','00:00:00','00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','w','w'), (6,0,0,'2006-11-21','2006-11-21','23:58:52','23:58:52','2005-12-02 14:27:44','2005-12-02 14:27:44','',''), (7,3,3,'0000-00-00','0000-00-00','00:00:00','00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','p','p'), (8,9,9,'0000-00-00','0000-00-00','00:00:00','00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','d','d'), (9,5,5,'2002-09-23','2002-09-23','00:00:00','00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','w','w'), (10,0,0,'0000-00-00','0000-00-00','00:00:00','00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','z','z'); SELECT COUNT( OUTR . `int_key` ) AS X FROM C AS OUTR WHERE OUTR . `varchar_nokey` = ANY ( SELECT INNR . `varchar_key` AS Y FROM C AS INNR WHERE INNR . `int_key` <> 8 ) AND ( OUTR . `int_key` IS NOT NULL OR OUTR . `int_nokey` IS NULL ) ORDER BY OUTR . `int_key` , OUTR . `pk` LIMIT 5; optimizer_use_mrr = disable has no effect - the crash still happens.
[28 Jul 2008 22:52]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/50614 2679 Sergey Petrunia 2008-07-29 BUG#37842: Assertion in DsMrr_impl::dsmrr_init, at handler.cc:4307 - Make DsMrr_impl::dsmrr_init() handle the situation when the SQL layer re-starts the MRR scan - without having got eof, it can call h->ha_index_or_rnd_end(); h->ha_index_init(); h->multi_range_read_init(). - Remove unneded parameters from dsmrr_init() and dsmrr_next(). - Don't reserve buffer space for key tuple in dsmrr_init() as it is not needed anymore (we used key tuple to save/restore MRR scan position but we've switched to cloning handler objects).
[2 Feb 2009 17:37]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/64906 2690 Sergey Petrunia 2009-02-02 Fix test results after merge of BUG#37842
[9 Feb 2009 10:31]
Bugs System
Pushed into 6.0.10-alpha (revid:sergefp@mysql.com-20090205082222-ph8f7zi9cst1lvnk) (version source revid:sergefp@mysql.com-20090202173654-th9tq8czbfmzzuzb) (merge vers: 6.0.10-alpha) (pib:6)
[10 Feb 2009 14:07]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/65750 2813 He Zhenxing 2009-02-10 [merge] Auto merge 6.0 -> 6.0-rpl
[16 Feb 2009 13:14]
Sergey Petrunya
Notes for the changelog: One could hit assertion failure when trying to execute a query with a subquery such that one of subquery's tables was accessed using DS-MRR.
[20 Feb 2009 20:50]
Paul DuBois
Noted in 6.0.10 changelog.
[16 Aug 2010 6:33]
Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100816062819-bluwgdq8q4xysmlg) (version source revid:alik@sun.com-20100816062612-enatdwnv809iw3s9) (pib:20)
[13 Nov 2010 16:05]
Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:vasil.dimov@oracle.com-20100629074804-359l9m9gniauxr94) (merge vers: 5.6.99-m4) (pib:21)
[20 Nov 2010 23:07]
Paul DuBois
Noted in 5.6.1 changelog.
[23 Nov 2010 2:09]
Paul DuBois
Correction: No 5.6.1 changelog entry. Bug does not appear in any released 5.6.x version.