| Bug #31890 | Partitions: ORDER BY DESC not working | ||
|---|---|---|---|
| Submitted: | 26 Oct 2007 21:46 | Modified: | 14 Dec 2007 17:59 |
| Reporter: | Peter Gulutzan | ||
| Status: | Closed | ||
| Category: | Server: Partition | Severity: | S3 (Non-critical) |
| Version: | 5.1.23-beta-debug | OS: | Linux (SUSE 10 64-bit) |
| Assigned to: | Alexey Botchkov | Target Version: | 5.1+ |
| Tags: | partitioning, order, by desc | ||
| Triage: | D2 (Serious) | ||
[26 Oct 2007 21:46]
Peter Gulutzan
[27 Oct 2007 0:13]
Miguel Solorzano
Thank you for the bug report. Verified as described.
[29 Oct 2007 15:37]
Timour Katchaounov
P2 as wrong order => bad data.
[14 Nov 2007 19: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 9:19]
Bugs System
Pushed into 5.1.23-rc
[14 Dec 2007 9:22]
Bugs System
Pushed into 6.0.5-alpha
[14 Dec 2007 17: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.
