Bug #24186 | nested query across partitions returns fewer records | ||
---|---|---|---|
Submitted: | 10 Nov 2006 13:08 | Modified: | 1 Feb 2007 0:04 |
Reporter: | Giuseppe Maxia | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Partitions | Severity: | S1 (Critical) |
Version: | 5.1.11,5.1.13 | OS: | Linux (Linux) |
Assigned to: | Alexey Botchkov | CPU Architecture: | Any |
Tags: | nested query, partitions, Q1, subquery |
[10 Nov 2006 13:08]
Giuseppe Maxia
[10 Nov 2006 14:47]
Giuseppe Maxia
Test script and expected result for bug 24186
Attachment: bug_24186_test.zip (application/zip, text), 1.58 KiB.
[10 Nov 2006 14:49]
Giuseppe Maxia
Added a smaller test case, with less attributes and a simpler query. (see attached file http://bugs.mysql.com/file.php?id=4857 )
[11 Nov 2006 15:58]
Giuseppe Maxia
Wider test case (checks partitions by key, list, range, hash) for three engines (MyISAM, InnoDB, Archive)
Attachment: bug_24186.pl (text/x-perl), 5.57 KiB.
[11 Nov 2006 16:09]
Giuseppe Maxia
New batch of 138 tests added (http://bugs.mysql.com/file.php?id=4874). It's a wider set of test, probing partitions by list, range, key, and hash for three different engines (MyISAM, InnoDB, Archive). For each partition type, there are two tests, one by date and one by number. The bug kicks only with partitions by date, where a key is involved. The Archive engine is not affected. Changing the 'has_key' attribute to 0 for InnoDB and MyISAM will result in all tests being successful. This means that the bug affects only partitions depending on a key, with a date column. Running this test requires Perl + DBI + DBD::mysql
[14 Nov 2006 1:20]
Timothy Smith
Assigned to Timour (for Mikael) on behalf of Elliot
[18 Dec 2006 6:16]
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/17098 ChangeSet@1.2359, 2006-12-18 10:50:35+04:00, holyfoot@mysql.com +3 -0 bug #24186 (nested query across partitions returns fewer records) Subselect's engine checks table->status field to determine if the record was properly found when we use keyread on the table. Partition's engine tries to read all it's partitions looking for given key before return. So if matching record was found in first partition, and no matching records was in second, we have table->status=NOT_FOUND after partition searching returns. It makes subselects to skip matching data in result. Here i just added table->status=0 if we found something matching before.
[20 Dec 2006 17:15]
Giuseppe Maxia
updated test for bug #24186
Attachment: bug_24186test.tar.gz (application/gzip, text), 887 bytes.
[12 Jan 2007 11:10]
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/18018 ChangeSet@1.2384, 2007-01-12 15:46:20+04:00, holyfoot@mysql.com +3 -0 bug #24186 (nested query across partitions returns fewer records) Subselect's engine checks table->status field to determine if the record was properly found when we use keyread upon the table. Partition engine checks all the partitions for given key before return. So if matching record was found in the first partition and no matching records were found in the second, we have table->status == NOT_FOUND after the function, what makes subselects to skip matching records. The patch adds table->status= 0 if we actually found something.
[13 Jan 2007 9:26]
Giuseppe Maxia
QA_TEST_PASS The proposed patch passes all the simple and extended tests created for this bug. There were no side effects.
[28 Jan 2007 2:31]
Igor Babaev
The fix has been pushed into 5.1.16-beta main tree.
[1 Feb 2007 0:04]
Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at http://dev.mysql.com/doc/en/installing-source.html Documented bugfix in 5.1.16 changelog.