MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Guilhem Bichot Date:January 6 2010 3:27pm
Subject:bzr commit into mysql-6.0-codebase-bugfixing branch (guilhem:3811) Bug#50081
View as plain text  
#At file:///home/mysql_src/bzrrepos/mysql-6.0-codebase-bugfixing-wl5116/ based on revid:alik@stripped1-usypx5w5z8agupmu

 3811 Guilhem Bichot	2010-01-06 [merge]
      Merge of next-mr-bugfixing into 6.0-codebase-bugfixing.
      New "engine_condition_pushdown" flag of optimizer_switch is kept at the place it has
      in next-mr-bugfixing (same bit in the bitmap), so that "set optimizer_switch=number"
      affects the same flags in next-mr-bugfixing and 6.0-codebase-bugfixing (otherwise
      the user could be surprised when upgrading). This implies that 6.0-specific flags
      like "firstmatch" are shifted by one bit (see mysql_priv.h).
      6.0-specific tests affected by the deprecation of @@engine_condition_pushdown are fixed.
      BUG#50081 "Tests: mysqld--help-notwin fails with --parallel" gets a second fix here,
      on top of what is in next-mr-bugfixing, due to backup-log variables.

    added:
      mysql-test/r/optimizer_switch_eng_cond_pushdown1.result
      mysql-test/r/optimizer_switch_eng_cond_pushdown2.result
      mysql-test/t/optimizer_switch_eng_cond_pushdown1-master.opt
      mysql-test/t/optimizer_switch_eng_cond_pushdown1.test
      mysql-test/t/optimizer_switch_eng_cond_pushdown2-master.opt
      mysql-test/t/optimizer_switch_eng_cond_pushdown2.test
    modified:
      libmysqld/Makefile.am
      mysql-test/include/mysqld--help.inc
      mysql-test/r/index_merge_myisam.result
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/select.result
      mysql-test/r/select_jcl6.result
      mysql-test/r/subselect4.result
      mysql-test/r/subselect_no_mat.result
      mysql-test/r/subselect_no_opts.result
      mysql-test/r/subselect_no_semijoin.result
      mysql-test/r/subselect_sj.result
      mysql-test/r/subselect_sj2.result
      mysql-test/r/subselect_sj2_jcl6.result
      mysql-test/r/subselect_sj_jcl6.result
      mysql-test/suite/ndb/r/ndb_condition_pushdown.result
      mysql-test/suite/ndb/r/ndb_gis.result
      mysql-test/suite/ndb/r/ndb_index_unique.result
      mysql-test/suite/ndb/r/ndb_read_multi_range.result
      mysql-test/suite/ndb/t/ndb_condition_pushdown.test
      mysql-test/suite/ndb/t/ndb_gis.test
      mysql-test/suite/ndb/t/ndb_index_unique.test
      mysql-test/suite/ndb/t/ndb_read_multi_range.test
      mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result
      mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
      mysql-test/suite/sys_vars/t/engine_condition_pushdown_basic.test
      mysql-test/t/select.test
      mysql-test/t/subselect4.test
      mysql-test/t/subselect_sj2.test
      sql/mysql_priv.h
      sql/mysqld.cc
      sql/records.cc
      sql/share/Makefile.am
      sql/sql_select.cc
      sql/sys_vars.cc
=== modified file 'libmysqld/Makefile.am'
--- a/libmysqld/Makefile.am	2009-12-24 16:38:19 +0000
+++ b/libmysqld/Makefile.am	2010-01-06 15:27:09 +0000
@@ -163,8 +163,8 @@ libmysqld.a:	libmysqld_int.a $(INC_LIB) 
 if DARWIN_MWCC
 	mwld -lib -o $@ libmysqld_int.a `echo $(INC_LIB) | sort -u` $(storageobjects)
 else
-		-rm -f libmysqld.a
-		if test "$(host_os)" = "netware" ; \
+	-rm -f libmysqld.a
+	if test "$(host_os)" = "netware" ; \
 		then \
 		  $(libmysqld_a_AR) libmysqld.a $(INC_LIB) libmysqld_int.a $(storageobjects); \
 		else \

=== modified file 'mysql-test/include/mysqld--help.inc'
--- a/mysql-test/include/mysqld--help.inc	2009-12-26 09:41:21 +0000
+++ b/mysql-test/include/mysqld--help.inc	2010-01-06 15:27:09 +0000
@@ -11,7 +11,9 @@ exec $MYSQLD_BOOTSTRAP_CMD --symbolic-li
 
 perl;
   @skipvars=qw/basedir open-files-limit general-log-file log
-               log-slow-queries pid-file slow-query-log-file/;
+               log-slow-queries pid-file slow-query-log-file
+               datadir slave-load-tmpdir tmpdir
+               backup-history-log-file backup-progress-log-file backupdir/;
   @plugins=qw/innodb ndb ndbcluster safemalloc debug temp-pool ssl des-key-file
               thread-concurrency super-large-pages mutex-deadlock-detector/;
   @env=qw/MYSQLTEST_VARDIR MYSQL_TEST_DIR MYSQL_LIBDIR MYSQL_SHAREDIR/;

=== modified file 'mysql-test/r/index_merge_myisam.result'
--- a/mysql-test/r/index_merge_myisam.result	2009-12-24 16:38:19 +0000
+++ b/mysql-test/r/index_merge_myisam.result	2010-01-06 15:27:09 +0000
@@ -1419,19 +1419,19 @@ drop table t1;
 #
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 set optimizer_switch='index_merge=off,index_merge_union=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 set optimizer_switch='index_merge_union=on';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 set optimizer_switch='default,index_merge_sort_union=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 set optimizer_switch=4;
 set optimizer_switch=NULL;
 ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'NULL'
@@ -1457,21 +1457,21 @@ set optimizer_switch=default;
 set optimizer_switch='index_merge=off,index_merge_union=off,default';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 set optimizer_switch=default;
 select @@global.optimizer_switch;
 @@global.optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 set @@global.optimizer_switch=default;
 select @@global.optimizer_switch;
 @@global.optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 #
 # Check index_merge's @@optimizer_switch flags
 #
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int, b int, c int, filler char(100), 
@@ -1581,5 +1581,5 @@ id	select_type	table	type	possible_keys	
 set optimizer_switch=default;
 show variables like 'optimizer_switch';
 Variable_name	Value
-optimizer_switch	firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+optimizer_switch	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 drop table t0, t1;

=== modified file 'mysql-test/r/mysqld--help-notwin.result'
--- a/mysql-test/r/mysqld--help-notwin.result	2009-12-26 09:41:21 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result	2010-01-06 15:27:09 +0000
@@ -146,7 +146,8 @@ The following options may be given as th
                       on that value
   --enable-locking    Deprecated option, use --external-locking instead.
   --engine-condition-pushdown 
-                      Push supported query conditions to the storage engine
+                      Push supported query conditions to the storage engine.
+                      Deprecated, use --optimizer-switch instead.
                       (Defaults to on; use --skip-engine-condition-pushdown to disable.)
   --event-scheduler[=name] 
                       Enable the event scheduler. Possible values are ON, OFF,
@@ -432,10 +433,11 @@ The following options may be given as th
                       search(used for testing/comparison)
   --optimizer-switch=name 
                       optimizer_switch=option=val[,option=val...], where option
