[MDEV-2558] LP:872280 - Wrong sort order with ORDER BY Created: 2011-10-11 Updated: 2012-10-04 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Anton Khalikov (Inactive) | Assignee: | Unassigned |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
We've found a bug with wrong sort ordering of text data when using ORDER BY. Plase see the attached sql-file with test data. After importing it if you run: select * from test_items_g order by item_name; you'd see almost at the end of the list:
now almost the same query with extra WHERE: > select * from test_items_g where item_name like "Aurora RH04%" order by item_name;
--------
-------- This happens with MariaDB installed from package 5.2.9-mariadb102~squeeze (amd64 version) on Debian Squeeze with kernel 2.6.32-bpo.4-amd64 |
| Comments |
| Comment by Anton Khalikov (Inactive) [ 2011-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong sort order with ORDER BY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Anton Khalikov (Inactive) [ 2011-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Test data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2011-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong sort order with ORDER BY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Anton Khalikov (Inactive) [ 2011-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong sort order with ORDER BY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Anton Khalikov (Inactive) [ 2011-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong sort order with ORDER BY Correct order of items:
---
--- Incorrect order of items:
---
--- One more incorrect order:
---
--- One may notice that incorrect order only happens when "using filesort" is present. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Anton Khalikov (Inactive) [ 2011-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong sort order with ORDER BY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Anton Khalikov (Inactive) [ 2011-10-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong sort order with ORDER BY #query_cache_limit = 8M to query_cache_limit = 1M and that's it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2011-10-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong sort order with ORDER BY I was unable to repeat the problem using a 32-bit linux and the same MariaDB version. My best guess is that you have suffered some transient corruption that got cured when you restarted the server in order to change your cache settings. Either the table got auto-repaired or the restart itself cleared up a corrupt result that was stored in the query cache. If you keep the error logs from the server from before the latest restart, please review them for any suspicious error messages. Otherwise, if this issue happens again, please reopen the bug and we will take it from there. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Anton Khalikov (Inactive) [ 2011-10-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong sort order with ORDER BY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Anton Khalikov (Inactive) [ 2011-10-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong sort order with ORDER BY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2011-10-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong sort order with ORDER BY In order for me to figure out what is going on, can you please answer the following questions. Apologies if I am overly verbose: 1. Does the issue appear on just a single machine, or you were able to repeat it on several machines? 2. Once the issue appears, it persists over restarts unless the cache value is changed, is that correct? 3. While you are observing the issue, are any other statements running on that table? In particular, does your workload include any ALTER or other DDL statements? 4. Can you try a different copy of mariadb on the server where the issue appears, for example MariaDB 5.3.1 beta? It is not so much about trying a different version, more about trying a different binary. 5. Can you reproduce the issue on a freshly-started server that has only executed the test data you provided, or the issue only appears if other activities have been performed on the server? Thank you. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Anton Khalikov (Inactive) [ 2011-10-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong sort order with ORDER BY Q: 1. Does the issue appear on just a single machine, or you were able to repeat it on several machines? Q: 2. Once the issue appears, it persists over restarts unless the cache value is changed, is that correct? Q: 3. While you are observing the issue, are any other statements running on that table? In particular, does your workload include any ALTER or other DDL statements? Q: 4. Can you try a different copy of mariadb on the server where the issue appears, for example MariaDB 5.3.1 beta? It is not so much about trying a different version, more about trying a different binary. Q: 5. Can you reproduce the issue on a freshly-started server that has only executed the test data you provided, or the issue only appears if other activities have been performed on the server? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2011-10-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong sort order with ORDER BY If you can, please do the following: 1. Reproduce the problem on a freshly started server that contains only the data that is required to reproduce the bug. 2. Once you have observed the wrong result, please use kill -9 to terminate the server instance; 3. Package the server's data and log directory and my.ini file in a ZIP file and attach it to this bug report. If the wrong result is due to database corruption, this procedure may allow us to isolate the corruption and transport it to our debugging environment for further analysis. Thank you. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Anton Khalikov (Inactive) [ 2011-10-16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong sort order with ORDER BY I just rsync'ed this database to another server running the same version of mariadb and I couldn't reproduce the problem with the same data there. So this is not a database corruption. Looks like my last resort is to try to run mariadb in chroot environment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Anton Khalikov (Inactive) [ 2011-10-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong sort order with ORDER BY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2011-10-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong sort order with ORDER BY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rasmus Johansson (Inactive) [ 2011-10-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Launchpad bug id: 872280 |