From ab34aecff3c6c9c33ca682c90a79ec60d59f42ed Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 25 Aug 2014 23:13:37 +0200 Subject: [PATCH] MDEV-6513 deprecate engine_condition_pushdown value of the @@optimizer_switch * ignore the OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN bit * issue a deprecation warning on 'engine_condition_pushdown=on' * remove unused remains of the old pre-5.5 engine_condition_pushdown variable --- mysql-test/r/subselect4.result | 4 + .../r/engine_condition_pushdown_basic.result | 290 ------------------ .../sys_vars/r/optimizer_switch_basic.result | 2 + sql/handler.h | 14 +- sql/mysqld.cc | 16 - sql/mysqld.h | 1 - sql/records.cc | 4 +- sql/sql_class.h | 1 - sql/sql_priv.h | 2 +- sql/sql_select.cc | 12 +- sql/sys_vars.cc | 8 +- .../spider/bg/r/spider_fixes.result | 4 +- .../mysql-test/spider/r/spider_fixes.result | 4 +- storage/spider/spd_table.cc | 6 - 14 files changed, 26 insertions(+), 342 deletions(-) delete mode 100644 mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index a909230121d..87645d187f2 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -427,6 +427,8 @@ KEY `varchar_key` (`varchar_key`) INSERT INTO `t1` VALUES (10,'00:00:00','i','i'),(11,'00:00:00','',''); set @old_optimizer_switch = @@session.optimizer_switch; SET SESSION OPTIMIZER_SWITCH = 'materialization=off,semijoin=off,loosescan=off,firstmatch=off,mrr=on,engine_condition_pushdown=on'; +Warnings: +Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release. 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` ; @@ -615,6 +617,8 @@ INSERT INTO t2 VALUES (9,1); # Enable Index condition pushdown set @old_icp=@@optimizer_switch; SET SESSION optimizer_switch="engine_condition_pushdown=on"; +Warnings: +Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release. SELECT pk FROM t2 diff --git a/mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result b/mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result deleted file mode 100644 index 64028e537bf..00000000000 --- a/mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result +++ /dev/null @@ -1,290 +0,0 @@ -SET @session_start_value = @@session.engine_condition_pushdown; -SELECT @session_start_value; -@session_start_value -0 -SET @global_start_value = @@global.engine_condition_pushdown; -SELECT @global_start_value; -@global_start_value -0 -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,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off -'#--------------------FN_DYNVARS_028_01------------------------#' -SET @@session.engine_condition_pushdown = 0; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SET @@session.engine_condition_pushdown = DEFAULT; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@session.engine_condition_pushdown; -@@session.engine_condition_pushdown -0 -SET @@global.engine_condition_pushdown = 0; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SET @@global.engine_condition_pushdown = DEFAULT; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. 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 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@engine_condition_pushdown; -@@engine_condition_pushdown -1 -SELECT session.engine_condition_pushdown; -ERROR 42S02: Unknown table 'session' in field list -SELECT local.engine_condition_pushdown; -ERROR 42S02: Unknown table 'local' in field list -SELECT global.engine_condition_pushdown; -ERROR 42S02: Unknown table 'global' in field list -SET session engine_condition_pushdown = 0; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@session.engine_condition_pushdown; -@@session.engine_condition_pushdown -0 -SET global engine_condition_pushdown = 0; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. 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 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@session.engine_condition_pushdown; -@@session.engine_condition_pushdown -0 -SET @@session.engine_condition_pushdown = 1; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@session.engine_condition_pushdown; -@@session.engine_condition_pushdown -1 -SET @@global.engine_condition_pushdown = 0; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@global.engine_condition_pushdown; -@@global.engine_condition_pushdown -0 -SET @@global.engine_condition_pushdown = 1; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@global.engine_condition_pushdown; -@@global.engine_condition_pushdown -1 -'#--------------------FN_DYNVARS_028_04-------------------------#' -SET @@session.engine_condition_pushdown = -1; -ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of '-1' -SET @@session.engine_condition_pushdown = 1.6; -ERROR 42000: Incorrect argument type to variable 'engine_condition_pushdown' -SET @@session.engine_condition_pushdown = "T"; -ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of 'T' -SET @@session.engine_condition_pushdown = "Y"; -ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of 'Y' -SET @@session.engine_condition_pushdown = TRÜE; -ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of 'TRÜE' -SET @@session.engine_condition_pushdown = ÕN; -ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of 'ÕN' -SET @@session.engine_condition_pushdown = OF; -ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of 'OF' -SET @@session.engine_condition_pushdown = ÓFF; -ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of 'ÓFF' -SET @@global.engine_condition_pushdown = -1; -ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of '-1' -SET @@global.engine_condition_pushdown = 2; -ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of '2' -SET @@global.engine_condition_pushdown = "T"; -ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of 'T' -SET @@global.engine_condition_pushdown = "Y"; -ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of 'Y' -SET @@global.engine_condition_pushdown = TRÜE; -ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of 'TRÜE' -SET @@global.engine_condition_pushdown = ÕN; -ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of 'ÕN' -SET @@global.engine_condition_pushdown = OF; -ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of 'OF' -SET @@global.engine_condition_pushdown = ÓFF; -ERROR 42000: Variable 'engine_condition_pushdown' can't be set to the value of 'ÓFF' -'#-------------------FN_DYNVARS_028_05----------------------------#' -SET @@global.engine_condition_pushdown = 0; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SET @@session.engine_condition_pushdown = 1; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. 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 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@session.engine_condition_pushdown AS res_is_1; -res_is_1 -1 -'#----------------------FN_DYNVARS_028_06------------------------#' -SELECT IF(@@global.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='engine_condition_pushdown'; -IF(@@global.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE -1 -SELECT @@global.engine_condition_pushdown; -@@global.engine_condition_pushdown -0 -SELECT VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='engine_condition_pushdown'; -VARIABLE_VALUE -OFF -'#----------------------FN_DYNVARS_028_07------------------------#' -SELECT IF(@@session.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES -WHERE VARIABLE_NAME='engine_condition_pushdown'; -IF(@@session.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE -1 -SELECT @@session.engine_condition_pushdown; -@@session.engine_condition_pushdown -1 -SELECT VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES -WHERE VARIABLE_NAME='engine_condition_pushdown'; -VARIABLE_VALUE -ON -'#---------------------FN_DYNVARS_028_08-------------------------#' -SET @@session.engine_condition_pushdown = OFF; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@session.engine_condition_pushdown; -@@session.engine_condition_pushdown -0 -SET @@session.engine_condition_pushdown = ON; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@session.engine_condition_pushdown; -@@session.engine_condition_pushdown -1 -SET @@global.engine_condition_pushdown = OFF; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@global.engine_condition_pushdown; -@@global.engine_condition_pushdown -0 -SET @@global.engine_condition_pushdown = ON; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. 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 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@session.engine_condition_pushdown; -@@session.engine_condition_pushdown -1 -SET @@session.engine_condition_pushdown = FALSE; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@session.engine_condition_pushdown; -@@session.engine_condition_pushdown -0 -SET @@global.engine_condition_pushdown = TRUE; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@global.engine_condition_pushdown; -@@global.engine_condition_pushdown -1 -SET @@global.engine_condition_pushdown = FALSE; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. 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,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off -set @@session.engine_condition_pushdown = TRUE; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. 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,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off -set @@session.engine_condition_pushdown = FALSE; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. 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,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off -set @@global.engine_condition_pushdown = TRUE; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. 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,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off -set @@global.engine_condition_pushdown = FALSE; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. 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,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off -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,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off -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,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off -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,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off -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,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off -SET @@session.engine_condition_pushdown = @session_start_value; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@session.engine_condition_pushdown; -@@session.engine_condition_pushdown -0 -SET @@global.engine_condition_pushdown = @global_start_value; -Warnings: -Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead -SELECT @@global.engine_condition_pushdown; -@@global.engine_condition_pushdown -0 -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 -0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=off diff --git a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result index 141ab31ea82..3160fd7c4fb 100644 --- a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result +++ b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result @@ -53,6 +53,8 @@ select @@session.optimizer_switch; @@session.optimizer_switch index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off set optimizer_switch = replace(@@optimizer_switch, '=off', '=on'); +Warnings: +Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release. select @@optimizer_switch; @@optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on diff --git a/sql/handler.h b/sql/handler.h index 703d1c615b3..4ba312963ac 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -197,17 +197,11 @@ enum enum_alter_inplace_result { #define HA_RECORD_MUST_BE_CLEAN_ON_WRITE (1ULL << 41) /* - Table condition pushdown must be performed regardless of - 'engine_condition_pushdown' setting. - - This flag is aimed at storage engines that come with "special" predicates - that can only be evaluated inside the storage engine. - For example, when one does - select * from sphinx_table where query='{fulltext_query}' - then the "query=..." condition must be always pushed down into storage - engine. + This storage engine supports condition pushdown */ -#define HA_MUST_USE_TABLE_CONDITION_PUSHDOWN (1ULL << 42) +#define HA_CAN_TABLE_CONDITION_PUSHDOWN (1ULL << 42) +/* old name for the same flag */ +#define HA_MUST_USE_TABLE_CONDITION_PUSHDOWN HA_CAN_TABLE_CONDITION_PUSHDOWN /** The handler supports read before write removal optimization diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6f0cbc24e63..31d51123f8d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -8807,18 +8807,6 @@ 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; case OPT_LOG_ERROR: /* "No --log-error" == "write errors to stderr", @@ -9199,10 +9187,6 @@ static int get_options(int *argc_ptr, char ***argv_ptr) &extra_connection_count); #endif - global_system_variables.engine_condition_pushdown= - MY_TEST(global_system_variables.optimizer_switch & - OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN); - opt_readonly= read_only; /* diff --git a/sql/mysqld.h b/sql/mysqld.h index d1efc5180a6..d68831a0d4f 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -558,7 +558,6 @@ enum options_mysqld OPT_DEBUG_SYNC_TIMEOUT, OPT_DELAY_KEY_WRITE_ALL, OPT_DEPRECATED_OPTION, - OPT_ENGINE_CONDITION_PUSHDOWN, OPT_IGNORE_DB_DIRECTORY, OPT_ISAM_LOG, OPT_KEY_BUFFER_SIZE, diff --git a/sql/records.cc b/sql/records.cc index 1b230c41156..cbcdb365f40 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -287,8 +287,8 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table, thd->variables.read_buff_size); } /* Condition pushdown to storage engine */ - if ((thd->variables.optimizer_switch & - OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) && + if ((table->file->ha_table_flags() & + HA_MUST_USE_TABLE_CONDITION_PUSHDOWN) && select && select->cond && (select->cond->used_tables() & table->map) && !table->file->pushed_cond) diff --git a/sql/sql_class.h b/sql/sql_class.h index 243cc4459a0..dfa6da5b7ce 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -602,7 +602,6 @@ typedef struct system_variables my_bool tx_read_only; my_bool low_priority_updates; my_bool query_cache_wlock_invalidate; - my_bool engine_condition_pushdown; my_bool keep_files_on_create; my_bool old_mode; diff --git a/sql/sql_priv.h b/sql/sql_priv.h index 5dc19181e9b..9578c2fe8df 100644 --- a/sql/sql_priv.h +++ b/sql/sql_priv.h @@ -199,7 +199,7 @@ template bool valid_buffer_range(T jump, #define OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION (1ULL << 2) #define OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT (1ULL << 3) #define OPTIMIZER_SWITCH_INDEX_MERGE_SORT_INTERSECT (1ULL << 4) -#define OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN (1ULL << 5) +#define deprecated_ENGINE_CONDITION_PUSHDOWN (1ULL << 5) #define OPTIMIZER_SWITCH_INDEX_COND_PUSHDOWN (1ULL << 6) #define OPTIMIZER_SWITCH_DERIVED_MERGE (1ULL << 7) #define OPTIMIZER_SWITCH_DERIVED_WITH_KEYS (1ULL << 8) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 5e8c3b26ff3..f7d492ceb68 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -9569,10 +9569,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) if (tab->table) { tab->table->file->pushed_cond= NULL; - if (((thd->variables.optimizer_switch & - OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) || - (tab->table->file->ha_table_flags() & - HA_MUST_USE_TABLE_CONDITION_PUSHDOWN)) && + if ((tab->table->file->ha_table_flags() & + HA_MUST_USE_TABLE_CONDITION_PUSHDOWN) && !first_inner_tab) { COND *push_cond= @@ -23631,10 +23629,8 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab { const COND *pushed_cond= tab->table->file->pushed_cond; - if (((thd->variables.optimizer_switch & - OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) || - (tab->table->file->ha_table_flags() & - HA_MUST_USE_TABLE_CONDITION_PUSHDOWN)) && + if ((tab->table->file->ha_table_flags() & + HA_MUST_USE_TABLE_CONDITION_PUSHDOWN) && pushed_cond) { eta->push_extra(ET_USING_WHERE_WITH_PUSHED_CONDITION); diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index b9304403ee5..722dabeb15a 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2222,13 +2222,15 @@ export const char *optimizer_switch_names[]= "exists_to_in", "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= - MY_TEST(sv->optimizer_switch & OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN); + if (sv->optimizer_switch & deprecated_ENGINE_CONDITION_PUSHDOWN) + push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT, + ER(ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT), + "engine_condition_pushdown=on"); return false; } static Sys_var_flagset Sys_optimizer_switch( diff --git a/storage/spider/mysql-test/spider/bg/r/spider_fixes.result b/storage/spider/mysql-test/spider/bg/r/spider_fixes.result index 6db61fa93d2..3033586821e 100644 --- a/storage/spider/mysql-test/spider/bg/r/spider_fixes.result +++ b/storage/spider/mysql-test/spider/bg/r/spider_fixes.result @@ -245,7 +245,7 @@ a b c direct order limit SHOW STATUS LIKE 'Spider_direct_order_limit'; Variable_name Value -Spider_direct_order_limit 0 +Spider_direct_order_limit 2 SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3; a b c 1 2 4 @@ -253,7 +253,7 @@ a b c 3 4 5 SHOW STATUS LIKE 'Spider_direct_order_limit'; Variable_name Value -Spider_direct_order_limit 0 +Spider_direct_order_limit 3 2.26 lock tables diff --git a/storage/spider/mysql-test/spider/r/spider_fixes.result b/storage/spider/mysql-test/spider/r/spider_fixes.result index 6db61fa93d2..3033586821e 100644 --- a/storage/spider/mysql-test/spider/r/spider_fixes.result +++ b/storage/spider/mysql-test/spider/r/spider_fixes.result @@ -245,7 +245,7 @@ a b c direct order limit SHOW STATUS LIKE 'Spider_direct_order_limit'; Variable_name Value -Spider_direct_order_limit 0 +Spider_direct_order_limit 2 SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3; a b c 1 2 4 @@ -253,7 +253,7 @@ a b c 3 4 5 SHOW STATUS LIKE 'Spider_direct_order_limit'; Variable_name Value -Spider_direct_order_limit 0 +Spider_direct_order_limit 3 2.26 lock tables diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 2eb852e61a8..0926f45773b 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -7870,12 +7870,6 @@ bool spider_check_direct_order_limit( DBUG_PRINT("info",("spider select_limit=%lld", select_limit)); DBUG_PRINT("info",("spider offset_limit=%lld", offset_limit)); if ( -#if MYSQL_VERSION_ID < 50500 - !thd->variables.engine_condition_pushdown || -#else - !(thd->variables.optimizer_switch & - OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) || -#endif !select_lex || #if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 select_lex->leaf_tables.elements != 1 ||