Bug #38204 NDBAPI : MRR IndexScan fails with certain bound lengths
Submitted: 17 Jul 2008 16:28 Modified: 15 Oct 2008 15:53
Reporter: Frazer Clement Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: NDB API Severity:S3 (Non-critical)
Version:5.1 + OS:Any
Assigned to: Frazer Clement CPU Architecture:Any

[17 Jul 2008 16:28] Frazer Clement
Description:
LQH code for splicing received MRR KEYINFO into separate bounds has a bug when a bound starts and ends within the same 4 word KeyBuf structure.
This causes it to split bounds incorrectly and TUX to choke on the bad bound definition, resulting in various errors including 4110.

How to repeat:
MRR scan with multiple bounds, one of whose KEYINFO words starts + ends within a 4 word boundary, but not on the boundary with a bound following.
e.g.
Uint columns
A   B   C   D

A>3 (3 words)    Buf 0,0 to Buf 0, 2
B>NULL (2 words) Buf 0,3 to Buf 1, 0
C>NULL (2 words) Buf 1,1 to Buf 1, 3
D>4    (any number of words)

Suggested fix:
Increment data buffer offset correctly in Dblqh::copy_bounds
[18 Jul 2008 12:13] Jonas Oreland
can you make a mtr testcase aswell?
[21 Jul 2008 13:44] Frazer Clement
MTR testcase seems tough to create as it requires : 
- Scan range(s) using 4N+1 words of KeyInfo.
- Scan range using 2 words of KeyInfo (IS NULL or IS NOT NULL only)
- A further scan range of any size.

MySQLD seems to sort the ranges by selectivity (most selective first), and IS NULL or IS NOT NULL seem to have low selectivity, so it's hard to get a range 'after' the IS NULL or IS NOT NULL bound.

Don't want to spend too much time on this.
[21 Jul 2008 17:03] Jonas Oreland
ok,
and I saw that you added mrr to testOIBasic,
so, ok to push from 6.2 and upwards
[23 Jul 2008 10:55] 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/50292
[23 Jul 2008 11:16] 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/50294
[23 Jul 2008 11: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/50297
[23 Jul 2008 11:37] 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/50301
[11 Aug 2008 22:56] Jon Stephens
Need complete version numbers in which fix will appear in order to document. Thanks.
[15 Oct 2008 11:50] Frazer Clement
Pushed to 6.2.16, 6.3.17, 6.4.0
[15 Oct 2008 15:53] Jon Stephens
Documented bugfix in the ndb-6.2.16 and ndb-6.3.17 changelogs as follows:

        Certain multi-range scans involving IS NULL and IS NOT NULL comparisons
        failed with an error in the NDB local query handler.