-                      is one of {firstmatch, index_merge, index_merge_union,
+                      is one of {index_merge, index_merge_union,
                       index_merge_sort_union, index_merge_intersection,
-                      loosescan, materialization, semijoin} and val is one of
-                      {on, off, default}
+                      engine_condition_pushdown, firstmatch, loosescan,
+                      materialization, semijoin} and val is one of {on, off,
+                      default}
   --partition[=name]  Enable or disable partition plugin. Possible values are
                       ON, OFF, FORCE (don't start if the plugin fails to load).
   --pid-file=name     Pid file used by safe_mysqld
@@ -752,11 +754,8 @@ auto-increment-offset                 1
 automatic-sp-privileges               TRUE
 back-log                              50
 backup-history-log                    TRUE
-backup-history-log-file               MYSQLTEST_VARDIR/install.db/backup_history.log
 backup-progress-log                   TRUE
-backup-progress-log-file              MYSQLTEST_VARDIR/install.db/backup_progress.log
 backup-wait-timeout                   50
-backupdir                             MYSQLTEST_VARDIR/install.db/
 big-tables                            FALSE
 bind-address                          (No default value)
 binlog-cache-size                     32768
@@ -774,7 +773,6 @@ completion-type                       NO
 concurrent-insert                     AUTO
 connect-timeout                       10
 console                               FALSE
-datadir                               MYSQLTEST_VARDIR/install.db/
 date-format                           %Y-%m-%d
 datetime-format                       %Y-%m-%d %H:%i:%s
 default-character-set                 latin1
@@ -887,7 +885,7 @@ old-passwords                         FA
 old-style-user-limits                 FALSE
 optimizer-prune-level                 1
 optimizer-search-depth                62
-optimizer-switch                      firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+optimizer-switch                      index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 partition                             ON
 plugin-dir                            MYSQL_LIBDIR/mysql/plugin
 plugin-load                           (No default value)
@@ -932,7 +930,6 @@ skip-slave-start                      FA
 slave-allow-batching                  FALSE
 slave-compressed-protocol             FALSE
 slave-exec-mode                       STRICT
-slave-load-tmpdir                     MYSQLTEST_VARDIR/tmp/
 slave-net-timeout                     3600
 slave-skip-errors                     (No default value)
 slave-transaction-retries             10
@@ -960,7 +957,6 @@ thread-stack                          26
 time-format                           %H:%i:%s
 timed-mutexes                         FALSE
 tmp-table-size                        16777216
-tmpdir                                MYSQLTEST_VARDIR/tmp/
 transaction-alloc-block-size          8192
 transaction-isolation                 REPEATABLE-READ
 transaction-prealloc-size             4096

=== modified file 'mysql-test/r/mysqld--help-win.result'
--- a/mysql-test/r/mysqld--help-win.result	2009-12-26 09:41:21 +0000
+++ b/mysql-test/r/mysqld--help-win.result	2010-01-06 15:27:09 +0000
@@ -146,7 +146,8 @@ The following options may be given as th
                       on that value
   --enable-locking    Deprecated option, use --external-locking instead.
   --engine-condition-pushdown 
-                      Push supported query conditions to the storage engine
+                      Push supported query conditions to the storage engine.
+                      Deprecated, use --optimizer-switch instead.
                       (Defaults to on; use --skip-engine-condition-pushdown to disable.)
   --event-scheduler[=name] 
                       Enable the event scheduler. Possible values are ON, OFF,
@@ -432,10 +433,11 @@ The following options may be given as th
                       search(used for testing/comparison)
   --optimizer-switch=name 
                       optimizer_switch=option=val[,option=val...], where option
-                      is one of {firstmatch, index_merge, index_merge_union,
+                      is one of {index_merge, index_merge_union,
                       index_merge_sort_union, index_merge_intersection,
-                      loosescan, materialization, semijoin} and val is one of
-                      {on, off, default}
+                      engine_condition_pushdown, firstmatch, loosescan,
+                      materialization, semijoin} and val is one of {on, off,
+                      default}
   --partition[=name]  Enable or disable partition plugin. Possible values are
                       ON, OFF, FORCE (don't start if the plugin fails to load).
   --pid-file=name     Pid file used by safe_mysqld
@@ -756,11 +758,8 @@ auto-increment-offset                 1
 automatic-sp-privileges               TRUE
 back-log                              50
 backup-history-log                    TRUE
-backup-history-log-file               MYSQLTEST_VARDIR/install.db/backup_history.log
 backup-progress-log                   TRUE
-backup-progress-log-file              MYSQLTEST_VARDIR/install.db/backup_progress.log
 backup-wait-timeout                   50
-backupdir                             MYSQLTEST_VARDIR/install.db/
 big-tables                            FALSE
 bind-address                          (No default value)
 binlog-cache-size                     32768
@@ -778,7 +777,6 @@ completion-type                       NO
 concurrent-insert                     AUTO
 connect-timeout                       10
 console                               FALSE
-datadir                               MYSQLTEST_VARDIR/install.db/
 date-format                           %Y-%m-%d
 datetime-format                       %Y-%m-%d %H:%i:%s
 default-character-set                 latin1
@@ -891,7 +889,7 @@ old-passwords                         FA
 old-style-user-limits                 FALSE
 optimizer-prune-level                 1
 optimizer-search-depth                62
-optimizer-switch                      firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+optimizer-switch                      index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 partition                             ON
 plugin-dir                            MYSQL_LIBDIR/plugin
 plugin-load                           (No default value)
@@ -938,7 +936,6 @@ skip-slave-start                      FA
 slave-allow-batching                  FALSE
 slave-compressed-protocol             FALSE
 slave-exec-mode                       STRICT
-slave-load-tmpdir                     MYSQLTEST_VARDIR/tmp/
 slave-net-timeout                     3600
 slave-skip-errors                     (No default value)
 slave-transaction-retries             10
@@ -966,7 +963,6 @@ thread-stack                          26
 time-format                           %H:%i:%s
 timed-mutexes                         FALSE
 tmp-table-size                        16777216
-tmpdir                                MYSQLTEST_VARDIR/tmp/
 transaction-alloc-block-size          8192
 transaction-isolation                 REPEATABLE-READ
 transaction-prealloc-size             4096

=== added file 'mysql-test/r/optimizer_switch_eng_cond_pushdown1.result'
--- a/mysql-test/r/optimizer_switch_eng_cond_pushdown1.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/optimizer_switch_eng_cond_pushdown1.result	2010-01-06 15:27:09 +0000
@@ -0,0 +1,5 @@
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+@@session.engine_condition_pushdown	@@global.engine_condition_pushdown	@@session.optimizer_switch	@@global.optimizer_switch
+1	1	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on

=== added file 'mysql-test/r/optimizer_switch_eng_cond_pushdown2.result'
--- a/mysql-test/r/optimizer_switch_eng_cond_pushdown2.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/optimizer_switch_eng_cond_pushdown2.result	2010-01-06 15:27:09 +0000
@@ -0,0 +1,5 @@
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+@@session.engine_condition_pushdown	@@global.engine_condition_pushdown	@@session.optimizer_switch	@@global.optimizer_switch
+0	0	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on

=== modified file 'mysql-test/r/select.result'
--- a/mysql-test/r/select.result	2009-12-23 10:53:54 +0000
+++ b/mysql-test/r/select.result	2010-01-06 15:27:09 +0000
@@ -4738,10 +4738,10 @@ DROP FUNCTION f1;
 # BUG#48052: Valgrind warning - uninitialized value in init_read_record()
 # 
 # Disable Index condition pushdown
-SELECT @old_icp:=@@engine_condition_pushdown;
-@old_icp:=@@engine_condition_pushdown
+SELECT @old_optimizer_switch:=@@optimizer_switch;
+@old_optimizer_switch:=@@optimizer_switch
 #
-SET SESSION engine_condition_pushdown = 'OFF';
+SET SESSION optimizer_switch='engine_condition_pushdown=OFF';
 CREATE TABLE t1 (
 pk int(11) NOT NULL,
 i int(11) DEFAULT NULL,
@@ -4757,7 +4757,7 @@ HAVING v <= 't' 
 ORDER BY pk;
 v
 # Restore old value for Index condition pushdown
-SET SESSION engine_condition_pushdown=@old_icp;
+SET SESSION optimizer_switch=@old_optimizer_switch;
 DROP TABLE t1;
 #
 # Bug#49489 Uninitialized cache led to a wrong result.
@@ -4892,10 +4892,10 @@ INSERT INTO t1 VALUES
 ('2008-01-01','c'),
 ('2038-01-09','d');
 # Enable Index condition pushdown
-select @old_icp:=@@engine_condition_pushdown;
-@old_icp:=@@engine_condition_pushdown
+SELECT @old_optimizer_switch:=@@optimizer_switch;
+@old_optimizer_switch:=@@optimizer_switch
 #
-set session engine_condition_pushdown='on';
+SET SESSION optimizer_switch='engine_condition_pushdown=on';
 
 # Execute select with invalid timestamp, desc ordering
 SELECT *
@@ -4918,6 +4918,6 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	4	Using index condition
 
 # Restore old value for Index condition pushdown
-set session engine_condition_pushdown=@old_icp;
+SET SESSION optimizer_switch=@old_optimizer_switch;
 DROP TABLE t1;
 End of 6.0 tests

=== modified file 'mysql-test/r/select_jcl6.result'
--- a/mysql-test/r/select_jcl6.result	2009-12-16 11:54:15 +0000
+++ b/mysql-test/r/select_jcl6.result	2010-01-06 15:27:09 +0000
@@ -4742,10 +4742,10 @@ DROP FUNCTION f1;
 # BUG#48052: Valgrind warning - uninitialized value in init_read_record()
 # 
 # Disable Index condition pushdown
-SELECT @old_icp:=@@engine_condition_pushdown;
-@old_icp:=@@engine_condition_pushdown
+SELECT @old_optimizer_switch:=@@optimizer_switch;
+@old_optimizer_switch:=@@optimizer_switch
 #
-SET SESSION engine_condition_pushdown = 'OFF';
+SET SESSION optimizer_switch='engine_condition_pushdown=OFF';
 CREATE TABLE t1 (
 pk int(11) NOT NULL,
 i int(11) DEFAULT NULL,
@@ -4761,7 +4761,7 @@ HAVING v <= 't' 
 ORDER BY pk;
 v
 # Restore old value for Index condition pushdown
-SET SESSION engine_condition_pushdown=@old_icp;
+SET SESSION optimizer_switch=@old_optimizer_switch;
 DROP TABLE t1;
 #
 # Bug#49489 Uninitialized cache led to a wrong result.
@@ -4896,10 +4896,10 @@ INSERT INTO t1 VALUES
 ('2008-01-01','c'),
 ('2038-01-09','d');
 # Enable Index condition pushdown
-select @old_icp:=@@engine_condition_pushdown;
-@old_icp:=@@engine_condition_pushdown
+SELECT @old_optimizer_switch:=@@optimizer_switch;
+@old_optimizer_switch:=@@optimizer_switch
 #
-set session engine_condition_pushdown='on';
+SET SESSION optimizer_switch='engine_condition_pushdown=on';
 
 # Execute select with invalid timestamp, desc ordering
 SELECT *
@@ -4922,7 +4922,7 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	4	Using index condition
 
 # Restore old value for Index condition pushdown
-set session engine_condition_pushdown=@old_icp;
+SET SESSION optimizer_switch=@old_optimizer_switch;
 DROP TABLE t1;
 End of 6.0 tests
 set join_cache_level=default;

=== modified file 'mysql-test/r/subselect4.result'
--- a/mysql-test/r/subselect4.result	2009-12-08 12:50:53 +0000
+++ b/mysql-test/r/subselect4.result	2010-01-06 15:27:09 +0000
@@ -118,18 +118,15 @@ KEY `varchar_key` (`varchar_key`)
 ) AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
 INSERT INTO `t1` VALUES (10,'00:00:00','i','i'),(11,'00:00:00','','');
 set @old_optimizer_switch          = @@session.optimizer_switch,
-@old_optimizer_use_mrr         = @@session.optimizer_use_mrr,
-@old_engine_condition_pushdown = @@session.engine_condition_pushdown;
-SET SESSION OPTIMIZER_SWITCH = 'materialization=off,semijoin=off,loosescan=off,firstmatch=off';
+@old_optimizer_use_mrr         = @@session.optimizer_use_mrr;
+SET SESSION OPTIMIZER_SWITCH = 'materialization=off,semijoin=off,loosescan=off,firstmatch=off,engine_condition_pushdown=on';
 SET SESSION optimizer_use_mrr = 'force';
-SET SESSION engine_condition_pushdown = 1;
 SELECT `time_nokey` G1  FROM t1  WHERE ( `varchar_nokey`  , `varchar_key`  )  IN ( 
 SELECT `varchar_nokey`  , `varchar_nokey`  )  AND `varchar_key`  >= 'c' HAVING G1  ORDER 
 BY `pk`   ;
 G1
 set @@session.optimizer_switch          = @old_optimizer_switch,
-@@session.optimizer_use_mrr         = @old_optimizer_use_mrr,
-@@session.engine_condition_pushdown = @old_engine_condition_pushdown;
+@@session.optimizer_use_mrr         = @old_optimizer_use_mrr;
 DROP TABLE t1;
 #
 # BUG#45863 "Assertion failed: (fixed == 0), function fix_fields(),
@@ -327,10 +324,10 @@ PRIMARY KEY (pk)
 );
 INSERT INTO t2 VALUES (9,1);
 # Enable Index condition pushdown
-SELECT @old_icp:=@@engine_condition_pushdown;
-@old_icp:=@@engine_condition_pushdown
+SELECT @old_optimizer_switch:=@@optimizer_switch;
+@old_optimizer_switch:=@@optimizer_switch
 #
-SET SESSION engine_condition_pushdown = 'ON';
+SET SESSION optimizer_switch='engine_condition_pushdown=ON';
 
 SELECT pk
 FROM t2
@@ -343,5 +340,5 @@ ORDER BY t1.i2 desc);
 pk
 9
 # Restore old value for Index condition pushdown
-SET SESSION engine_condition_pushdown=@old_icp;
+SET SESSION optimizer_switch=@old_optimizer_switch;
 DROP TABLE t1,t2;

=== modified file 'mysql-test/r/subselect_no_mat.result'
--- a/mysql-test/r/subselect_no_mat.result	2009-12-24 16:38:19 +0000
+++ b/mysql-test/r/subselect_no_mat.result	2010-01-06 15:27:09 +0000
@@ -1,6 +1,6 @@
 show variables like 'optimizer_switch';
 Variable_name	Value
-optimizer_switch	firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+optimizer_switch	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 set optimizer_switch='materialization=off';
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
 select (select 2);
@@ -5099,4 +5099,4 @@ End of 5.1 tests.
 set optimizer_switch=default;
 show variables like 'optimizer_switch';
 Variable_name	Value
-optimizer_switch	firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+optimizer_switch	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on

=== modified file 'mysql-test/r/subselect_no_opts.result'
--- a/mysql-test/r/subselect_no_opts.result	2009-12-24 16:38:19 +0000
+++ b/mysql-test/r/subselect_no_opts.result	2010-01-06 15:27:09 +0000
@@ -1,6 +1,6 @@
 show variables like 'optimizer_switch';
 Variable_name	Value
-optimizer_switch	firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+optimizer_switch	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 set optimizer_switch='materialization=off,semijoin=off';
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
 select (select 2);
@@ -5099,4 +5099,4 @@ End of 5.1 tests.
 set optimizer_switch=default;
 show variables like 'optimizer_switch';
 Variable_name	Value
-optimizer_switch	firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+optimizer_switch	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on

=== modified file 'mysql-test/r/subselect_no_semijoin.result'
--- a/mysql-test/r/subselect_no_semijoin.result	2009-12-24 16:38:19 +0000
+++ b/mysql-test/r/subselect_no_semijoin.result	2010-01-06 15:27:09 +0000
@@ -1,6 +1,6 @@
 show variables like 'optimizer_switch';
 Variable_name	Value
-optimizer_switch	firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+optimizer_switch	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 set optimizer_switch='semijoin=off';
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
 select (select 2);
@@ -5099,4 +5099,4 @@ End of 5.1 tests.
 set optimizer_switch=default;
 show variables like 'optimizer_switch';
 Variable_name	Value
-optimizer_switch	firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+optimizer_switch	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on

=== modified file 'mysql-test/r/subselect_sj.result'
--- a/mysql-test/r/subselect_sj.result	2009-12-29 13:25:23 +0000
+++ b/mysql-test/r/subselect_sj.result	2010-01-06 15:27:09 +0000
@@ -202,39 +202,39 @@ BUG#37120 optimizer_switch allowable val
 
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 set optimizer_switch='default,materialization=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=off,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=off,semijoin=on
 set optimizer_switch='default,semijoin=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=off
 set optimizer_switch='default,loosescan=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=off,materialization=on,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=off,materialization=on,semijoin=on
 set optimizer_switch='default,semijoin=off,materialization=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=off,semijoin=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=off,semijoin=off
 set optimizer_switch='default,materialization=off,semijoin=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=off,semijoin=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=off,semijoin=off
 set optimizer_switch='default,semijoin=off,materialization=off,loosescan=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=off,materialization=off,semijoin=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=off,materialization=off,semijoin=off
 set optimizer_switch='default,semijoin=off,loosescan=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=off,materialization=on,semijoin=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=off,materialization=on,semijoin=off
 set optimizer_switch='default,materialization=off,loosescan=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=off,materialization=off,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=off,materialization=off,semijoin=on
 set optimizer_switch=default;
 drop table t0, t1, t2;
 drop table t10, t11, t12;

=== modified file 'mysql-test/r/subselect_sj2.result'
--- a/mysql-test/r/subselect_sj2.result	2009-12-24 16:38:19 +0000
+++ b/mysql-test/r/subselect_sj2.result	2010-01-06 15:27:09 +0000
@@ -75,8 +75,8 @@ explain select * from t3 where b in (sel
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t0	ALL	NULL	NULL	NULL	NULL	10	Using where; Materialize; Scan
 1	PRIMARY	t3	ref	b	b	5	test.t0.a	1	
-set @save_ecp= @@engine_condition_pushdown;
-set engine_condition_pushdown=0;
+set @old_optimizer_switch= @@optimizer_switch;
+set optimizer_switch="engine_condition_pushdown=off";
 select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5);
 a	b	pk1	pk2
 0	0	0	0
@@ -93,7 +93,7 @@ a	b	pk1	pk2
 11	11	11	11
 12	12	12	12
 13	13	13	13
-set engine_condition_pushdown=@save_ecp;
+set optimizer_switch=@old_optimizer_switch;
 set join_buffer_size= @save_join_buffer_size;
 set max_heap_table_size= @save_max_heap_table_size;
 explain select * from t1 where a in (select b from t2);

=== modified file 'mysql-test/r/subselect_sj2_jcl6.result'
--- a/mysql-test/r/subselect_sj2_jcl6.result	2009-12-24 16:38:19 +0000
+++ b/mysql-test/r/subselect_sj2_jcl6.result	2010-01-06 15:27:09 +0000
@@ -79,8 +79,8 @@ explain select * from t3 where b in (sel
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t0	ALL	NULL	NULL	NULL	NULL	10	Using where; Materialize; Scan
 1	PRIMARY	t3	ref	b	b	5	test.t0.a	1	
-set @save_ecp= @@engine_condition_pushdown;
-set engine_condition_pushdown=0;
+set @old_optimizer_switch= @@optimizer_switch;
+set optimizer_switch="engine_condition_pushdown=off";
 select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5);
 a	b	pk1	pk2
 0	0	0	0
@@ -97,7 +97,7 @@ a	b	pk1	pk2
 11	11	11	11
 12	12	12	12
 13	13	13	13
-set engine_condition_pushdown=@save_ecp;
+set optimizer_switch=@old_optimizer_switch;
 set join_buffer_size= @save_join_buffer_size;
 set max_heap_table_size= @save_max_heap_table_size;
 explain select * from t1 where a in (select b from t2);

=== modified file 'mysql-test/r/subselect_sj_jcl6.result'
--- a/mysql-test/r/subselect_sj_jcl6.result	2009-12-29 13:25:23 +0000
+++ b/mysql-test/r/subselect_sj_jcl6.result	2010-01-06 15:27:09 +0000
@@ -206,39 +206,39 @@ BUG#37120 optimizer_switch allowable val
 
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 set optimizer_switch='default,materialization=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=off,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=off,semijoin=on
 set optimizer_switch='default,semijoin=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=off
 set optimizer_switch='default,loosescan=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=off,materialization=on,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=off,materialization=on,semijoin=on
 set optimizer_switch='default,semijoin=off,materialization=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=off,semijoin=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=off,semijoin=off
 set optimizer_switch='default,materialization=off,semijoin=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=off,semijoin=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=off,semijoin=off
 set optimizer_switch='default,semijoin=off,materialization=off,loosescan=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=off,materialization=off,semijoin=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=off,materialization=off,semijoin=off
 set optimizer_switch='default,semijoin=off,loosescan=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=off,materialization=on,semijoin=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=off,materialization=on,semijoin=off
 set optimizer_switch='default,materialization=off,loosescan=off';
 select @@optimizer_switch;
 @@optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=off,materialization=off,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=off,materialization=off,semijoin=on
 set optimizer_switch=default;
 drop table t0, t1, t2;
 drop table t10, t11, t12;

=== modified file 'mysql-test/suite/ndb/r/ndb_condition_pushdown.result'
--- a/mysql-test/suite/ndb/r/ndb_condition_pushdown.result	2008-08-18 05:43:50 +0000
+++ b/mysql-test/suite/ndb/r/ndb_condition_pushdown.result	2010-01-06 15:27:09 +0000
@@ -51,8 +51,8 @@ CREATE TABLE  t3 (pk1 int unsigned NOT N
 insert into t3 values (0,0,0,0,"a"),(1,1,9223372036854775803,1,"b"),(2,2,9223372036854775804,2,"c"),(3,3,9223372036854775805,3,"d"),(4,4,9223372036854775806,4,"e"),(5,5,9223372036854775807,5,"f");
 CREATE TABLE  t4 (pk1 int unsigned NOT NULL PRIMARY KEY,   attr1 int unsigned NOT NULL,   attr2 bigint unsigned, attr3 tinyint unsigned,  attr4 VARCHAR(10) , KEY (attr1)) ENGINE=ndbcluster;
 insert into t4 values (0,0,0,0,"a"),(1,1,9223372036854775803,1,"b"),(2,2,9223372036854775804,2,"c"),(3,3,9223372036854775805,3,"d"),(4,4,9223372036854775806,4,"e"),(5,5,9223372036854775807,5,"f");
-set @old_ecpd = @@session.engine_condition_pushdown;
-set engine_condition_pushdown = off;
+set @old_optimizer_switch = @@session.optimizer_switch;
+set optimizer_switch = "engine_condition_pushdown=off";
 select auto from t1 where 
 string = "aaaa" and 
 vstring = "aaaa" and 
@@ -484,7 +484,7 @@ pk1	attr1	attr2	attr3	attr4	pk1	attr1	at
 2	2	9223372036854775804	2	c	2	2	9223372036854775804	2	c
 3	3	9223372036854775805	3	d	3	3	9223372036854775805	3	d
 4	4	9223372036854775806	4	e	4	4	9223372036854775806	4	e
-set engine_condition_pushdown = on;
+set optimizer_switch = "engine_condition_pushdown=on";
 explain
 select auto from t1 where 
 string = "aaaa" and 
@@ -1769,12 +1769,12 @@ id	select_type	table	type	possible_keys	
 create table t5 (a int primary key auto_increment, b tinytext not null) 
 engine = ndb;
 insert into t5 (b) values ('jonas'), ('jensing'), ('johan');
-set engine_condition_pushdown = off;
+set optimizer_switch = "engine_condition_pushdown=off";
 select * from t5 where b like '%jo%' order by a;
 a	b
 1	jonas
 3	johan
-set engine_condition_pushdown = on;
+set optimizer_switch = "engine_condition_pushdown=on";
 explain select * from t5 where b like '%jo%';
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t5	ALL	NULL	NULL	NULL	NULL	#	Using where
@@ -1782,7 +1782,7 @@ select * from t5 where b like '%jo%' ord
 a	b
 1	jonas
 3	johan
-set engine_condition_pushdown = off;
+set optimizer_switch = "engine_condition_pushdown=off";
 select auto from t1 where date_time like '1902-02-02 %' order by auto;
 auto
 2
@@ -1790,7 +1790,7 @@ select auto from t1 where date_time not 
 auto
 3
 4
-set engine_condition_pushdown = on;
+set optimizer_switch = "engine_condition_pushdown=on";
 explain select auto from t1 where date_time like '1902-02-02 %';
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	#	Using where
@@ -1808,7 +1808,7 @@ drop table t1;
 create table t1 (a int, b varchar(3), primary key using hash(a))
 engine=ndb;
 insert into t1 values (1,'a'), (2,'ab'), (3,'abc');
-set engine_condition_pushdown = off;
+set optimizer_switch = "engine_condition_pushdown=off";
 select * from t1 where b like 'ab';
 a	b
 2	ab
@@ -1821,7 +1821,7 @@ a	b
 select * from t1 where b like 'abc' or b like 'abc';
 a	b
 3	abc
-set engine_condition_pushdown = on;
+set optimizer_switch = "engine_condition_pushdown=on";
 select * from t1 where b like 'ab';
 a	b
 2	ab
@@ -1838,7 +1838,7 @@ drop table t1;
 create table t1 (a int, b char(3), primary key using hash(a))
 engine=ndb;
 insert into t1 values (1,'a'), (2,'ab'), (3,'abc');
-set engine_condition_pushdown = off;
+set optimizer_switch = "engine_condition_pushdown=off";
 select * from t1 where b like 'ab';
 a	b
 2	ab
@@ -1851,7 +1851,7 @@ a	b
 select * from t1 where b like 'abc' or b like 'abc';
 a	b
 3	abc
-set engine_condition_pushdown = on;
+set optimizer_switch = "engine_condition_pushdown=on";
 select * from t1 where b like 'ab';
 a	b
 2	ab
@@ -1868,11 +1868,11 @@ drop table t1;
 create table  t1 ( fname varchar(255), lname varchar(255) )
 engine=ndbcluster;
 insert into t1 values ("Young","Foo");
-set engine_condition_pushdown = 0;
+set optimizer_switch = "engine_condition_pushdown=off";
 SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
 fname	lname
 Young	Foo
-set engine_condition_pushdown = 1;
+set optimizer_switch = "engine_condition_pushdown=on";
 SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
 fname	lname
 Young	Foo
@@ -1880,11 +1880,11 @@ insert into t1 values ("aaa", "aaa");
 insert into t1 values ("bbb", "bbb");
 insert into t1 values ("ccc", "ccc");
 insert into t1 values ("ddd", "ddd");
-set engine_condition_pushdown = 0;
+set optimizer_switch = "engine_condition_pushdown=off";
 SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
 fname	lname
 Young	Foo
-set engine_condition_pushdown = 1;
+set optimizer_switch = "engine_condition_pushdown=on";
 SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
 fname	lname
 Young	Foo
@@ -1928,7 +1928,7 @@ insert into t1 values (20,2,200,0+0x2222
 insert into t1 values (30,3,300,0+0x3333);
 insert into t1 values (40,4,400,0+0x4444);
 insert into t1 values (50,5,500,0+0x5555);
-set engine_condition_pushdown = on;
+set optimizer_switch = "engine_condition_pushdown=on";
 select a,b,d from t1
 where b in (0,1,2,5)
 order by b;
@@ -1962,5 +1962,5 @@ a	b
 2	Aberdeen
 show warnings;
 Level	Code	Message
-set engine_condition_pushdown = @old_ecpd;
+set optimizer_switch = @old_optimizer_switch;
 DROP TABLE t1,t2,t3,t4,t5;

=== modified file 'mysql-test/suite/ndb/r/ndb_gis.result'
--- a/mysql-test/suite/ndb/r/ndb_gis.result	2009-12-23 10:53:54 +0000
+++ b/mysql-test/suite/ndb/r/ndb_gis.result	2010-01-06 15:27:09 +0000
@@ -550,7 +550,7 @@ Overlaps(@horiz1, @point2)
 0
 DROP TABLE t1;
 End of 5.0 tests
-set engine_condition_pushdown = on;
+set optimizer_switch = "engine_condition_pushdown=on";
 DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
 CREATE TABLE gis_point  (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT);
 CREATE TABLE gis_line  (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g LINESTRING);

=== modified file 'mysql-test/suite/ndb/r/ndb_index_unique.result'
--- a/mysql-test/suite/ndb/r/ndb_index_unique.result	2009-10-15 12:27:13 +0000
+++ b/mysql-test/suite/ndb/r/ndb_index_unique.result	2010-01-06 15:27:09 +0000
@@ -181,8 +181,8 @@ a	b	c
 5	5	NULL
 8	3	NULL
 9	3	NULL
-set @old_ecpd = @@session.engine_condition_pushdown;
-set engine_condition_pushdown = true;
+set @old_optimizer_switch = @@session.optimizer_switch;
+set optimizer_switch = "engine_condition_pushdown=on";
 explain select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	range	PRIMARY,b	PRIMARY	4	NULL	1	Using where with pushed condition; Using MRR
@@ -191,7 +191,7 @@ a	b	c
 3	3	NULL
 5	5	NULL
 8	3	NULL
-set engine_condition_pushdown = @old_ecpd;
+set optimizer_switch = @old_optimizer_switch;
 drop table t2;
 CREATE TABLE t3 (
 a int unsigned NOT NULL,

=== modified file 'mysql-test/suite/ndb/r/ndb_read_multi_range.result'
--- a/mysql-test/suite/ndb/r/ndb_read_multi_range.result	2009-02-13 05:56:16 +0000
+++ b/mysql-test/suite/ndb/r/ndb_read_multi_range.result	2010-01-06 15:27:09 +0000
@@ -558,8 +558,8 @@ insert into t1 values ('a', 'a', 1), ('b
 ('p', 'p', 16), ('q', 'q', 17), ('r', 'r', 18),
 ('s', 's', 19), ('t', 't', 20), ('u', 'u', 21),
 ('v', 'v', 22), ('w', 'w', 23), ('x', 'x', 24);
-set @old_ecpd = @@session.engine_condition_pushdown;
-set engine_condition_pushdown = off;
+set @old_optimizer_switch = @@session.optimizer_switch;
+set session optimizer_switch="engine_condition_pushdown=off";
 set @x = repeat('x', 2000);
 select * from t1
 where (a = 'a')
@@ -604,7 +604,7 @@ q	q	17
 r	r	18
 s	s	19
 x	x	24
-set engine_condition_pushdown = @old_ecpd;
+set optimizer_switch = @old_optimizer_switch;
 drop table t1;
 create table t1 (a varchar(1536) not null,
 b varchar(1536) not null,

=== modified file 'mysql-test/suite/ndb/t/ndb_condition_pushdown.test'
--- a/mysql-test/suite/ndb/t/ndb_condition_pushdown.test	2008-08-08 09:40:47 +0000
+++ b/mysql-test/suite/ndb/t/ndb_condition_pushdown.test	2010-01-06 15:27:09 +0000
@@ -68,8 +68,8 @@ CREATE TABLE  t4 (pk1 int unsigned NOT N
 
 insert into t4 values (0,0,0,0,"a"),(1,1,9223372036854775803,1,"b"),(2,2,9223372036854775804,2,"c"),(3,3,9223372036854775805,3,"d"),(4,4,9223372036854775806,4,"e"),(5,5,9223372036854775807,5,"f");
 
-set @old_ecpd = @@session.engine_condition_pushdown;
-set engine_condition_pushdown = off;
+set @old_optimizer_switch = @@session.optimizer_switch;
+set optimizer_switch = "engine_condition_pushdown=off";
 
 # Test all types and compare operators
 select auto from t1 where 
@@ -453,7 +453,7 @@ select * from t2,t3 where t2.attr1 < 1 a
 select * from t4 where attr1 < 5 and attr2 > 9223372036854775803 and attr3 != 3 order by t4.pk1;
 select * from t3,t4 where t4.attr1 > 1 and t4.attr2 = t3.attr2 and t4.attr3 < 5 order by t4.pk1;
 
-set engine_condition_pushdown = on;
+set optimizer_switch = "engine_condition_pushdown=on";
 
 # Test all types and compare operators
 --replace_column 9 #
@@ -1674,18 +1674,18 @@ select * from t3 left join t4 on t4.attr
 create table t5 (a int primary key auto_increment, b tinytext not null) 
 engine = ndb;
 insert into t5 (b) values ('jonas'), ('jensing'), ('johan');
-set engine_condition_pushdown = off;
+set optimizer_switch = "engine_condition_pushdown=off";
 select * from t5 where b like '%jo%' order by a;
-set engine_condition_pushdown = on;
+set optimizer_switch = "engine_condition_pushdown=on";
 --replace_column 9 #
 explain select * from t5 where b like '%jo%';
 select * from t5 where b like '%jo%' order by a;
 
 # bug#21056  	ndb pushdown equal/setValue error on datetime
-set engine_condition_pushdown = off;
+set optimizer_switch = "engine_condition_pushdown=off";
 select auto from t1 where date_time like '1902-02-02 %' order by auto;
 select auto from t1 where date_time not like '1902-02-02 %' order by auto;
-set engine_condition_pushdown = on;
+set optimizer_switch = "engine_condition_pushdown=on";
 --replace_column 9 #
 explain select auto from t1 where date_time like '1902-02-02 %';
 select auto from t1 where date_time like '1902-02-02 %' order by auto;
@@ -1701,12 +1701,12 @@ insert into t1 values (1,'a'), (2,'ab'),
 # in TUP the constants 'ab' 'abc' were expected in varchar format
 # "like" returned error which became "false"
 # scan filter negates "or" which exposes the bug
-set engine_condition_pushdown = off;
+set optimizer_switch = "engine_condition_pushdown=off";
 select * from t1 where b like 'ab';
 select * from t1 where b like 'ab' or b like 'ab';
 select * from t1 where b like 'abc';
 select * from t1 where b like 'abc' or b like 'abc';
-set engine_condition_pushdown = on;
+set optimizer_switch = "engine_condition_pushdown=on";
 select * from t1 where b like 'ab';
 select * from t1 where b like 'ab' or b like 'ab';
 select * from t1 where b like 'abc';
@@ -1719,12 +1719,12 @@ engine=ndb;
 insert into t1 values (1,'a'), (2,'ab'), (3,'abc');
 # test that incorrect MySQL behaviour is preserved
 # 'ab ' LIKE 'ab' is true in MySQL
-set engine_condition_pushdown = off;
+set optimizer_switch = "engine_condition_pushdown=off";
 select * from t1 where b like 'ab';
 select * from t1 where b like 'ab' or b like 'ab';
 select * from t1 where b like 'abc';
 select * from t1 where b like 'abc' or b like 'abc';
-set engine_condition_pushdown = on;
+set optimizer_switch = "engine_condition_pushdown=on";
 select * from t1 where b like 'ab';
 select * from t1 where b like 'ab' or b like 'ab';
 select * from t1 where b like 'abc';
@@ -1736,9 +1736,9 @@ create table  t1 ( fname varchar(255), l
 engine=ndbcluster;
 insert into t1 values ("Young","Foo");
 
-set engine_condition_pushdown = 0;
+set optimizer_switch = "engine_condition_pushdown=off";
 SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
-set engine_condition_pushdown = 1;
+set optimizer_switch = "engine_condition_pushdown=on";
 SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
 
 # make sure optimizer does not do some crazy shortcut
@@ -1747,9 +1747,9 @@ insert into t1 values ("bbb", "bbb");
 insert into t1 values ("ccc", "ccc");
 insert into t1 values ("ddd", "ddd");
 
-set engine_condition_pushdown = 0;
+set optimizer_switch = "engine_condition_pushdown=off";
 SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
-set engine_condition_pushdown = 1;
+set optimizer_switch = "engine_condition_pushdown=on";
 SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
 
 # bug#29390 (scan filter is too large, discarded)
@@ -1797,7 +1797,7 @@ insert into t1 values (30,3,300,0+0x3333
 insert into t1 values (40,4,400,0+0x4444);
 insert into t1 values (50,5,500,0+0x5555);
 
-set engine_condition_pushdown = on;
+set optimizer_switch = "engine_condition_pushdown=on";
 
 select a,b,d from t1
     where b in (0,1,2,5)
@@ -2081,7 +2081,6 @@ select a,b,d from t1
     order by b;
 --enable_query_log
 
-
 # Bug 35413, NdbInterpretedCode buffer extension problem
 drop table t1;
 
@@ -2099,5 +2098,5 @@ select * from t1 where b in ('0', '1', '
 
 show warnings;
 
-set engine_condition_pushdown = @old_ecpd;
+set optimizer_switch = @old_optimizer_switch;
 DROP TABLE t1,t2,t3,t4,t5;

=== modified file 'mysql-test/suite/ndb/t/ndb_gis.test'
--- a/mysql-test/suite/ndb/t/ndb_gis.test	2007-07-04 20:38:53 +0000
+++ b/mysql-test/suite/ndb/t/ndb_gis.test	2010-01-06 10:54:45 +0000
@@ -1,5 +1,5 @@
 --source include/have_ndb.inc
 SET storage_engine=ndbcluster;
 --source include/gis_generic.inc
-set engine_condition_pushdown = on;
+set optimizer_switch = "engine_condition_pushdown=on";
 --source include/gis_generic.inc

=== modified file 'mysql-test/suite/ndb/t/ndb_index_unique.test'
--- a/mysql-test/suite/ndb/t/ndb_index_unique.test	2007-07-04 20:38:53 +0000
+++ b/mysql-test/suite/ndb/t/ndb_index_unique.test	2010-01-06 10:54:45 +0000
@@ -112,11 +112,11 @@ insert t2 values(1,1,NULL),(2,2,2),(3,3,
 select * from t2 where c IS NULL order by a;
 select * from t2 where b = 3 AND c IS NULL order by a;
 select * from t2 where (b = 3 OR b = 5) AND c IS NULL order by a;
-set @old_ecpd = @@session.engine_condition_pushdown;
-set engine_condition_pushdown = true;
+set @old_optimizer_switch = @@session.optimizer_switch;
+set optimizer_switch = "engine_condition_pushdown=on";
 explain select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a;
 select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a;
-set engine_condition_pushdown = @old_ecpd;
+set optimizer_switch = @old_optimizer_switch;
 
 drop table t2;
 

=== modified file 'mysql-test/suite/ndb/t/ndb_read_multi_range.test'
--- a/mysql-test/suite/ndb/t/ndb_read_multi_range.test	2009-10-09 09:35:41 +0000
+++ b/mysql-test/suite/ndb/t/ndb_read_multi_range.test	2010-01-06 15:27:09 +0000
@@ -433,8 +433,8 @@ insert into t1 values ('a', 'a', 1), ('b
 # Current code disables condition pushdown (with a warning) due to too big
 # size. Disable that so we don't have to change result file here just because
 # of condition pushdown implementation changes.
-set @old_ecpd = @@session.engine_condition_pushdown;
-set engine_condition_pushdown = off;
+set @old_optimizer_switch = @@session.optimizer_switch;
+set session optimizer_switch="engine_condition_pushdown=off";
 set @x = repeat('x', 2000);
 select * from t1
  where (a = 'a')
@@ -459,7 +459,7 @@ select * from t1
     or (a = 'x')
     order by a asc, b asc;
 
-set engine_condition_pushdown = @old_ecpd;
+set optimizer_switch = @old_optimizer_switch;
 drop table t1;
 
 create table t1 (a varchar(1536) not null,

=== modified file 'mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result'
--- a/mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result	2009-12-24 16:38:19 +0000
+++ b/mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result	2010-01-06 15:27:09 +0000
@@ -6,19 +6,33 @@ SET @global_start_value = @@global.engin
 SELECT @global_start_value;
 @global_start_value
 1
+select @old_session_opt_switch:=@@session.optimizer_switch,
+@old_global_opt_switch:=@@global.optimizer_switch;
+@old_session_opt_switch:=@@session.optimizer_switch	@old_global_opt_switch:=@@global.optimizer_switch
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 '#--------------------FN_DYNVARS_028_01------------------------#'
 SET @@session.engine_condition_pushdown = 0;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SET @@session.engine_condition_pushdown = DEFAULT;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@session.engine_condition_pushdown;
 @@session.engine_condition_pushdown
 1
 SET @@global.engine_condition_pushdown = 0;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SET @@global.engine_condition_pushdown = DEFAULT;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@global.engine_condition_pushdown;
 @@global.engine_condition_pushdown
 1
 '#---------------------FN_DYNVARS_028_02-------------------------#'
 SET engine_condition_pushdown = 1;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@engine_condition_pushdown;
 @@engine_condition_pushdown
 1
@@ -29,27 +43,39 @@ ERROR 42S02: Unknown table 'local' in fi
 SELECT global.engine_condition_pushdown;
 ERROR 42S02: Unknown table 'global' in field list
 SET session engine_condition_pushdown = 0;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@session.engine_condition_pushdown;
 @@session.engine_condition_pushdown
 0
 SET global engine_condition_pushdown = 0;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@global.engine_condition_pushdown;
 @@global.engine_condition_pushdown
 0
 '#--------------------FN_DYNVARS_028_03------------------------#'
 SET @@session.engine_condition_pushdown = 0;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@session.engine_condition_pushdown;
 @@session.engine_condition_pushdown
 0
 SET @@session.engine_condition_pushdown = 1;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@session.engine_condition_pushdown;
 @@session.engine_condition_pushdown
 1
 SET @@global.engine_condition_pushdown = 0;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@global.engine_condition_pushdown;
 @@global.engine_condition_pushdown
 0
 SET @@global.engine_condition_pushdown = 1;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@global.engine_condition_pushdown;
 @@global.engine_condition_pushdown
 1
@@ -88,11 +114,17 @@ SET @@global.engine_condition_pushdown =
 ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of '�F'
 '#-------------------FN_DYNVARS_028_05----------------------------#'
 SET @@global.engine_condition_pushdown = 0;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SET @@session.engine_condition_pushdown = 1;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@global.engine_condition_pushdown AS res_is_0;
 res_is_0
 0
 SET @@global.engine_condition_pushdown = 0;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@session.engine_condition_pushdown AS res_is_1;
 res_is_1
 1
@@ -126,43 +158,133 @@ VARIABLE_VALUE
 ON
 '#---------------------FN_DYNVARS_028_08-------------------------#'
 SET @@session.engine_condition_pushdown = OFF;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@session.engine_condition_pushdown;
 @@session.engine_condition_pushdown
 0
 SET @@session.engine_condition_pushdown = ON;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@session.engine_condition_pushdown;
 @@session.engine_condition_pushdown
 1
 SET @@global.engine_condition_pushdown = OFF;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@global.engine_condition_pushdown;
 @@global.engine_condition_pushdown
 0
 SET @@global.engine_condition_pushdown = ON;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@global.engine_condition_pushdown;
 @@global.engine_condition_pushdown
 1
 '#---------------------FN_DYNVARS_028_09----------------------#'
 SET @@session.engine_condition_pushdown = TRUE;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@session.engine_condition_pushdown;
 @@session.engine_condition_pushdown
 1
 SET @@session.engine_condition_pushdown = FALSE;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@session.engine_condition_pushdown;
 @@session.engine_condition_pushdown
 0
 SET @@global.engine_condition_pushdown = TRUE;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@global.engine_condition_pushdown;
 @@global.engine_condition_pushdown
 1
 SET @@global.engine_condition_pushdown = FALSE;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@global.engine_condition_pushdown;
 @@global.engine_condition_pushdown
 0
+Check that @@engine_condition_pushdown influences
+@@optimizer_switch and vice-versa
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+@@session.engine_condition_pushdown	@@global.engine_condition_pushdown	@@session.optimizer_switch	@@global.optimizer_switch
+0	0	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on
+set @@session.engine_condition_pushdown = TRUE;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+@@session.engine_condition_pushdown	@@global.engine_condition_pushdown	@@session.optimizer_switch	@@global.optimizer_switch
+1	0	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on
+set @@session.engine_condition_pushdown = FALSE;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+@@session.engine_condition_pushdown	@@global.engine_condition_pushdown	@@session.optimizer_switch	@@global.optimizer_switch
+0	0	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on
+set @@global.engine_condition_pushdown = TRUE;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+@@session.engine_condition_pushdown	@@global.engine_condition_pushdown	@@session.optimizer_switch	@@global.optimizer_switch
+0	1	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
+set @@global.engine_condition_pushdown = FALSE;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+@@session.engine_condition_pushdown	@@global.engine_condition_pushdown	@@session.optimizer_switch	@@global.optimizer_switch
+0	0	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on
+set @@session.optimizer_switch = "engine_condition_pushdown=on";
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+@@session.engine_condition_pushdown	@@global.engine_condition_pushdown	@@session.optimizer_switch	@@global.optimizer_switch
+1	0	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on
+set @@session.optimizer_switch = "engine_condition_pushdown=off";
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+@@session.engine_condition_pushdown	@@global.engine_condition_pushdown	@@session.optimizer_switch	@@global.optimizer_switch
+0	0	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on
+set @@global.optimizer_switch = "engine_condition_pushdown=on";
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+@@session.engine_condition_pushdown	@@global.engine_condition_pushdown	@@session.optimizer_switch	@@global.optimizer_switch
+0	1	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
+set @@global.optimizer_switch = "engine_condition_pushdown=off";
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+@@session.engine_condition_pushdown	@@global.engine_condition_pushdown	@@session.optimizer_switch	@@global.optimizer_switch
+0	0	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 SET @@session.engine_condition_pushdown = @session_start_value;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@session.engine_condition_pushdown;
 @@session.engine_condition_pushdown
 1
 SET @@global.engine_condition_pushdown = @global_start_value;
+Warnings:
+Warning	1287	The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
 SELECT @@global.engine_condition_pushdown;
 @@global.engine_condition_pushdown
 1
+set @session.optimizer_switch=@old_session_opt_switch,
+@@global.optimizer_switch=@old_global_opt_switch;
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+@@session.engine_condition_pushdown	@@global.engine_condition_pushdown	@@session.optimizer_switch	@@global.optimizer_switch
+1	1	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on

=== modified file 'mysql-test/suite/sys_vars/r/optimizer_switch_basic.result'
--- a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result	2009-12-24 16:38:19 +0000
+++ b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result	2010-01-06 15:27:09 +0000
@@ -1,45 +1,45 @@
 SET @start_global_value = @@global.optimizer_switch;
 SELECT @start_global_value;
 @start_global_value
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 select @@global.optimizer_switch;
 @@global.optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 select @@session.optimizer_switch;
 @@session.optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 show global variables like 'optimizer_switch';
 Variable_name	Value
-optimizer_switch	firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+optimizer_switch	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 show session variables like 'optimizer_switch';
 Variable_name	Value
-optimizer_switch	firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+optimizer_switch	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 select * from information_schema.global_variables where variable_name='optimizer_switch';
 VARIABLE_NAME	VARIABLE_VALUE
-OPTIMIZER_SWITCH	firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+OPTIMIZER_SWITCH	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 select * from information_schema.session_variables where variable_name='optimizer_switch';
 VARIABLE_NAME	VARIABLE_VALUE
-OPTIMIZER_SWITCH	firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+OPTIMIZER_SWITCH	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on
 set global optimizer_switch=10;
 select @@global.optimizer_switch;
 @@global.optimizer_switch
-firstmatch=off,index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,loosescan=off,materialization=off,semijoin=off
+index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=off,loosescan=off,materialization=off,semijoin=off
 set session optimizer_switch=5;
 select @@session.optimizer_switch;
 @@session.optimizer_switch
-firstmatch=on,index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=off,loosescan=off,materialization=off,semijoin=off
+index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,engine_condition_pushdown=off,firstmatch=off,loosescan=off,materialization=off,semijoin=off
 set global optimizer_switch="index_merge_sort_union=on";
 select @@global.optimizer_switch;
 @@global.optimizer_switch
-firstmatch=off,index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,loosescan=off,materialization=off,semijoin=off
+index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=off,loosescan=off,materialization=off,semijoin=off
 set session optimizer_switch="index_merge=off";
 select @@session.optimizer_switch;
 @@session.optimizer_switch
-firstmatch=on,index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=off,loosescan=off,materialization=off,semijoin=off
+index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,engine_condition_pushdown=off,firstmatch=off,loosescan=off,materialization=off,semijoin=off
 set session optimizer_switch="default";
 select @@session.optimizer_switch;
 @@session.optimizer_switch
-firstmatch=off,index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,loosescan=off,materialization=off,semijoin=off
+index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,firstmatch=off,loosescan=off,materialization=off,semijoin=off
 set global optimizer_switch=1.1;
 ERROR 42000: Incorrect argument type to variable 'optimizer_switch'
 set global optimizer_switch=1e1;
@@ -51,4 +51,4 @@ ERROR 42000: Variable 'optimizer_switch'
 SET @@global.optimizer_switch = @start_global_value;
 SELECT @@global.optimizer_switch;
 @@global.optimizer_switch
-firstmatch=on,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on

=== modified file 'mysql-test/suite/sys_vars/t/engine_condition_pushdown_basic.test'
--- a/mysql-test/suite/sys_vars/t/engine_condition_pushdown_basic.test	2009-12-24 16:38:19 +0000
+++ b/mysql-test/suite/sys_vars/t/engine_condition_pushdown_basic.test	2010-01-06 15:27:09 +0000
@@ -40,6 +40,10 @@ SELECT @session_start_value;
 SET @global_start_value = @@global.engine_condition_pushdown;
 SELECT @global_start_value;
 
+# same for optimizer_switch
+select @old_session_opt_switch:=@@session.optimizer_switch,
+@old_global_opt_switch:=@@global.optimizer_switch;
+
 --echo '#--------------------FN_DYNVARS_028_01------------------------#'
 ######################################################################## 
 #           Display the DEFAULT value of engine_condition_pushdown     #
@@ -203,6 +207,44 @@ SELECT @@global.engine_condition_pushdow
 SET @@global.engine_condition_pushdown = FALSE;
 SELECT @@global.engine_condition_pushdown;
 
+--echo Check that @@engine_condition_pushdown influences
+--echo @@optimizer_switch and vice-versa
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+set @@session.engine_condition_pushdown = TRUE;
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+set @@session.engine_condition_pushdown = FALSE;
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+set @@global.engine_condition_pushdown = TRUE;
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+set @@global.engine_condition_pushdown = FALSE;
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+set @@session.optimizer_switch = "engine_condition_pushdown=on";
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+set @@session.optimizer_switch = "engine_condition_pushdown=off";
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+set @@global.optimizer_switch = "engine_condition_pushdown=on";
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+set @@global.optimizer_switch = "engine_condition_pushdown=off";
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+
 ##############################  
 #   Restore initial value    #
 ##############################
@@ -213,6 +255,12 @@ SELECT @@session.engine_condition_pushdo
 SET @@global.engine_condition_pushdown = @global_start_value;
 SELECT @@global.engine_condition_pushdown;
 
+set @session.optimizer_switch=@old_session_opt_switch,
+@@global.optimizer_switch=@old_global_opt_switch;
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;
+
 ###############################################################
 #                    END OF engine_condition_pushdown TESTS   #
 ############################################################### 

=== added file 'mysql-test/t/optimizer_switch_eng_cond_pushdown1-master.opt'
--- a/mysql-test/t/optimizer_switch_eng_cond_pushdown1-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/optimizer_switch_eng_cond_pushdown1-master.opt	2010-01-06 10:54:45 +0000
@@ -0,0 +1 @@
+--optimizer-switch=engine_condition_pushdown=off --engine-condition-pushdown=1

=== added file 'mysql-test/t/optimizer_switch_eng_cond_pushdown1.test'
--- a/mysql-test/t/optimizer_switch_eng_cond_pushdown1.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/optimizer_switch_eng_cond_pushdown1.test	2010-01-06 10:54:45 +0000
@@ -0,0 +1,5 @@
+# check how --engine-condition-pushdown and --optimizer-switch
+# influence each other when used together (last wins).
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;

=== added file 'mysql-test/t/optimizer_switch_eng_cond_pushdown2-master.opt'
--- a/mysql-test/t/optimizer_switch_eng_cond_pushdown2-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/optimizer_switch_eng_cond_pushdown2-master.opt	2010-01-06 10:54:45 +0000
@@ -0,0 +1 @@
+--engine-condition-pushdown=1 --optimizer-switch=engine_condition_pushdown=off

=== added file 'mysql-test/t/optimizer_switch_eng_cond_pushdown2.test'
--- a/mysql-test/t/optimizer_switch_eng_cond_pushdown2.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/optimizer_switch_eng_cond_pushdown2.test	2010-01-06 10:54:45 +0000
@@ -0,0 +1,5 @@
+# check how --engine-condition-pushdown and --optimizer-switch
+# influence each other when used together (last wins).
+select @@session.engine_condition_pushdown,
+@@global.engine_condition_pushdown,
+@@session.optimizer_switch, @@global.optimizer_switch;

=== modified file 'mysql-test/t/select.test'
--- a/mysql-test/t/select.test	2009-12-16 18:39:13 +0000
+++ b/mysql-test/t/select.test	2010-01-06 15:27:09 +0000
@@ -4014,8 +4014,8 @@ DROP FUNCTION f1;
 # Needed in 6.0 codebase
 --echo # Disable Index condition pushdown
 --replace_column 1 #
-SELECT @old_icp:=@@engine_condition_pushdown;
-SET SESSION engine_condition_pushdown = 'OFF';
+SELECT @old_optimizer_switch:=@@optimizer_switch;
+SET SESSION optimizer_switch='engine_condition_pushdown=OFF';
 
 CREATE TABLE t1 (
   pk int(11) NOT NULL,
@@ -4035,7 +4035,7 @@ ORDER BY pk;
 
 # Needed in 6.0 codebase
 --echo # Restore old value for Index condition pushdown
-SET SESSION engine_condition_pushdown=@old_icp;
+SET SESSION optimizer_switch=@old_optimizer_switch;
 
 DROP TABLE t1;
 
@@ -4173,8 +4173,8 @@ INSERT INTO t1 VALUES
 
 --echo # Enable Index condition pushdown
 --replace_column 1 #
-select @old_icp:=@@engine_condition_pushdown;
-set session engine_condition_pushdown='on';
+SELECT @old_optimizer_switch:=@@optimizer_switch;
+SET SESSION optimizer_switch='engine_condition_pushdown=on';
 
 --disable_warnings
 
@@ -4199,7 +4199,7 @@ LIMIT 2; 
 --enable_warnings
 
 --echo # Restore old value for Index condition pushdown
-set session engine_condition_pushdown=@old_icp;
+SET SESSION optimizer_switch=@old_optimizer_switch;
 
 DROP TABLE t1;
 

=== modified file 'mysql-test/t/subselect4.test'
--- a/mysql-test/t/subselect4.test	2009-12-08 12:50:53 +0000
+++ b/mysql-test/t/subselect4.test	2010-01-06 15:27:09 +0000
@@ -105,20 +105,17 @@ CREATE TABLE `t1` (
 INSERT INTO `t1` VALUES (10,'00:00:00','i','i'),(11,'00:00:00','','');
 
 set @old_optimizer_switch          = @@session.optimizer_switch,
-    @old_optimizer_use_mrr         = @@session.optimizer_use_mrr,
-    @old_engine_condition_pushdown = @@session.engine_condition_pushdown;
+    @old_optimizer_use_mrr         = @@session.optimizer_use_mrr;
 
-SET SESSION OPTIMIZER_SWITCH = 'materialization=off,semijoin=off,loosescan=off,firstmatch=off';
+SET SESSION OPTIMIZER_SWITCH = 'materialization=off,semijoin=off,loosescan=off,firstmatch=off,engine_condition_pushdown=on';
 SET SESSION optimizer_use_mrr = 'force';
-SET SESSION engine_condition_pushdown = 1;
 
  SELECT `time_nokey` G1  FROM t1  WHERE ( `varchar_nokey`  , `varchar_key`  )  IN ( 
 SELECT `varchar_nokey`  , `varchar_nokey`  )  AND `varchar_key`  >= 'c' HAVING G1  ORDER 
 BY `pk`   ;
 
 set @@session.optimizer_switch          = @old_optimizer_switch,
-    @@session.optimizer_use_mrr         = @old_optimizer_use_mrr,
-    @@session.engine_condition_pushdown = @old_engine_condition_pushdown;
+    @@session.optimizer_use_mrr         = @old_optimizer_use_mrr;
 
 DROP TABLE t1;
 
@@ -314,8 +311,8 @@ INSERT INTO t2 VALUES (9,1);
 
 --echo # Enable Index condition pushdown
 --replace_column 1 #
-SELECT @old_icp:=@@engine_condition_pushdown;
-SET SESSION engine_condition_pushdown = 'ON';
+SELECT @old_optimizer_switch:=@@optimizer_switch;
+SET SESSION optimizer_switch='engine_condition_pushdown=ON';
 
 --echo
 SELECT pk
@@ -328,6 +325,6 @@ WHERE 
      ORDER BY t1.i2 desc);
 
 --echo # Restore old value for Index condition pushdown
-SET SESSION engine_condition_pushdown=@old_icp;
+SET SESSION optimizer_switch=@old_optimizer_switch;
 
 DROP TABLE t1,t2;

=== modified file 'mysql-test/t/subselect_sj2.test'
--- a/mysql-test/t/subselect_sj2.test	2009-12-24 16:38:19 +0000
+++ b/mysql-test/t/subselect_sj2.test	2010-01-06 15:27:09 +0000
@@ -63,10 +63,10 @@ from t0 A, t0 B where B.a <5;
 
 explain select * from t3 where b in (select a from t0);
 # Because of BUG#40154, run the next select w/o index condition pushdown:
-set @save_ecp= @@engine_condition_pushdown;
-set engine_condition_pushdown=0;
+set @old_optimizer_switch= @@optimizer_switch;
+set optimizer_switch="engine_condition_pushdown=off";
 select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5);
-set engine_condition_pushdown=@save_ecp;
+set optimizer_switch=@old_optimizer_switch;
 
 set join_buffer_size= @save_join_buffer_size;
 set max_heap_table_size= @save_max_heap_table_size;

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2009-12-28 13:17:31 +0000
+++ b/sql/mysql_priv.h	2010-01-06 15:27:09 +0000
@@ -638,15 +638,16 @@ enum open_table_mode
 #define MODE_PAD_CHAR_TO_FULL_LENGTH    (1ULL << 31)
 
 /* @@optimizer_switch flags. These must be in sync with optimizer_switch_typelib */
-#define OPTIMIZER_SWITCH_FIRSTMATCH 1
-#define OPTIMIZER_SWITCH_INDEX_MERGE 2
-#define OPTIMIZER_SWITCH_INDEX_MERGE_UNION 4
-#define OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION 8
-#define OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT 16
-#define OPTIMIZER_SWITCH_LOOSE_SCAN 32
-#define OPTIMIZER_SWITCH_MATERIALIZATION 64
-#define OPTIMIZER_SWITCH_SEMIJOIN 128
-#define OPTIMIZER_SWITCH_LAST 256
+#define OPTIMIZER_SWITCH_INDEX_MERGE               (1ULL << 0)
+#define OPTIMIZER_SWITCH_INDEX_MERGE_UNION         (1ULL << 1)
+#define OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION    (1ULL << 2)
+#define OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT     (1ULL << 3)
+#define OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN (1ULL << 4)
+#define OPTIMIZER_SWITCH_FIRSTMATCH                (1ULL << 5)
+#define OPTIMIZER_SWITCH_LOOSE_SCAN                (1ULL << 6)
+#define OPTIMIZER_SWITCH_MATERIALIZATION           (1ULL << 7)
+#define OPTIMIZER_SWITCH_SEMIJOIN                  (1ULL << 8)
+#define OPTIMIZER_SWITCH_LAST                      (1ULL << 9)
 
 /* The following must be kept in sync with optimizer_switch_str in mysqld.cc */
 #define OPTIMIZER_SWITCH_DEFAULT (OPTIMIZER_SWITCH_FIRSTMATCH | \
@@ -656,7 +657,8 @@ enum open_table_mode
                                   OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT | \
                                   OPTIMIZER_SWITCH_LOOSE_SCAN | \
                                   OPTIMIZER_SWITCH_MATERIALIZATION | \
-                                  OPTIMIZER_SWITCH_SEMIJOIN)
+                                  OPTIMIZER_SWITCH_SEMIJOIN | \
+                                  OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN)
 
 
 /*
@@ -2705,7 +2707,8 @@ enum options_mysqld
   OPT_SSL_CIPHER,
   OPT_SSL_KEY,
   OPT_UPDATE_LOG,
-  OPT_WANT_CORE
+  OPT_WANT_CORE,
+  OPT_ENGINE_CONDITION_PUSHDOWN
 };
 
 #endif /* MYSQL_SERVER */

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2009-12-28 13:17:31 +0000
+++ b/sql/mysqld.cc	2010-01-06 15:27:09 +0000
@@ -7266,6 +7266,18 @@ mysqld_get_one_option(int optid,
     }
     break;
 #endif /* defined(ENABLED_DEBUG_SYNC) */
+  case OPT_ENGINE_CONDITION_PUSHDOWN:
+    /*
+      The last of --engine-condition-pushdown and --optimizer_switch on
+      command line wins (see get_options().
+    */
+    if (global_system_variables.engine_condition_pushdown)
+      global_system_variables.optimizer_switch|=
+        OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN;
+    else
+      global_system_variables.optimizer_switch&=
+        ~OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN;
+    break;
   }
   return 0;
 }
@@ -7490,6 +7502,11 @@ static int get_options(int *argc,char **
   else
     pool_of_threads_scheduler(&thread_scheduler);  /* purecov: tested */
 #endif
+
+  global_system_variables.engine_condition_pushdown=
+    test(global_system_variables.optimizer_switch &
+         OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN);
+
   return 0;
 }
 

=== modified file 'sql/records.cc'
--- a/sql/records.cc	2009-12-16 11:54:15 +0000
+++ b/sql/records.cc	2010-01-06 15:27:09 +0000
@@ -274,7 +274,8 @@ void init_read_record(READ_RECORD *info,
     TODO: Remove this from here as it causes two condition pushdown calls 
     when we're running a SELECT and the condition cannot be pushed down.
   */
-  if (thd->variables.engine_condition_pushdown && 
+  if ((thd->variables.optimizer_switch &
+       OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) && 
       select && select->cond && 
       (select->cond->used_tables() & table->map) &&
       !table->file->pushed_cond)

=== modified file 'sql/share/Makefile.am'
--- a/sql/share/Makefile.am	2009-10-15 12:27:13 +0000
+++ b/sql/share/Makefile.am	2010-01-06 15:27:09 +0000
@@ -43,8 +43,8 @@ install-data-local:
 			        $(DESTDIR)$(pkgdatadir)/$$lang/errmsg.sys; \
 	done
 	$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/charsets
-		$(INSTALL_DATA) $(srcdir)/errmsg-utf8.txt \
-	        $(DESTDIR)$(pkgdatadir)/errmsg-utf8.txt; \
+	$(INSTALL_DATA) $(srcdir)/errmsg-utf8.txt \
+	$(DESTDIR)$(pkgdatadir)/errmsg-utf8.txt; \
 	$(INSTALL_DATA) $(srcdir)/charsets/README $(DESTDIR)$(pkgdatadir)/charsets/README
 	$(INSTALL_DATA) $(srcdir)/charsets/*.xml $(DESTDIR)$(pkgdatadir)/charsets
 

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2009-12-29 13:25:23 +0000
+++ b/sql/sql_select.cc	2010-01-06 15:27:09 +0000
@@ -8917,7 +8917,9 @@ static bool make_join_select(JOIN *join,
           /* Push condition to storage engine if this is enabled
              and the condition is not guarded */
           tab->table->file->pushed_cond= NULL;
-	  if (thd->variables.engine_condition_pushdown && !first_inner_tab)
+	  if ((thd->variables.optimizer_switch &
+               OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) &&
+              !first_inner_tab)
           {
             COND *push_cond= 
               make_cond_for_table(tmp, current_map, current_map, 0);
@@ -22019,7 +22021,8 @@ void select_describe(JOIN *join, bool ne
           {
             const COND *pushed_cond= tab->table->file->pushed_cond;
 
-            if (thd->variables.engine_condition_pushdown && pushed_cond)
+            if ((thd->variables.optimizer_switch &
+                 OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) && pushed_cond)
             {
               extra.append(STRING_WITH_LEN("; Using where with pushed "
                                            "condition"));

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2009-12-26 09:41:21 +0000
+++ b/sql/sys_vars.cc	2010-01-06 15:27:09 +0000
@@ -1156,18 +1156,31 @@ static Sys_var_ulong Sys_optimizer_searc
 
 static const char *optimizer_switch_names[]=
 {
-  "firstmatch", "index_merge", "index_merge_union", "index_merge_sort_union",
-  "index_merge_intersection", "loosescan","materialization", "semijoin",
+  "index_merge", "index_merge_union", "index_merge_sort_union",
+  "index_merge_intersection", "engine_condition_pushdown", "firstmatch",
+  "loosescan","materialization", "semijoin",
   "default", NullS
 };
+/** propagates changes to @@engine_condition_pushdown */
+static bool fix_optimizer_switch(sys_var *self, THD *thd,
+                                 enum_var_type type)
+{
+  SV *sv= (type == OPT_GLOBAL) ? &global_system_variables : &thd->variables;
+  sv->engine_condition_pushdown= 
+    test(sv->optimizer_switch & OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN);
+  return false;
+}
 static Sys_var_flagset Sys_optimizer_switch(
        "optimizer_switch",
        "optimizer_switch=option=val[,option=val...], where option is one of "
-       "{firstmatch, index_merge, index_merge_union, index_merge_sort_union, "
-       "index_merge_intersection, loosescan, materialization, semijoin} "
+       "{index_merge, index_merge_union, index_merge_sort_union, "
+       "index_merge_intersection, engine_condition_pushdown, firstmatch, "
+       "loosescan, materialization, semijoin} "
        "and val is one of {on, off, default}",
        SESSION_VAR(optimizer_switch), CMD_LINE(REQUIRED_ARG),
-       optimizer_switch_names, DEFAULT(OPTIMIZER_SWITCH_DEFAULT));
+       optimizer_switch_names, DEFAULT(OPTIMIZER_SWITCH_DEFAULT),
+       NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
+       ON_UPDATE(fix_optimizer_switch));
 
 static const char *optimizer_use_mrr_names[] = {"auto", "force", "disable", 0};
 static Sys_var_enum Sys_optimizer_use_mrr(
@@ -1883,11 +1896,26 @@ static Sys_var_ulong Sys_net_wait_timeou
        VALID_RANGE(1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT)),
        DEFAULT(NET_WAIT_TIMEOUT), BLOCK_SIZE(1));
 
+/** propagates changes to the relevant flag of @@optimizer_switch */
+static bool fix_engine_condition_pushdown(sys_var *self, THD *thd,
+                                          enum_var_type type)
+{
+  SV *sv= (type == OPT_GLOBAL) ? &global_system_variables : &thd->variables;
+  if (sv->engine_condition_pushdown)
+    sv->optimizer_switch|= OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN;
+  else
+    sv->optimizer_switch&= ~OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN;
+  return false;
+}
 static Sys_var_mybool Sys_engine_condition_pushdown(
        "engine_condition_pushdown",
-       "Push supported query conditions to the storage engine",
-       SESSION_VAR(engine_condition_pushdown), CMD_LINE(OPT_ARG),
-       DEFAULT(TRUE));
+       "Push supported query conditions to the storage engine."
+       " Deprecated, use --optimizer-switch instead.",
+       SESSION_VAR(engine_condition_pushdown),
+       CMD_LINE(OPT_ARG, OPT_ENGINE_CONDITION_PUSHDOWN),
+       DEFAULT(TRUE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
+       ON_UPDATE(fix_engine_condition_pushdown),
+       DEPRECATED(70000, "'@@optimizer_switch'"));
 
 static Sys_var_plugin Sys_default_storage_engine(
        "default_storage_engine", "The default storage engine for new tables",

Attachment: [text/bzr-bundle] bzr/guilhem@mysql.com-20100106152709-nmhtccoja81qwczc.bundle
Thread
bzr commit into mysql-6.0-codebase-bugfixing branch (guilhem:3811) Bug#50081Guilhem Bichot6 Jan