revision-id: eecac1976469d513062a0741005afc357b897871 parent(s): f1c1c04a34f39bcd6622b9886fb089dd41e51103 committer: Sergei Golubchik branch nick: maria timestamp: 2014-08-25 23:13:37 +0200 message:
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
--- [skip] --- 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 57d2cc6..fe52a85 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -8574,18 +8574,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", @@ -8964,10 +8952,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 21c020b..7a0a75c 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -554,7 +554,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 1b230c4..cbcdb36 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 f96110e..c42a87a 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -597,7 +597,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 5dc1918..9578c2f 100644 --- a/sql/sql_priv.h +++ b/sql/sql_priv.h @@ -199,7 +199,7 @@ template <class T> 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 05c88a5..f061b51 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -9561,10 +9561,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) && It might be that it is better to use 'new' name for the flag in the
Hi! Everything is OK. Except one small note in two places. But it is OK to push as is. 26.08.2014 17:17, serg@mariadb.org пишет: lines we have changed.
!first_inner_tab) { COND *push_cond= @@ -23598,10 +23596,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) &&
The same.
pushed_cond) { eta->push_extra(ET_USING_WHERE_WITH_PUSHED_CONDITION); diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 7f7c725..db764d7 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2181,13 +2181,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 6db61fa..3033586 100644
[skip]