Commit de4a3c2a authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-6312 HA_MUST_USE_TABLE_CONDITION_PUSHDOWN is not accounted by init_read_record()

parent c39a501c
......@@ -287,9 +287,7 @@ 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) &&
select && select->cond &&
if (thd->use_cond_push(table->file) && select && select->cond &&
(select->cond->used_tables() & table->map) &&
!table->file->pushed_cond)
table->file->cond_push(select->cond);
......
......@@ -2894,6 +2894,11 @@ class THD :public Statement,
// End implementation of MDL_context_owner interface.
inline bool use_cond_push(handler *file)
{
return (variables.optimizer_switch & OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN)
|| (file->ha_table_flags() & HA_MUST_USE_TABLE_CONDITION_PUSHDOWN);
}
inline bool is_strict_mode() const
{
return (bool) (variables.sql_mode & (MODE_STRICT_TRANS_TABLES |
......
......@@ -9530,11 +9530,7 @@ 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)) &&
!first_inner_tab)
if (thd->use_cond_push(tab->table->file) && !first_inner_tab)
{
COND *push_cond=
make_cond_for_table(thd, tmp, current_map, current_map,
......@@ -23559,11 +23555,7 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table,
{
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)) &&
pushed_cond)
if (thd->use_cond_push(tab->table->file) && pushed_cond)
{
eta->push_extra(ET_USING_WHERE_WITH_PUSHED_CONDITION);
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment