Bug #35931 | List partition MyISAM table returns erroneous results | ||
---|---|---|---|
Submitted: | 9 Apr 2008 10:44 | Modified: | 23 Jul 2008 12:48 |
Reporter: | George Vitek | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Partitions | Severity: | S2 (Serious) |
Version: | 5.1.23, 5.1.25 | OS: | Linux |
Assigned to: | Mattias Jonsson | CPU Architecture: | Any |
[9 Apr 2008 10:44]
George Vitek
[9 Apr 2008 11:13]
Valeriy Kravchuk
Thank you for a bug report. Verified just as described on latest 5.1.25: openxs@suse:~/dbs/5.1> bin/mysql -uroot test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.1.25-rc Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> drop table t; ERROR 1051 (42S02): Unknown table 't' mysql> CREATE TABLE t ( -> a int NOT NULL, -> b mediumint NOT NULL, -> c int NOT NULL, -> KEY b (b) -> ) ENGINE=MyISAM -> PARTITION BY LIST (a) ( -> PARTITION p0 VALUES IN (1) -> ); Query OK, 0 rows affected (0.07 sec) mysql> INSERT INTO t VALUES (1,1,0), (1,1,1), (1,1,2), (1,1,53), (1,1,4), (1,1,5), (1,1,6), ... -> (1,15,27), (1,15,49), (1,16,0), (1,16,1), (1,16,3), (1,17,4), (1,19,1); Query OK, 321 rows affected (0.01 sec) Records: 321 Duplicates: 0 Warnings: 0 mysql> SELECT count(*) FROM t WHERE b NOT IN ( 1,2,6,7,9,10,11 ); +----------+ | count(*) | +----------+ | 168 | +----------+ 1 row in set (0.01 sec) mysql> SELECT sum(c) FROM t WHERE b NOT IN ( 1,2,6,7,9,10,11 ); +--------+ | sum(c) | +--------+ | 2800 | +--------+ 1 row in set (0.01 sec) mysql> ALTER TABLE t DROP INDEX b; Query OK, 321 rows affected (0.00 sec) Records: 321 Duplicates: 0 Warnings: 0 mysql> SELECT count(*) FROM t WHERE b NOT IN ( 1,2,6,7,9,10,11 ); +----------+ | count(*) | +----------+ | 24 | +----------+ 1 row in set (0.00 sec) mysql> SELECT sum(c) FROM t WHERE b NOT IN ( 1,2,6,7,9,10,11 ); +--------+ | sum(c) | +--------+ | 400 | +--------+ 1 row in set (0.00 sec)
[10 Apr 2008 13:01]
Mattias Jonsson
Hmm, does not seem to exist in 6.0
[12 Apr 2008 8:23]
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/45307 ChangeSet@1.2576, 2008-04-12 10:22:07+02:00, mattiasj@witty. +3 -0 Bug#35931: List partition MyISAM table returns erroneous results Used the wrong function when fixing bug 30480 which lead to no stop on end_key resulting in duplicate results from index scan
[16 Jun 2008 10:25]
Mattias Jonsson
Marked Bug#37327 and Bug#37329 as duplicate of this. The problem is that there is no stop when reading the index, which results in it scans the index from the specified start to the very end. This results in both a big performance hit, as well of duplicate rows. Code wise was the bug introduced by me by using the wrong flag function (table_flags instead of index_flags) which never returned the correct flag and never breaking the scan loop. This error was done in Bug#30480, which is now corrected with this patch.
[16 Jun 2008 12:48]
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/47904 2656 Mattias Jonsson 2008-06-16 Bug#35931: Index search of partitioned MyISAM table returns erroneous results Used the wrong function when fixing bug 30480 which lead to no stop on end_key resulting in duplicate results from index scan (Includes test cases for the duplicate bugs 37327 and 37329, Duplicate rows and bad performance/High Handler_read_next values)
[17 Jun 2008 9:15]
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/47976 2664 Mattias Jonsson 2008-06-17 Bug#35931 Index search of partitioned MyISAM table returns erroneous results Used the wrong function when fixing bug nr 30480 which lead to no stop on end_key resulting in duplicate results from index scan Includes test cases for the duplicate 37327 and 37329, Duplicate rows and bad performance/High Handler_read_next values Recommit from bugteam tree.
[17 Jun 2008 10:41]
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/47984 2665 Mattias Jonsson 2008-06-17 Bug#35931 Index search of partitioned MyISAM table returns erroneous results Used the wrong function when fixing 30480 which lead to no stop on end_key resulting in duplicate results from index scan Includes test cases for the duplicates 37327 and 37329, Duplicate rows and bad performance/High Handler_read_next values Recommit after merge issues
[17 Jun 2008 12:36]
Mattias Jonsson
Sorry for all the commits, had some trouble when merging... Pushed into mysql-5.1-bugteam and mysql-6.0-bugteam
[23 Jun 2008 9:27]
Mattias Jonsson
Marked Bug#37219 as a duplicate of this bug.
[23 Jun 2008 10:23]
Mattias Jonsson
Marked bug#37235 a duplicate of this.
[23 Jul 2008 11:03]
Georgi Kodinov
Pushed into 5.1.28 and 6.0.7-alpha
[23 Jul 2008 12:48]
Jon Stephens
Documented bugfix in the 5.1.28 and 6.0.7 changelogs as follows: A LIST partitioned MyISAM table returned erroneous results when an index was present on a column in the WHERE clause and NOT IN was used on that column. Searches using the index were also much slower then if the index were not present.
[28 Jul 2008 16:49]
Bugs System
Pushed into 5.1.27 (revid:joerg@mysql.com-20080626161101-h5hsaluwtf05xdr2) (version source revid:joerg@mysql.com-20080626161101-h5hsaluwtf05xdr2) (pib:3)