Bug #42405 | Missing/Wrong rows on Falcon's ORDER BY ..LIMIT with range access on pk/index | ||
---|---|---|---|
Submitted: | 28 Jan 2009 9:25 | Modified: | 6 Apr 2009 11:55 |
Reporter: | Nidhi Shrotriya | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Server: Falcon storage engine | Severity: | S3 (Non-critical) |
Version: | 6.0 | OS: | Linux |
Assigned to: | Lars-Erik Bjørk | CPU Architecture: | Any |
Tags: | F_LIMIT |
[28 Jan 2009 9:25]
Nidhi Shrotriya
[28 Jan 2009 9:33]
Nidhi Shrotriya
Same happens in case of SELECT * FROM t2 WHERE c1 IN (101,115) ORDER BY c1,c6; c1 c2 c3 c4 c5 c6 c7 101 0 37 38 39 40 41 101 NULL 102 103 104 105 106 101 102 103 104 105 106 107 115 116 117 118 119 120 121 SELECT * FROM t2 WHERE c1 IN (101,115) ORDER BY c1,c6 LIMIT 2; c1 c2 c3 c4 c5 c6 c7 115 116 117 118 119 120 121
[28 Jan 2009 10:08]
Hakan Küçükyılmaz
Verified using latest mysql-6.0-falcon-team tree code: [11:07] root@test> SELECT * FROM t2 WHERE c1 <> 108 ORDER BY c1,c6 LIMIT 2; +-----+------+------+------+------+-----+------+ | c1 | c2 | c3 | c4 | c5 | c6 | c7 | +-----+------+------+------+------+-----+------+ | 115 | 116 | 117 | 118 | 119 | 120 | 121 | | 122 | 123 | 124 | 125 | 126 | 127 | 128 | +-----+------+------+------+------+-----+------+ 2 rows in set (0.00
[28 Jan 2009 11:05]
Nidhi Shrotriya
Same happens with this access on indexed column.
[28 Jan 2009 17:41]
Kevin Lewis
Ann, Can you determine if there is anything Falcon can do to collect successfully do a LIMIT search when there are multiple ranges? This might be a job for the optimizer. Note that this bug is like the problem found in Bug#41742, which was using the IN operator to create multiple ranges. That would fail with this test as well. mysql> SELECT * FROM t2 WHERE c1 IN (101, 115, 122) LIMIT 5; +-----+------+------+------+------+-----+------+ | c1 | c2 | c3 | c4 | c5 | c6 | c7 | +-----+------+------+------+------+-----+------+ | 101 | 102 | 103 | 104 | 105 | 106 | 107 | | 115 | 116 | 117 | 118 | 119 | 120 | 121 | | 122 | 123 | 124 | 125 | 126 | 127 | 128 | +-----+------+------+------+------+-----+------+ 3 rows in set (0.00 sec) mysql> SELECT * FROM t2 WHERE c1 IN (101, 115, 122) ORDER BY c1,c6 LIMIT 5; +-----+------+------+------+------+-----+------+ | c1 | c2 | c3 | c4 | c5 | c6 | c7 | +-----+------+------+------+------+-----+------+ | 122 | 123 | 124 | 125 | 126 | 127 | 128 | +-----+------+------+------+------+-----+------+ 1 row in set (0.00 sec) mysql> SELECT * FROM t2 WHERE c1 IN (101, 115, 122) ORDER BY c6 LIMIT 5; +-----+------+------+------+------+-----+------+ | c1 | c2 | c3 | c4 | c5 | c6 | c7 | +-----+------+------+------+------+-----+------+ | 101 | 102 | 103 | 104 | 105 | 106 | 107 | | 115 | 116 | 117 | 118 | 119 | 120 | 121 | | 122 | 123 | 124 | 125 | 126 | 127 | 128 | +-----+------+------+------+------+-----+------+ 3 rows in set (0.02 sec)
[5 Apr 2009 22:46]
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/71414 3097 Vladislav Vaintroub 2009-04-06 Bug#42208 Falcon's ORDER BY ..LIMIT gives wrong/inconsistent results on NULL values Bug#42405 Missing/Wrong rows on Falcon's ORDER BY ..LIMIT with range access on pk/index This patch introduces new Falcon index version. It changes handling of multisegment keys, so binary keys that differ in number of trailing zeros bytes are now considered different. Also, NULL in index is now different from 0, empty string (0x00) and zero length string and sorts according to SQL standard rules, less than any other value. (incorporated changes from Lars-Erik for Bug#42208) INDEX_CURRENT_VERSION is now 2. Minor ODS version is increased to 5. @ mysql-test/suite/falcon/r/falcon_bug_42208.result test for bug 42208 @ mysql-test/suite/falcon/r/falcon_index_v2.result test for correct sorting order of multisegment keys, NULLs and zero length keys @ mysql-test/suite/falcon/t/falcon_bug_42208.test test for bug 42208 @ mysql-test/suite/falcon/t/falcon_index_v2.test test for correct sorting order of multisegment keys, NULLs and zero length keys @ storage/falcon/Database.h Increase ODS version (new index format) @ storage/falcon/Index.cpp Increase ODS version (new index format) @ storage/falcon/Index.h Increase index version @ storage/falcon/StorageDatabase.cpp Use all keys provided by optimizer, do not break at NULLs (but not for index version 1, where NULL is broken)
[6 Apr 2009 11:50]
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/71442 3098 Vladislav Vaintroub 2009-04-06 Bug#42405 Missing/Wrong rows on Falcon's ORDER BY ..LIMIT with range access on pk/index The bug is no more reproducible. It is not known what exact change fixed the test.
[6 Apr 2009 11:55]
Vladislav Vaintroub
The bug is no more reproducible. Pushed the test for it.
[15 Apr 2009 16:59]
Bugs System
Pushed into 6.0.11-alpha (revid:hky@sun.com-20090415164923-9arx29ye5pzxd4zf) (version source revid:vvaintroub@mysql.com-20090406114905-nmvmlz0jr6ky1bss) (merge vers: 6.0.11-alpha) (pib:6)