summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-07-31 11:08:56 +0200
committerSergei Golubchik <sergii@pisem.net>2014-07-31 11:08:56 +0200
commitde4a3c2a1dd82561a7ef53e3edd812265bd267b2 (patch)
tree246157bc8320cdc64ec66c9df536a421e74b03df
parentc39a501cbee72d46a3ba87f2b6658dd711b07925 (diff)
downloadmariadb-git-de4a3c2a1dd82561a7ef53e3edd812265bd267b2.tar.gz
MDEV-6312 HA_MUST_USE_TABLE_CONDITION_PUSHDOWN is not accounted by init_read_record()
-rw-r--r--sql/records.cc4
-rw-r--r--sql/sql_class.h5
-rw-r--r--sql/sql_select.cc12
3 files changed, 8 insertions, 13 deletions
diff --git a/sql/records.cc b/sql/records.cc
index 1b230c41156..cce6272a4e3 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -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);
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 40a24b5cd7f..ce69869b93c 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2894,6 +2894,11 @@ public:
// 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 |
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 2e4227ed8a0..3b3d1527607 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -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);
/*