summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2015-08-11 11:18:38 +0400
committerSergey Vojtovich <svoj@mariadb.org>2015-08-21 10:40:39 +0400
commit31e365efae28ba3208e80511c4d18fe11a79541a (patch)
treef249682cc42490fc86382f5244a051001dc13c9e /sql/table.cc
parent4374da63f03abc472f68f42e4e93261a18bfe417 (diff)
downloadmariadb-git-31e365efae28ba3208e80511c4d18fe11a79541a.tar.gz
MDEV-8010 - Avoid sql_alloc() in Items (Patch #1)
Added mandatory thd parameter to Item (and all derivative classes) constructor. Added thd parameter to all routines that may create items. Also removed "current_thd" from Item::Item. This reduced number of pthread_getspecific() calls from 290 to 177 per OLTP RO transaction.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 92ecb517aeb..9beada2667f 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -4142,7 +4142,7 @@ bool TABLE::fill_item_list(List<Item> *item_list) const
*/
for (Field **ptr= field; *ptr; ptr++)
{
- Item_field *item= new Item_field(*ptr);
+ Item_field *item= new Item_field(in_use, *ptr);
if (!item || item_list->push_back(item))
return TRUE;
}
@@ -4390,7 +4390,7 @@ bool TABLE_LIST::prep_where(THD *thd, Item **conds,
this expression will not be moved to WHERE condition (i.e. will
be clean correctly for PS/SP)
*/
- tbl->on_expr= and_conds(tbl->on_expr,
+ tbl->on_expr= and_conds(thd, tbl->on_expr,
where->copy_andor_structure(thd));
break;
}
@@ -4400,7 +4400,7 @@ bool TABLE_LIST::prep_where(THD *thd, Item **conds,
if (*conds && !(*conds)->fixed)
res= (*conds)->fix_fields(thd, conds);
if (!res)
- *conds= and_conds(*conds, where->copy_andor_structure(thd));
+ *conds= and_conds(thd, *conds, where->copy_andor_structure(thd));
if (*conds && !(*conds)->fixed && !res)
res= (*conds)->fix_fields(thd, conds);
}
@@ -4472,7 +4472,7 @@ merge_on_conds(THD *thd, TABLE_LIST *table, bool is_cascaded)
{
if (tbl->view && !is_cascaded)
continue;
- cond= and_conds(cond, merge_on_conds(thd, tbl, is_cascaded));
+ cond= and_conds(thd, cond, merge_on_conds(thd, tbl, is_cascaded));
}
DBUG_RETURN(cond);
}
@@ -4532,10 +4532,10 @@ bool TABLE_LIST::prep_check_option(THD *thd, uint8 check_opt_type)
for (TABLE_LIST *tbl= merge_underlying_list; tbl; tbl= tbl->next_local)
{
if (tbl->check_option)
- check_option= and_conds(check_option, tbl->check_option);
+ check_option= and_conds(thd, check_option, tbl->check_option);
}
}
- check_option= and_conds(check_option,
+ check_option= and_conds(thd, check_option,
merge_on_conds(thd, this, is_cascaded));
if (arena)
@@ -5354,7 +5354,7 @@ Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref,
{
DBUG_RETURN(field);
}
- Item *item= new Item_direct_view_ref(&view->view->select_lex.context,
+ Item *item= new Item_direct_view_ref(thd, &view->view->select_lex.context,
field_ref, view->alias,
name, view);
/*
@@ -7328,7 +7328,7 @@ bool TABLE_LIST::change_refs_to_fields()
DBUG_ASSERT(!field_it.end_of_fields());
if (!materialized_items[idx])
{
- materialized_items[idx]= new Item_field(table->field[idx]);
+ materialized_items[idx]= new Item_field(thd, table->field[idx]);
if (!materialized_items[idx])
return TRUE;
}