Bug #17729 Result corruption with ORDER BY and NDB tables
Submitted: 27 Feb 2006 0:15 Modified: 29 Mar 2006 8:02
Reporter: Simon Garner Email Updates:
Status: Closed Impact on me:
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:5.0.18 OS:Linux (linux)
Assigned to: Jonas Oreland CPU Architecture:Any

[27 Feb 2006 0:15] Simon Garner
We are seeing an odd problem with selecting from a particular NDB Cluster table using a particular index and ordering by one of the columns in the index. The data in some columns of the result is being corrupted and showing incorrect values (some values from other rows, and some values that are just bogus e.g. 'ë030-28-33 27:89:77' as a datetime value).

The query can be simplified down to:

SELECT * FROM TableName USE INDEX (BrokenIndex) WHERE IndexIntCol = 1 AND (IndexDateCol IS NULL OR IndexDateCol > NOW()) ORDER BY IndexDateCol ASC;

BrokenIndex is an index on (IndexIntCol, IndexDateCol)

The corrupted result columns are other columns in the table (not columns in the index).

I have tried recreating the index but all that happens is the bogus values change to different ones. The same query with a different index or no USE INDEX works fine (but slowly). (We have to use USE INDEX because NDB always selects the wrong indexes.)

How to repeat:
See private comment.
[27 Feb 2006 0:17] Simon Garner
I forgot to add that changing the ORDER BY from ASC to DESC also gives the correct values in all the result columns.
[27 Feb 2006 10:54] Valeriy Kravchuk
Thank you for a problem report. You can upload your test case as private file, using the Files tab.
[27 Mar 2006 14:54] Jonas Oreland
Simple testcase

Attachment: bug17729.sql (text/x-sql), 1.76 KiB.

[27 Mar 2006 14:55] Jonas Oreland
This "Simple testcase" gives incorrect result when running debug on 5.0.20 amd64
[28 Mar 2006 13:02] Jonas Oreland
[29 Mar 2006 7:04] Jonas Oreland
pushed into 5.0.20
[29 Mar 2006 8:02] 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 bugfix, yourself. More information 
about accessing the source trees is available at

Additional info:

Documented bugfix in 5.0.20 changelog. Closed.