Bug #49459 Incorrect handling of too long string in condition pushdown
Submitted: 4 Dec 2009 14:05 Modified: 17 Dec 2009 13:11
Reporter: Jonas Oreland Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:mysql-5.1-telco-6.2 OS:Any
Assigned to: Martin Skold CPU Architecture:Any
Triage: Triaged: D2 (Serious) / R3 (Medium) / E3 (Medium)

[4 Dec 2009 14:05] Jonas Oreland
Description:
drop table if exists t1; create table t1 (a int primary key, b varchar(1)) engine = ndb; insert into t1 values (1,'a'), (2,'b'),(3,'c');

set engine_condition_pushdown=off;
select * from t1 where b <> 'aa';

set engine_condition_pushdown=on;
select * from t1 where b <> 'aa';

NOTE: only 'a' is actually pushed down into kernel in this case

How to repeat:
see above.
Affects RQG testing of SPJ.

Suggested fix:
.
[15 Dec 2009 12:13] Jonas Oreland
approved with a comment,
the inlined methods has extra ";" at end (will cause compiler warning)

e.g
+  void expect_length(Uint32 len)
+  {
+    length= len;
+  };
[15 Dec 2009 13:21] 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/94140

3050 Martin Skold	2009-12-15
      Bug#49459 Incorrect handling of too long string in condition pushdown: Added check if constant string is longer than field length, skip pushing condition if this is the case
      modified:
        mysql-test/suite/ndb/r/ndb_condition_pushdown.result
        mysql-test/suite/ndb/t/ndb_condition_pushdown.test
        sql/ha_ndbcluster_cond.cc
        sql/ha_ndbcluster_cond.h
[15 Dec 2009 14:21] 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/94148

3199 Martin Skold	2009-12-15 [merge]
      Merge (Bug#47054 Cluster only deletes first matched row in delete with left join: Resetting status, Bug#49459 Incorrect handling of too long string in condition pushdown)
      modified:
        mysql-test/suite/ndb/r/ndb_basic.result
        mysql-test/suite/ndb/r/ndb_condition_pushdown.result
        mysql-test/suite/ndb/t/ndb_basic.test
        mysql-test/suite/ndb/t/ndb_condition_pushdown.test
        sql/ha_ndbcluster.cc
        sql/ha_ndbcluster_cond.cc
        sql/ha_ndbcluster_cond.h
[15 Dec 2009 14:45] 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/94152

3285 Martin Skold	2009-12-15 [merge]
      Merge (Bug#47054 Cluster only deletes first matched row in delete with left join: Resetting status, Bug#49459 Incorrect handling of too long string in condition pushdown)
      modified:
        mysql-test/suite/ndb/r/ndb_basic.result
        mysql-test/suite/ndb/r/ndb_condition_pushdown.result
        mysql-test/suite/ndb/t/ndb_basic.test
        mysql-test/suite/ndb/t/ndb_condition_pushdown.test
        sql/ha_ndbcluster.cc
        sql/ha_ndbcluster_cond.cc
        sql/ha_ndbcluster_cond.h
[15 Dec 2009 21:47] 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/94296

3195 Martin Skold	2009-12-15 [merge]
      Merge (Bug#47054 Cluster only deletes first matched row in delete with left join: Resetting status, Bug#49459 Incorrect handling of too long string in condition pushdown)
      modified:
        mysql-test/suite/ndb/r/ndb_basic.result
        mysql-test/suite/ndb/r/ndb_condition_pushdown.result
        mysql-test/suite/ndb/t/ndb_basic.test
        mysql-test/suite/ndb/t/ndb_condition_pushdown.test
        sql/ha_ndbcluster.cc
        sql/ha_ndbcluster_cond.cc
        sql/ha_ndbcluster_cond.h
[15 Dec 2009 22:28] Bugs System
Pushed into 5.1.39-ndb-7.1.0 (revid:martin.skold@mysql.com-20091215222649-iqgd7vyvenqq6gzc) (version source revid:martin.skold@mysql.com-20091215214635-gzqxh7i2biqx4c6y) (merge vers: 5.1.39-ndb-7.1.0) (pib:14)
[15 Dec 2009 22:30] Bugs System
Pushed into 5.1.39-ndb-7.0.11 (revid:martin.skold@mysql.com-20091215222838-1pupv0vybeu4nyx5) (version source revid:martin.skold@mysql.com-20091215144450-atl23gwk7xaarxz4) (merge vers: 5.1.39-ndb-7.0.11) (pib:14)
[15 Dec 2009 22:34] Bugs System
Pushed into 5.1.39-ndb-6.3.31 (revid:martin.skold@mysql.com-20091215223321-36ia6mqwhjkoqhye) (version source revid:martin.skold@mysql.com-20091215142101-o3a15a2rl0xgj9k0) (merge vers: 5.1.39-ndb-6.3.31) (pib:14)
[15 Dec 2009 22:36] Bugs System
Pushed into 5.1.39-ndb-6.2.19 (revid:martin.skold@mysql.com-20091215223606-bj9da9b9gowbptvg) (version source revid:martin.skold@mysql.com-20091215132143-vqfik1zcdzzpkz55) (merge vers: 5.1.39-ndb-6.2.19) (pib:14)
[17 Dec 2009 13:11] Jon Stephens
Documented bugfix in the NDB-6.2.19, 6.3.31, and 7.0.11 changelogs, as follows:

        If a query on an NDB table compared a constant string value to a
        column, and the length of the string was greater than that of
        the column, condition pushdown did not work correctly. (The
        string was truncated to fit the column length before being
        pushed down.) Now in such cases, the condition is no longer
        pushed down.

Closed.