Bug #49746 ndb_condition_pushdown fails in mysql-next-mr
Submitted: 16 Dec 2009 19:54 Modified: 2 Sep 2010 16:09
Reporter: Alexander Nozdrin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:mysql-next-mr, 5.5-M3 OS:Any
Assigned to: Evgeny Potemkin CPU Architecture:Any
Tags: disabled, regression

[16 Dec 2009 19:54] Alexander Nozdrin
Description:
The ndb_condition_pushdown started to fail in mysql-next-mr.
The test passes in mysql-trunk.

Symptoms:
@@ -513,7 +513,7 @@
 date_time = '1901-01-01 01:01:01' 
 order by auto;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	#	Using where with pushed condition; Using filesort
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	#	Using where; Using filesort
 select auto from t1 where 
 string = "aaaa" and 
 vstring = "aaaa" and 
@@ -570,7 +570,7 @@
 date_time != '1901-01-01 01:01:01' 
 order by auto;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	#	Using where with pushed condition; Using filesort
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	#	Using where; Using filesort
 select auto from t1 where 
 string != "aaaa" and 
 vstring != "aaaa" and 
...

How to repeat:
./mtr ndb_condition_pushdown
[16 Dec 2009 22:41] Sveta Smirnova
Thank you for the report.

Verified as described.
[27 Jan 2010 14:37] Manyi Lu
Sveta, could you please verify against 6.0-codebase-bugfixing tree as well?

Thanks.
[27 Jan 2010 20:55] Guilhem Bichot
for what it's worth, I saw this failure, repeatable, on 6.0-codebase-bugfixing a few days ago on my machine (Linux 64-bit). It was differences in EXPLAIN output, though I don't remember if they were the same differences as in this bug report.
[8 Feb 2010 11:06] Sveta Smirnova
Not repeatable with 6.0-codebase-bugfixing  for me.
[9 Jun 2010 14:53] Manyi Lu
Sveta, could you please check whether this bug still fails on next-mr, trunk and mysql-next-mr-opt-backporting?

Thanks,

Manyi
[9 Jun 2010 19:28] Guilhem Bichot
The failure was introduced by
epotemkin@mysql.com-20091201212551-amf9utmatlvsbbar
which fixed
Bug#33546: Slowdown on re-evaluation of constant expressions.
[10 Jun 2010 6:33] Sveta Smirnova
With mysql-next-mr-opt-backporting MTR prints another diff:

-1      SIMPLE  t3      ALL     NULL    NULL    NULL    NULL    #       Using where
+1      SIMPLE  t4      range   attr1   attr1   4       NULL    #       Using where with pushed condition; Using temporary; Using filesort
+1      SIMPLE  t3      ALL     NULL    NULL    NULL    NULL    #       Using where; Using join buffer (BNL, regular buffers)
[22 Jul 2010 6:42] 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/114109

3317 Evgeny Potemkin	2010-07-22
      Bug#49746: Const expression caching led to NDB not using engine condition
      pushdown.
      
      NDB supports only a limited set of item nodes for use in engine condition
      pushdown. Because of this adding cache for const expression effectively
      disabled this optimization.
      
      The ndb_serialize_cond function is extended to support Item_cache and treat
      it as a constant values.
      A helper function called ndb_serialize_const is added. It is used to create
      Ndb_cond value node from given const item.
     @ mysql-test/suite/ndb/t/disabled.def
        Bug#49746: Const expression caching led to NDB not using engine condition
        pushdown.
        Enabled ndb_condition_pushdown test after fixing appropriate bug.
     @ sql/ha_ndbcluster_cond.cc
        Bug#49746: Const expression caching led to NDB not using engine condition
        pushdown.
        The ndb_serialize_cond function is extended to support Item_cache and treat
        it as a constant values.
        A helper function called ndb_serialize_const is added. It is used to create
        Ndb_cond value node from given const item.
     @ sql/item.cc
        Bug#49746: Const expression caching led to NDB not using engine condition
        pushdown.
        The Item::cache_const_expr_analyzer function is adjusted to not create
        cache for Item_int_with_ref objects.
     @ sql/item.h
        Bug#49746: Const expression caching led to NDB not using engine condition
        pushdown.
        The result_type() method is added to Item_cache class.
        The Item_cache_str now initializes its collation.
