| Bug #57396 | Got error 4259 'Invalid set of range scan bounds' from NDBCLUSTER | ||
|---|---|---|---|
| Submitted: | 12 Oct 2010 8:27 | Modified: | 17 Oct 2010 8:13 |
| Reporter: | Ole John Aske | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Cluster: Cluster (NDB) storage engine | Severity: | S3 (Non-critical) |
| Version: | 5.1.47-ndb-7.1.9 | OS: | Any |
| Assigned to: | Pekka Nousiainen | CPU Architecture: | Any |
[13 Oct 2010 17:38]
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/120715 3295 Pekka Nousiainen 2010-10-13 bug#57396 a01_patch.diff MRR empty range sets wrong index attr id
[13 Oct 2010 18:36]
Bugs System
Pushed into mysql-5.1-telco-7.0 5.1.47-ndb-7.0.20 (revid:pekka@mysql.com-20101013181004-1s1fhfeirf6f41h5) (version source revid:pekka@mysql.com-20101013181004-1s1fhfeirf6f41h5) (merge vers: 5.1.47-ndb-7.0.20) (pib:21)
[13 Oct 2010 18:40]
Bugs System
Pushed into mysql-5.1-telco-6.3 5.1.47-ndb-6.3.39 (revid:pekka@mysql.com-20101013173652-pb0atp15tst1qd4q) (version source revid:pekka@mysql.com-20101013173652-pb0atp15tst1qd4q) (merge vers: 5.1.47-ndb-6.3.39) (pib:21)
[14 Oct 2010 9:21]
Pekka Nousiainen
This is what happened: - optimizer creates index scan with no bounds - scan goes via MRR (as always nowadays?) - Ndb needs to piggy-back range no on the bound - so a bound "NULL LE attr0" (always true) is added - but insert_open_bound() sets wrong attr id
[15 Oct 2010 11:53]
Jonas Oreland
pushed to 6.3.39, 7.0.20 and 7.1.9
[17 Oct 2010 8:13]
Jon Stephens
Documented as follows in the NDB-6.3.39, 7.0.20, and 7.1.9 changelogs:
Specifying a WHERE clause of the form range1 OR range2 when
selecting from an NDB table having a primary key on multiple
columns could result in error 4259 Invalid set of range scan
bounds if range2 started exactly where range1 ended and the
primary key definition declared the columns in a different order
relative to the order in the table's column list.
*Example*: Suppose t is an NDB table defined by the following
CREATE TABLE statement:
CREATE TABLE t (a, b, PRIMARY KEY (b, a)) ENGINE NDB;
This issue could then be triggered by a query such as this one:
SELECT * FROM t WHERE b < 8 OR b >= 8;
Closed.

Description: Specifying a WHERE clause of the form '<range1> OR <range2>' may result in 'error 4259 'Invalid set of range scan bounds''. This happens iff: - 'range2' starts exactly where 'range1' ends. (Which implies that the optimizer can, and maybe even is supposed to, replace entire WHERE clause with a 'true' - Order between 'range1' and 'range2' seems to matter. Changing to '<range2> or <range1> makes the problem go away. - Order of the columns in primary key declaration relative to the order in the column list seems to matter. In 'How to repeat' t1 is declared '(a,b,pk(b,a)). If this is changed to the equivalent '(b,a,pk(b,a)) the problem goes away. How to repeat: create table t1 (a int, b int, primary key (b,a)) engine=ndb; insert into t1(a,b) values(0,0); select * from t1 where b < 8 or b >= 8; --> ERROR 1296 (HY000): Got error 4259 'Invalid set of range scan bounds' from NDBCLUSTER Any constant value will reproduce the problem, However, it has to be the same in both the '<' and '>=' predicate term.