Bug #31890 | Partitions: ORDER BY DESC not working | ||
---|---|---|---|
Submitted: | 26 Oct 2007 19:46 | Modified: | 14 Dec 2007 16:59 |
Reporter: | Peter Gulutzan | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Partitions | Severity: | S3 (Non-critical) |
Version: | 5.1.23-beta-debug | OS: | Linux (SUSE 10 64-bit) |
Assigned to: | Alexey Botchkov | CPU Architecture: | Any |
Tags: | by desc, order, partitioning |
[26 Oct 2007 19:46]
Peter Gulutzan
[26 Oct 2007 22:13]
MySQL Verification Team
Thank you for the bug report. Verified as described.
[29 Oct 2007 14:37]
Timour Katchaounov
P2 as wrong order => bad data.
[14 Nov 2007 18: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/37764 ChangeSet@1.2648, 2007-11-14 22:20:31+04:00, holyfoot@mysql.com +4 -0 Bug #31890 Partitions: ORDER BY DESC in InnoDB not working. It's not InnoDB specific bug. Error is in QUEUE code, about the way we handle queue->max_at_top. It's either '0' or '-2' and we do '^' operation to get the proper direction. Though queue->compare() function can return '-2' as a result of comparison sometimes. So we'll get queue->compare() ^ queue->max_at_top == 0 (when max_at_top is -2) and _downheap() function code will go wrong way here: ... if (next_index < elements && (queue->compare(queue->first_cmp_arg, queue->root[next_index]+offset_to_key, queue->root[next_index+1]+offset_to_key) ^ queue->max_at_top) > 0) next_index++; ... Fixed by changing max_at_top to be either 1 or -1, doing '* max_at_top' to get proper direction.
[14 Dec 2007 8:19]
Bugs System
Pushed into 5.1.23-rc
[14 Dec 2007 8:22]
Bugs System
Pushed into 6.0.5-alpha
[14 Dec 2007 16:59]
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.23 and 6.0.5 changelogs as follows: ORDER BY ... DESC did not always work correctly when selecting from partitioned tables. Removed InnoDB from Synopsis since developer notes indicate this wasn't an InnoDB-specific issue.