[4 Aug 2010 7:56] Vladislav Vaintroub
This push resurrected Bug #49829 : 

Many "hides virtual function" warnings with SunStudio 

There is a now a warnings like 
"/export/home/wlad/bzr/mysql-next-mr-bugfixing/sql/item.h", line 3275: Warning: Item_cache::result_type hides the virtual function Item::result_type() const.
1 Warning(s) detected.

once for each compiled file where item.h is directly or indirectly included.
[4 Aug 2010 8:03] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804080001-bny5271e65xo34ig) (version source revid:marko.makela@oracle.com-20100621094008-o9fa153s3f09merw) (merge vers: 5.1.49) (pib:18)
[4 Aug 2010 8:19] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804081533-c1d3rbipo9e8rt1s) (version source revid:marko.makela@oracle.com-20100621094008-o9fa153s3f09merw) (merge vers: 5.1.49) (pib:18)
[4 Aug 2010 9:01] Bugs System
Pushed into mysql-next-mr (revid:alik@ibmvm-20100804081630-ntapn8bf9pko9vj3) (version source revid:marko.makela@oracle.com-20100621094008-o9fa153s3f09merw) (pib:20)
[5 Aug 2010 11:09] 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/115085

3188 Evgeny Potemkin	2010-08-05
      Bug#49746: Const expression caching led to NDB not using engine condition
      pushdown.
      A follow-up patch to remove compile warnings.
[13 Aug 2010 2:08] Paul DuBois
Noted in 5.6.0 changelog.
[14 Aug 2010 9:12] 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/115723

3179 Evgeny Potemkin	2010-08-14
      Bug#49746: Const expression caching led to NDB not using engine condition
      pushdown.
            
      NDB supports only a limited set of item nodes for use in engine condition
      pushdown. Because of this adding cache for const expression effectively
      disabled this optimization.
            
      The ndb_serialize_cond function is extended to support Item_cache and treat
      it as a constant values.
      A helper function called ndb_serialize_const is added. It is used to create
      Ndb_cond value node from given const item.
     @ mysql-test/suite/ndb/t/disabled.def
        Bug#49746: Const expression caching led to NDB not using engine condition
        pushdown.
        Enabled ndb_condition_pushdown test after fixing appropriate bug.
     @ sql/ha_ndbcluster_cond.cc
        Bug#49746: Const expression caching led to NDB not using engine condition
        pushdown.
        The ndb_serialize_cond function is extended to support Item_cache and treat
        it as a constant values.
        A helper function called ndb_serialize_const is added. It is used to create
        Ndb_cond value node from given const item.
     @ sql/item.cc
        Bug#49746: Const expression caching led to NDB not using engine condition
        pushdown.
        The Item::cache_const_expr_analyzer function is adjusted to not create
        cache for Item_int_with_ref objects.
     @ sql/item.h
        Bug#49746: Const expression caching led to NDB not using engine condition
        pushdown.
        The result_type() method is added to Item_cache class.
        The Item_cache_str now initializes its collation.
[24 Aug 2010 19:29] Paul DuBois
5.6.0 changelog entry was removed. This problem has no user implications.
[25 Aug 2010 9:22] Bugs System
Pushed into mysql-5.5 5.5.6-m3 (revid:alik@ibmvm-20100825092002-2yvkb3iwu43ycpnm) (version source revid:alik@ibmvm-20100825092002-2yvkb3iwu43ycpnm) (merge vers: 5.5.6-m3) (pib:20)
[30 Aug 2010 8:30] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@sun.com-20100830082732-n2eyijnv86exc5ci) (version source revid:alik@sun.com-20100830082732-n2eyijnv86exc5ci) (merge vers: 5.6.1-m4) (pib:21)
[30 Aug 2010 8:34] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100830082745-n6sh01wlwh3itasv) (version source revid:alik@sun.com-20100830082745-n6sh01wlwh3itasv) (pib:21)