Bug #50335 | Assertion `!(order->used & map)' in eq_ref_table | ||
---|---|---|---|
Submitted: | 14 Jan 2010 15:42 | Modified: | 20 Jun 2010 22:39 |
Reporter: | Philip Stoev | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 5.0.91, 5.1.44, next-mr | OS: | Any |
Assigned to: | Alexey Kopytov | CPU Architecture: | Any |
[14 Jan 2010 15:42]
Philip Stoev
[21 Jan 2010 21:06]
Marc ALFF
Analysis: ========= The following test: drop table if exists test.EVENTS_WAITS_HISTORY; CREATE TABLE test.EVENTS_WAITS_HISTORY ( `THREAD_ID` int(11) NOT NULL, `EVENT_ID` bigint(20) unsigned NOT NULL, `EVENT_NAME` varchar(128) NOT NULL, `SOURCE` varchar(64) DEFAULT NULL, `TIMER_START` bigint(20) unsigned DEFAULT NULL, `TIMER_END` bigint(20) unsigned DEFAULT NULL, `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL, `SPINS` int(10) unsigned DEFAULT NULL, `OBJECT_SCHEMA` varchar(64) DEFAULT NULL, `OBJECT_NAME` varchar(512) DEFAULT NULL, `OBJECT_TYPE` varchar(64) DEFAULT NULL, `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL, `OPERATION` varchar(16) NOT NULL, `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL, `FLAGS` int(10) unsigned DEFAULT NULL ) ENGINE=MYISAM DEFAULT CHARSET=utf8; insert into test.EVENTS_WAITS_HISTORY( THREAD_ID, EVENT_ID, EVENT_NAME, SOURCE, TIMER_START, TIMER_END, TIMER_WAIT, SPINS, OBJECT_SCHEMA, OBJECT_TYPE, OBJECT_INSTANCE_BEGIN, NESTING_EVENT_ID, OPERATION, NUMBER_OF_BYTES, FLAGS) select THREAD_ID, EVENT_ID, EVENT_NAME, SOURCE, TIMER_START, TIMER_END, TIMER_WAIT, SPINS, OBJECT_SCHEMA, OBJECT_TYPE, OBJECT_INSTANCE_BEGIN, NESTING_EVENT_ID, OPERATION, NUMBER_OF_BYTES, FLAGS from performance_schema.EVENTS_WAITS_HISTORY; SELECT * FROM test .`EVENTS_WAITS_HISTORY` JOIN mysql .`time_zone_transition` ON `Transition_time` = `OBJECT_NAME` WHERE NOT ( NOT 2 OR `OBJECT_NAME` != `Time_zone_id` ) ORDER BY `Transition_type_id` , `OBJECT_NAME` ; drop table test.EVENTS_WAITS_HISTORY; crashes exactly in the same place, but does not involve a performance schema table. This seems to be an optimizer bug.
[21 Jan 2010 22:47]
Marc ALFF
Reduced the test case further, and verified in 5.0.91 drop table if exists test.t1; create table test.t1( `OBJECT_NAME` varchar(512) DEFAULT NULL, foo int); insert into t1 values (NULL, 1); insert into t1 values (NULL, 2); insert into t1 values (NULL, 3); insert into t1 values (NULL, 4); insert into t1 values (NULL, 5); insert into t1 values (NULL, 6); insert into t1 values (NULL, 7); SELECT * FROM test .t1 JOIN mysql .`time_zone_transition` ON `Transition_time` = `OBJECT_NAME` WHERE NOT ( NOT 2 OR `OBJECT_NAME` != `Time_zone_id` ) ORDER BY `Transition_type_id` , `OBJECT_NAME` ; drop table test.t1;
[21 Jan 2010 23:03]
Marc ALFF
Crashes in 5.1.44 as well.
[22 Jan 2010 10:03]
Guilhem Bichot
Same stack trace as BUG#49570, which has been fixed in 5.1, so maybe check if it fixes this one too.
[22 Jan 2010 15:26]
MySQL Verification Team
a much nicer testcase: drop table if exists `t1`; create table `t1`(`a` int,`b` int, primary key (`a`,`b`))engine=innodb; insert into `t1` values (); select 1 from `t1` `a` join `t1` `b` using(`a`) where `b`.`b`=`a`.`a` group by `a`.`a`,`b`.`a`; bug #49570 testcase didn't crash in my recent 5.1.43, but the above did.
[25 Feb 2010 15:49]
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/101472 3354 Alexey Kopytov 2010-02-25 Bug #50335: Assertion `!(order->used & map)' in eq_ref_table The problem was in an incorrect debug assertion. The expression used in the failing assertion states that when finding references matching ORDER BY expressions, there can be only one reference to a single table. But that does not make any sense, all test cases for this bug are valid examples with multiple identical WHERE expressions referencing the same table which are also present in the ORDER BY list. Fixed by removing the failing assertion. We also have to take care of the 'found' counter so that we count multiple references only once. We rely on this fact later in eq_ref_table(). @ mysql-test/r/join.result Added a test case for bug #50335. @ mysql-test/t/join.test Added a test case for bug #50335. @ sql/sql_select.cc Removing the assertion in eq_ref_table() as it does not make any sense. We also have to take care of the 'found' counter so that we count multiple references only once. We rely on this fact later in eq_ref_table().
[25 Feb 2010 16:25]
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/101491 3922 Alexey Kopytov 2010-02-25 [merge] Manual merge of the patch for bug #50335. Also picked the test case for bug #45195 that was previously null-merged to mysql-pe.
[1 Mar 2010 8:46]
Bugs System
Pushed into 5.1.45 (revid:joro@sun.com-20100301083827-xnimmrjg6bh33o1o) (version source revid:alexey.kopytov@sun.com-20100225162630-c9av8dkhy9mausyw) (merge vers: 5.1.45) (pib:16)
[2 Mar 2010 14:36]
Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100302142746-u1gxdf5yk2bjrq3e) (version source revid:alik@sun.com-20100301095421-4cz64ibem1h2quve) (merge vers: 6.0.14-alpha) (pib:16)
[2 Mar 2010 14:41]
Bugs System
Pushed into 5.5.3-m2 (revid:alik@sun.com-20100302072233-t3uqgjzdukt1pyhe) (version source revid:alexey.kopytov@sun.com-20100226130631-8czhisohzf6jyo2x) (merge vers: 5.5.3-m2) (pib:16)
[2 Mar 2010 14:46]
Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100302072432-k8xvfkgcggkwgi94) (version source revid:alik@sun.com-20100301093944-a4rvrmqqco6c0qao) (pib:16)
[8 Apr 2010 17:42]
Paul DuBois
Noted in 5.1.45, 5.5.3, 6.0.14 changelogs. A debugging assertion was incorrectly raised in the optimizer when matching ORDER BY expressions.
[26 Apr 2010 20:06]
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/106567 2858 Alexey Kopytov 2010-04-27 Backport of the fix for bug #50335 to 5.0. The problem was in an incorrect debug assertion. The expression used in the failing assertion states that when finding references matching ORDER BY expressions, there can be only one reference to a single table. But that does not make any sense, all test cases for this bug are valid examples with multiple identical WHERE expressions referencing the same table which are also present in the ORDER BY list. Fixed by removing the failing assertion. We also have to take care of the 'found' counter so that we count multiple references only once. We rely on this fact later in eq_ref_table(). @ mysql-test/r/join.result Added a test case for bug #50335. @ mysql-test/t/join.test Added a test case for bug #50335. @ sql/sql_select.cc Removing the assertion in eq_ref_table() as it does not make any sense. We also have to take care of the 'found' counter so that we count multiple references only once. We rely on this fact later in eq_ref_table().
[1 May 2010 13:47]
Bugs System
Pushed into 5.0.91 (revid:joro@sun.com-20100501134604-ra243s5b389j6ttn) (version source revid:alexey.kopytov@sun.com-20100426200600-op06qy98llzpzgl1) (merge vers: 5.0.91) (pib:16)
[4 May 2010 14:18]
Paul DuBois
Noted in 5.0.91 changelog.
[5 May 2010 15:09]
Bugs System
Pushed into 5.1.47 (revid:joro@sun.com-20100505145753-ivlt4hclbrjy8eye) (version source revid:vvaintroub@mysql.com-20100427092945-q8gxqolhp3prtb1s) (merge vers: 5.1.47) (pib:16)
[28 May 2010 6:03]
Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100524190136-egaq7e8zgkwb9aqi) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (pib:16)
[28 May 2010 6:31]
Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100524190941-nuudpx60if25wsvx) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[28 May 2010 6:59]
Bugs System
Pushed into 5.5.5-m3 (revid:alik@sun.com-20100524185725-c8k5q7v60i5nix3t) (version source revid:alexey.kopytov@sun.com-20100429203306-tg0wz4y2xyx8edrl) (merge vers: 5.5.5-m3) (pib:16)
[30 May 2010 0:32]
Paul DuBois
Push resulted from incorporation of InnoDB tree. No changes pertinent to this bug. Re-closing.
[17 Jun 2010 12:07]
Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 12:52]
Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 13:34]
Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)