diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2015-04-17 14:30:15 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2015-05-13 10:43:14 +0400 |
commit | 4d1ccc42890029e07048772579af97072e0fa3d5 (patch) | |
tree | 38fcd49963a7fe185636a0e4045edb6e700a6dca /sql | |
parent | c4d2c4e844717d9d5b2c0e4f0f9cfc7cc2c24fa6 (diff) | |
download | mariadb-git-4d1ccc42890029e07048772579af97072e0fa3d5.tar.gz |
MDEV-7951 - sql_alloc() takes 0.25% in OLTP RO
sql_alloc() has additional costs compared to direct mem_root allocation:
- function call: it is defined in a separate translation unit and can't be
inlined
- it needs to call pthread_getspecific() to get THD::mem_root
It is called dozens of times implicitely at least by:
- List<>::push_back()
- List<>::push_front()
- new (for Sql_alloc derived classes)
- sql_memdup()
Replaced lots of implicit sql_alloc() calls with direct mem_root allocation,
passing through THD pointer whenever it is needed.
Number of sql_alloc() calls reduced 345 -> 41 per OLTP RO transaction.
pthread_getspecific() overhead dropped 0.76 -> 0.59
sql_alloc() overhed dropped 0.25 -> 0.06
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.cc | 2 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 72 | ||||
-rw-r--r-- | sql/item_cmpfunc.h | 38 | ||||
-rw-r--r-- | sql/item_subselect.cc | 40 | ||||
-rw-r--r-- | sql/opt_range.cc | 21 | ||||
-rw-r--r-- | sql/opt_range.h | 6 | ||||
-rw-r--r-- | sql/sql_base.cc | 8 | ||||
-rw-r--r-- | sql/sql_base.h | 2 | ||||
-rw-r--r-- | sql/sql_delete.cc | 2 | ||||
-rw-r--r-- | sql/sql_derived.cc | 2 | ||||
-rw-r--r-- | sql/sql_explain.cc | 2 | ||||
-rw-r--r-- | sql/sql_lex.cc | 8 | ||||
-rw-r--r-- | sql/sql_lex.h | 4 | ||||
-rw-r--r-- | sql/sql_list.h | 11 | ||||
-rw-r--r-- | sql/sql_parse.cc | 8 | ||||
-rw-r--r-- | sql/sql_select.cc | 82 | ||||
-rw-r--r-- | sql/sql_select.h | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 | ||||
-rw-r--r-- | sql/sql_update.cc | 2 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 16 |
20 files changed, 173 insertions, 157 deletions
diff --git a/sql/item.cc b/sql/item.cc index 6e856856c16..02fe2b0b2fe 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2594,7 +2594,7 @@ void Item_field::fix_after_pullout(st_select_lex *new_parent, Item **ref) Item *Item_field::get_tmp_table_item(THD *thd) { - Item_field *new_item= new Item_field(thd, this); + Item_field *new_item= new (thd->mem_root) Item_field(thd, this); if (new_item) new_item->field= new_item->result_field; return new_item; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 53c96420641..65d10608296 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -264,64 +264,64 @@ static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, } -Item_bool_func2* Eq_creator::create(Item *a, Item *b) const +Item_bool_func2* Eq_creator::create(THD *thd, Item *a, Item *b) const { - return new Item_func_eq(a, b); + return new (thd->mem_root) Item_func_eq(a, b); } -Item_bool_func2* Eq_creator::create_swap(Item *a, Item *b) const +Item_bool_func2* Eq_creator::create_swap(THD *thd, Item *a, Item *b) const { - return new Item_func_eq(b, a); + return new (thd->mem_root) Item_func_eq(b, a); } -Item_bool_func2* Ne_creator::create(Item *a, Item *b) const +Item_bool_func2* Ne_creator::create(THD *thd, Item *a, Item *b) const { - return new Item_func_ne(a, b); + return new (thd->mem_root) Item_func_ne(a, b); } -Item_bool_func2* Ne_creator::create_swap(Item *a, Item *b) const +Item_bool_func2* Ne_creator::create_swap(THD *thd, Item *a, Item *b) const { - return new Item_func_ne(b, a); + return new (thd->mem_root) Item_func_ne(b, a); } -Item_bool_func2* Gt_creator::create(Item *a, Item *b) const +Item_bool_func2* Gt_creator::create(THD *thd, Item *a, Item *b) const { - return new Item_func_gt(a, b); + return new (thd->mem_root) Item_func_gt(a, b); } -Item_bool_func2* Gt_creator::create_swap(Item *a, Item *b) const +Item_bool_func2* Gt_creator::create_swap(THD *thd, Item *a, Item *b) const { - return new Item_func_lt(b, a); + return new (thd->mem_root) Item_func_lt(b, a); } -Item_bool_func2* Lt_creator::create(Item *a, Item *b) const +Item_bool_func2* Lt_creator::create(THD *thd, Item *a, Item *b) const { - return new Item_func_lt(a, b); + return new (thd->mem_root) Item_func_lt(a, b); } -Item_bool_func2* Lt_creator::create_swap(Item *a, Item *b) const +Item_bool_func2* Lt_creator::create_swap(THD *thd, Item *a, Item *b) const { - return new Item_func_gt(b, a); + return new (thd->mem_root) Item_func_gt(b, a); } -Item_bool_func2* Ge_creator::create(Item *a, Item *b) const +Item_bool_func2* Ge_creator::create(THD *thd, Item *a, Item *b) const { - return new Item_func_ge(a, b); + return new (thd->mem_root) Item_func_ge(a, b); } -Item_bool_func2* Ge_creator::create_swap(Item *a, Item *b) const +Item_bool_func2* Ge_creator::create_swap(THD *thd, Item *a, Item *b) const { - return new Item_func_le(b, a); + return new (thd->mem_root) Item_func_le(b, a); } -Item_bool_func2* Le_creator::create(Item *a, Item *b) const +Item_bool_func2* Le_creator::create(THD *thd, Item *a, Item *b) const { - return new Item_func_le(a, b); + return new (thd->mem_root) Item_func_le(a, b); } -Item_bool_func2* Le_creator::create_swap(Item *a, Item *b) const +Item_bool_func2* Le_creator::create_swap(THD *thd, Item *a, Item *b) const { - return new Item_func_ge(b, a); + return new (thd->mem_root) Item_func_ge(b, a); } /* @@ -5746,7 +5746,7 @@ Item_equal::Item_equal(Item_equal *item_equal) The optional parameter f is used to adjust the flag compare_as_dates. */ -void Item_equal::add_const(Item *c, Item *f) +void Item_equal::add_const(THD *thd, Item *c, Item *f) { if (cond_false) return; @@ -5766,7 +5766,7 @@ void Item_equal::add_const(Item *c, Item *f) } else { - Item_func_eq *func= new Item_func_eq(c, const_item); + Item_func_eq *func= new (thd->mem_root) Item_func_eq(c, const_item); if (func->set_cmp_func()) { /* @@ -5833,7 +5833,7 @@ bool Item_equal::contains(Field *field) contains a reference to f2->field. */ -void Item_equal::merge(Item_equal *item) +void Item_equal::merge(THD *thd, Item_equal *item) { Item *c= item->get_const(); if (c) @@ -5846,7 +5846,7 @@ void Item_equal::merge(Item_equal *item) the multiple equality already contains a constant and its value is not equal to the value of c. */ - add_const(c); + add_const(thd, c); } cond_false|= item->cond_false; } @@ -5880,7 +5880,7 @@ void Item_equal::merge(Item_equal *item) they have common members. */ -bool Item_equal::merge_with_check(Item_equal *item, bool save_merged) +bool Item_equal::merge_with_check(THD *thd, Item_equal *item, bool save_merged) { bool intersected= FALSE; Item_equal_fields_iterator_slow fi(*item); @@ -5897,12 +5897,12 @@ bool Item_equal::merge_with_check(Item_equal *item, bool save_merged) if (intersected) { if (!save_merged) - merge(item); + merge(thd, item); else { Item *c= item->get_const(); if (c) - add_const(c); + add_const(thd, c); if (!cond_false) { Item *item; @@ -5939,7 +5939,7 @@ bool Item_equal::merge_with_check(Item_equal *item, bool save_merged) Item_equal is joined to the 'list'. */ -void Item_equal::merge_into_list(List<Item_equal> *list, +void Item_equal::merge_into_list(THD *thd, List<Item_equal> *list, bool save_merged, bool only_intersected) { @@ -5950,12 +5950,12 @@ void Item_equal::merge_into_list(List<Item_equal> *list, { if (!merge_into) { - if (item->merge_with_check(this, save_merged)) + if (item->merge_with_check(thd, this, save_merged)) merge_into= item; } else { - if (merge_into->merge_with_check(item, false)) + if (merge_into->merge_with_check(thd, item, false)) it.remove(); } } @@ -6005,7 +6005,7 @@ void Item_equal::sort(Item_field_cmpfunc compare, void *arg) Currently this function is called only after substitution of constant tables. */ -void Item_equal::update_const() +void Item_equal::update_const(THD *thd) { List_iterator<Item> it(equal_items); if (with_const) @@ -6034,7 +6034,7 @@ void Item_equal::update_const() else { it.remove(); - add_const(item); + add_const(thd, item); } } } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 53f249d9def..694b5c180de 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -293,11 +293,11 @@ public: /** Create operation with given arguments. */ - virtual Item_bool_func2* create(Item *a, Item *b) const = 0; + virtual Item_bool_func2* create(THD *thd, Item *a, Item *b) const = 0; /** Create operation with given arguments in swap order. */ - virtual Item_bool_func2* create_swap(Item *a, Item *b) const = 0; + virtual Item_bool_func2* create_swap(THD *thd, Item *a, Item *b) const = 0; virtual const char* symbol(bool invert) const = 0; virtual bool eqne_op() const = 0; virtual bool l_op() const = 0; @@ -308,8 +308,8 @@ class Eq_creator :public Comp_creator public: Eq_creator() {} /* Remove gcc warning */ virtual ~Eq_creator() {} /* Remove gcc warning */ - virtual Item_bool_func2* create(Item *a, Item *b) const; - virtual Item_bool_func2* create_swap(Item *a, Item *b) const; + virtual Item_bool_func2* create(THD *thd, Item *a, Item *b) const; + virtual Item_bool_func2* create_swap(THD *thd, Item *a, Item *b) const; virtual const char* symbol(bool invert) const { return invert? "<>" : "="; } virtual bool eqne_op() const { return 1; } virtual bool l_op() const { return 0; } @@ -320,8 +320,8 @@ class Ne_creator :public Comp_creator public: Ne_creator() {} /* Remove gcc warning */ virtual ~Ne_creator() {} /* Remove gcc warning */ - virtual Item_bool_func2* create(Item *a, Item *b) const; - virtual Item_bool_func2* create_swap(Item *a, Item *b) const; + virtual Item_bool_func2* create(THD *thd, Item *a, Item *b) const; + virtual Item_bool_func2* create_swap(THD *thd, Item *a, Item *b) const; virtual const char* symbol(bool invert) const { return invert? "=" : "<>"; } virtual bool eqne_op() const { return 1; } virtual bool l_op() const { return 0; } @@ -332,8 +332,8 @@ class Gt_creator :public Comp_creator public: Gt_creator() {} /* Remove gcc warning */ virtual ~Gt_creator() {} /* Remove gcc warning */ - virtual Item_bool_func2* create(Item *a, Item *b) const; - virtual Item_bool_func2* create_swap(Item *a, Item *b) const; + virtual Item_bool_func2* create(THD *thd, Item *a, Item *b) const; + virtual Item_bool_func2* create_swap(THD *thd, Item *a, Item *b) const; virtual const char* symbol(bool invert) const { return invert? "<=" : ">"; } virtual bool eqne_op() const { return 0; } virtual bool l_op() const { return 0; } @@ -344,8 +344,8 @@ class Lt_creator :public Comp_creator public: Lt_creator() {} /* Remove gcc warning */ virtual ~Lt_creator() {} /* Remove gcc warning */ - virtual Item_bool_func2* create(Item *a, Item *b) const; - virtual Item_bool_func2* create_swap(Item *a, Item *b) const; + virtual Item_bool_func2* create(THD *thd, Item *a, Item *b) const; + virtual Item_bool_func2* create_swap(THD *thd, Item *a, Item *b) const; virtual const char* symbol(bool invert) const { return invert? ">=" : "<"; } virtual bool eqne_op() const { return 0; } virtual bool l_op() const { return 1; } @@ -356,8 +356,8 @@ class Ge_creator :public Comp_creator public: Ge_creator() {} /* Remove gcc warning */ virtual ~Ge_creator() {} /* Remove gcc warning */ - virtual Item_bool_func2* create(Item *a, Item *b) const; - virtual Item_bool_func2* create_swap(Item *a, Item *b) const; + virtual Item_bool_func2* create(THD *thd, Item *a, Item *b) const; + virtual Item_bool_func2* create_swap(THD *thd, Item *a, Item *b) const; virtual const char* symbol(bool invert) const { return invert? "<" : ">="; } virtual bool eqne_op() const { return 0; } virtual bool l_op() const { return 0; } @@ -368,8 +368,8 @@ class Le_creator :public Comp_creator public: Le_creator() {} /* Remove gcc warning */ virtual ~Le_creator() {} /* Remove gcc warning */ - virtual Item_bool_func2* create(Item *a, Item *b) const; - virtual Item_bool_func2* create_swap(Item *a, Item *b) const; + virtual Item_bool_func2* create(THD *thd, Item *a, Item *b) const; + virtual Item_bool_func2* create_swap(THD *thd, Item *a, Item *b) const; virtual const char* symbol(bool invert) const { return invert? ">" : "<="; } virtual bool eqne_op() const { return 0; } virtual bool l_op() const { return 1; } @@ -1940,18 +1940,18 @@ public: Item_equal(Item_equal *item_equal); /* Currently the const item is always the first in the list of equal items */ inline Item* get_const() { return with_const ? equal_items.head() : NULL; } - void add_const(Item *c, Item *f = NULL); + void add_const(THD *thd, Item *c, Item *f = NULL); /** Add a non-constant item to the multiple equality */ void add(Item *f) { equal_items.push_back(f); } bool contains(Field *field); Item* get_first(struct st_join_table *context, Item *field); /** Get number of field items / references to field items in this object */ uint n_field_items() { return equal_items.elements - MY_TEST(with_const); } - void merge(Item_equal *item); - bool merge_with_check(Item_equal *equal_item, bool save_merged); - void merge_into_list(List<Item_equal> *list, bool save_merged, + void merge(THD *thd, Item_equal *item); + bool merge_with_check(THD *thd, Item_equal *equal_item, bool save_merged); + void merge_into_list(THD *thd, List<Item_equal> *list, bool save_merged, bool only_intersected); - void update_const(); + void update_const(THD *thd); enum Functype functype() const { return MULT_EQUAL_FUNC; } longlong val_int(); const char *func_name() const { return "multiple equal"; } diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 496cb1185c8..b8a829a500f 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1776,7 +1776,7 @@ Item_in_subselect::single_value_transformer(JOIN *join) of the statement. Thus one of 'substitution' arguments can be broken in case of PS. */ - substitution= func->create(left_expr, where_item); + substitution= func->create(thd, left_expr, where_item); have_to_be_excluded= 1; if (thd->lex->describe) { @@ -1945,7 +1945,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join) The swap is needed for expressions of type 'f1 < ALL ( SELECT ....)' where we want to evaluate the sub query even if f1 would be null. */ - subs= func->create_swap(*(optimizer->get_cache()), subs); + subs= func->create_swap(thd, *(optimizer->get_cache()), subs); thd->change_item_tree(place, subs); if (subs->fix_fields(thd, &subs)) DBUG_RETURN(true); @@ -2037,8 +2037,9 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join, if (join_having || select_lex->with_sum_func || select_lex->group_list.elements) { - Item *item= func->create(expr, - new Item_ref_null_helper(&select_lex->context, + Item *item= func->create(thd, expr, + new (thd->mem_root) Item_ref_null_helper( + &select_lex->context, this, select_lex-> ref_pointer_array, @@ -2068,14 +2069,14 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join, Item *having= item; Item *orig_item= item; - item= func->create(expr, item); + item= func->create(thd, expr, item); if (!abort_on_null && orig_item->maybe_null) { - having= new Item_is_not_null_test(this, having); + having= new (thd->mem_root) Item_is_not_null_test(this, having); if (left_expr->maybe_null) { - if (!(having= new Item_func_trig_cond(having, - get_cond_guard(0)))) + if (!(having= new (thd->mem_root) Item_func_trig_cond(having, + get_cond_guard(0)))) DBUG_RETURN(true); } having->name= (char*) in_having_cond; @@ -2083,8 +2084,8 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join, DBUG_RETURN(true); *having_item= having; - item= new Item_cond_or(item, - new Item_func_isnull(orig_item)); + item= new (thd->mem_root) Item_cond_or(item, + new (thd->mem_root) Item_func_isnull(orig_item)); } /* If we may encounter NULL IN (SELECT ...) and care whether subquery @@ -2092,7 +2093,8 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join, */ if (!abort_on_null && left_expr->maybe_null) { - if (!(item= new Item_func_trig_cond(item, get_cond_guard(0)))) + if (!(item= new (thd->mem_root) Item_func_trig_cond(item, + get_cond_guard(0)))) DBUG_RETURN(true); } @@ -2111,15 +2113,17 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN * join, if (select_lex->master_unit()->is_union()) { Item *new_having= - func->create(expr, - new Item_ref_null_helper(&select_lex->context, this, - select_lex->ref_pointer_array, - (char *)"<no matter>", - (char *)"<result>")); + func->create(thd, expr, + new (thd->mem_root) Item_ref_null_helper( + &select_lex->context, + this, + select_lex->ref_pointer_array, + (char *)"<no matter>", + (char *)"<result>")); if (!abort_on_null && left_expr->maybe_null) { - if (!(new_having= new Item_func_trig_cond(new_having, - get_cond_guard(0)))) + if (!(new_having= new (thd->mem_root) Item_func_trig_cond(new_having, + get_cond_guard(0)))) DBUG_RETURN(true); } diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 49aaa1dac1e..0f1fa407b6b 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -411,7 +411,7 @@ public: { return sel_cmp(field,max_value, arg->min_value, max_flag, arg->min_flag); } - SEL_ARG *clone_and(SEL_ARG* arg) + SEL_ARG *clone_and(THD *thd, SEL_ARG* arg) { // Get overlapping range uchar *new_min,*new_max; uint8 flag_min,flag_max; @@ -431,8 +431,9 @@ public: { new_max=arg->max_value; flag_max=arg->max_flag; } - return new SEL_ARG(field, part, new_min, new_max, flag_min, flag_max, - MY_TEST(maybe_flag && arg->maybe_flag)); + return new (thd->mem_root) SEL_ARG(field, part, new_min, new_max, flag_min, + flag_max, + MY_TEST(maybe_flag && arg->maybe_flag)); } SEL_ARG *clone_first(SEL_ARG *arg) { // min <= X < arg->min @@ -1772,7 +1773,7 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables, if (!conds && !allow_null_cond) DBUG_RETURN(0); - if (!(select= new SQL_SELECT)) + if (!(select= new (head->in_use->mem_root) SQL_SELECT)) { *error= 1; // out of memory DBUG_RETURN(0); /* purecov: inspected */ @@ -8231,7 +8232,7 @@ get_mm_parts(RANGE_OPT_PARAM *param, COND *cond_func, Field *field, if (field->eq(key_part->field)) { SEL_ARG *sel_arg=0; - if (!tree && !(tree=new SEL_TREE())) + if (!tree && !(tree=new (param->thd->mem_root) SEL_TREE())) DBUG_RETURN(0); // OOM if (!value || !(value->used_tables() & ~param->read_tables)) { @@ -9482,7 +9483,7 @@ key_and(RANGE_OPT_PARAM *param, SEL_ARG *key1, SEL_ARG *key2, uint clone_flag) e2->incr_refs(); if (!next || next->type != SEL_ARG::IMPOSSIBLE) { - SEL_ARG *new_arg= e1->clone_and(e2); + SEL_ARG *new_arg= e1->clone_and(param->thd, e2); if (!new_arg) return &null_element; // End of memory new_arg->next_key_part=next; @@ -11053,7 +11054,9 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key, } /* Get range for retrieving rows in QUICK_SELECT::get_next */ - if (!(range= new QUICK_RANGE(param->min_key, + if (!(range= new (param->thd->mem_root) QUICK_RANGE( + param->thd, + param->min_key, (uint) (tmp_min_key - param->min_key), min_part >=0 ? make_keypart_map(min_part) : 0, param->max_key, @@ -11271,7 +11274,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, *ref->null_ref_key= 1; // Set null byte then create a range if (!(null_range= new (alloc) - QUICK_RANGE(ref->key_buff, ref->key_length, + QUICK_RANGE(thd, ref->key_buff, ref->key_length, make_prev_keypart_map(ref->key_parts), ref->key_buff, ref->key_length, make_prev_keypart_map(ref->key_parts), EQ_RANGE))) @@ -14193,7 +14196,7 @@ bool QUICK_GROUP_MIN_MAX_SELECT::add_range(SEL_ARG *sel_range) min_max_arg_len) == 0) range_flag|= EQ_RANGE; /* equality condition */ } - range= new QUICK_RANGE(sel_range->min_value, min_max_arg_len, + range= new QUICK_RANGE(join->thd, sel_range->min_value, min_max_arg_len, make_keypart_map(sel_range->part), sel_range->max_value, min_max_arg_len, make_keypart_map(sel_range->part), diff --git a/sql/opt_range.h b/sql/opt_range.h index df6dfe8c8a4..e81a536c2b6 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -69,13 +69,13 @@ class QUICK_RANGE :public Sql_alloc { uint16 dummy; /* Avoid warnings on 'flag' */ #endif QUICK_RANGE(); /* Full range */ - QUICK_RANGE(const uchar *min_key_arg, uint min_length_arg, + QUICK_RANGE(THD *thd, const uchar *min_key_arg, uint min_length_arg, key_part_map min_keypart_map_arg, const uchar *max_key_arg, uint max_length_arg, key_part_map max_keypart_map_arg, uint flag_arg) - : min_key((uchar*) sql_memdup(min_key_arg,min_length_arg+1)), - max_key((uchar*) sql_memdup(max_key_arg,max_length_arg+1)), + : min_key((uchar*) thd->memdup(min_key_arg, min_length_arg + 1)), + max_key((uchar*) thd->memdup(max_key_arg, max_length_arg + 1)), min_length((uint16) min_length_arg), max_length((uint16) max_length_arg), flag((uint16) flag_arg), diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 262b0148dfb..b2c9f75fa7e 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -7962,7 +7962,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array, RETURN pointer on pointer to next_leaf of last element */ -void make_leaves_list(List<TABLE_LIST> &list, TABLE_LIST *tables, +void make_leaves_list(THD *thd, List<TABLE_LIST> &list, TABLE_LIST *tables, bool full_table_list, TABLE_LIST *boundary) { @@ -7978,12 +7978,12 @@ void make_leaves_list(List<TABLE_LIST> &list, TABLE_LIST *tables, tables/views were already prepared and has their leaf_tables set properly. */ - make_leaves_list(list, select_lex->get_table_list(), + make_leaves_list(thd, list, select_lex->get_table_list(), full_table_list, boundary); } else { - list.push_back(table); + list.push_back(table, thd->mem_root); } } } @@ -8044,7 +8044,7 @@ bool setup_tables(THD *thd, Name_resolution_context *context, leaves.empty(); if (!select_lex->is_prep_leaf_list_saved) { - make_leaves_list(leaves, tables, full_table_list, first_select_table); + make_leaves_list(thd, leaves, tables, full_table_list, first_select_table); select_lex->leaf_tables_exec.empty(); } else diff --git a/sql/sql_base.h b/sql/sql_base.h index 876bc6e7ed7..1c0029d9692 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -164,7 +164,7 @@ bool fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, bool insert_fields(THD *thd, Name_resolution_context *context, const char *db_name, const char *table_name, List_iterator<Item> *it, bool any_privileges); -void make_leaves_list(List<TABLE_LIST> &list, TABLE_LIST *tables, +void make_leaves_list(THD *thd, List<TABLE_LIST> &list, TABLE_LIST *tables, bool full_table_list, TABLE_LIST *boundary); int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields, List<Item> *sum_func_list, uint wild_num); diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index b72f552441b..fa647679e23 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -496,7 +496,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, Filesort_tracker *fs_tracker= thd->lex->explain->get_upd_del_plan()->filesort_tracker; - if (!(sortorder= make_unireg_sortorder(order, &length, NULL)) || + if (!(sortorder= make_unireg_sortorder(thd, order, &length, NULL)) || (table->sort.found_records= filesort(thd, table, sortorder, length, select, HA_POS_ERROR, true, diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 5bc83aefb98..60e49fc2756 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -407,7 +407,7 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived) if (!derived->get_unit()->prepared) { dt_select->leaf_tables.empty(); - make_leaves_list(dt_select->leaf_tables, derived, TRUE, 0); + make_leaves_list(thd, dt_select->leaf_tables, derived, TRUE, 0); } derived->nested_join= (NESTED_JOIN*) thd->calloc(sizeof(NESTED_JOIN)); diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 268555db545..1cfaeaa27ec 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -1191,7 +1191,7 @@ const char *String_list::append_str(MEM_ROOT *mem_root, const char *str) if (!(cp = (char*)alloc_root(mem_root, len+1))) return NULL; memcpy(cp, str, len+1); - push_back(cp); + push_back(cp, mem_root); return cp; } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 775f462687c..a6d2e5b6705 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1865,7 +1865,7 @@ void st_select_lex::init_query() thus push_context should be moved to a place where query initialization is checked for failure. */ - parent_lex->push_context(&context); + parent_lex->push_context(&context, parent_lex->thd->mem_root); cond_count= between_count= with_wild= 0; max_equal_elems= 0; ref_pointer_array= 0; @@ -2315,7 +2315,7 @@ bool st_select_lex::add_item_to_list(THD *thd, Item *item) { DBUG_ENTER("st_select_lex::add_item_to_list"); DBUG_PRINT("info", ("Item: 0x%lx", (long) item)); - DBUG_RETURN(item_list.push_back(item)); + DBUG_RETURN(item_list.push_back(item, thd->mem_root)); } @@ -3459,7 +3459,7 @@ bool st_select_lex::add_index_hint (THD *thd, char *str, uint length) return index_hints->push_front (new (thd->mem_root) Index_hint(current_index_hint_type, current_index_hint_clause, - str, length)); + str, length), thd->mem_root); } @@ -4135,7 +4135,7 @@ bool st_select_lex::save_leaf_tables(THD *thd) TABLE_LIST *table; while ((table= li++)) { - if (leaf_tables_exec.push_back(table)) + if (leaf_tables_exec.push_back(table, thd->mem_root)) return 1; table->tablenr_exec= table->get_tablenr(); table->map_exec= table->get_map(); diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 7a149a09c1b..da0b2db892a 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -2790,9 +2790,9 @@ public: void cleanup_after_one_table_open(); - bool push_context(Name_resolution_context *context) + bool push_context(Name_resolution_context *context, MEM_ROOT *mem_root) { - return context_stack.push_front(context); + return context_stack.push_front(context, mem_root); } void pop_context() diff --git a/sql/sql_list.h b/sql/sql_list.h index 1b672e120bd..e8fd5c66e0b 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -221,19 +221,22 @@ public: } return 1; } - inline bool push_front(void *info) + bool push_front_impl(list_node *node) { - list_node *node=new list_node(info,first); if (node) { if (last == &first) - last= &node->next; + last= &node->next; first=node; elements++; return 0; } return 1; } + inline bool push_front(void *info) + { return push_front_impl(new list_node(info, first)); } + inline bool push_front(void *info, MEM_ROOT *mem_root) + { return push_front_impl(new (mem_root) list_node(info,first)); } void remove(list_node **prev) { list_node *node=(*prev)->next; @@ -513,6 +516,8 @@ public: inline bool push_back(T *a, MEM_ROOT *mem_root) { return base_list::push_back(a, mem_root); } inline bool push_front(T *a) { return base_list::push_front(a); } + inline bool push_front(T *a, MEM_ROOT *mem_root) + { return base_list::push_front(a, mem_root); } inline T* head() {return (T*) base_list::head(); } inline T** head_ref() {return (T**) base_list::head_ref(); } inline T* pop() {return (T*) base_list::pop(); } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index a66e436ea9c..65f8372394b 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5698,7 +5698,7 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables) SELECT_LEX *param= lex->unit.global_parameters(); if (!param->explicit_limit) param->select_limit= - new Item_int((ulonglong) thd->variables.select_limit); + new (thd->mem_root) Item_int((ulonglong) thd->variables.select_limit); } if (!(res= open_and_lock_tables(thd, all_tables, TRUE, 0))) { @@ -5775,7 +5775,7 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables) } else { - if (!result && !(result= new select_send())) + if (!result && !(result= new (thd->mem_root) select_send())) return 1; /* purecov: inspected */ } query_cache_store_query(thd, all_tables); @@ -7630,7 +7630,7 @@ TABLE_LIST *st_select_lex::nest_last_join(THD *thd) void st_select_lex::add_joined_table(TABLE_LIST *table) { DBUG_ENTER("add_joined_table"); - join_list->push_front(table); + join_list->push_front(table, parent_lex->thd->mem_root); table->join_list= join_list; table->embedding= embedding; DBUG_VOID_RETURN; @@ -7808,7 +7808,7 @@ push_new_name_resolution_context(THD *thd, left_op->first_leaf_for_name_resolution(); on_context->last_name_resolution_table= right_op->last_leaf_for_name_resolution(); - return thd->lex->push_context(on_context); + return thd->lex->push_context(on_context, thd->mem_root); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 95778f00bad..4f2b8ebb824 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -172,7 +172,7 @@ static enum_nested_loop_state end_unique_update(JOIN *join, JOIN_TAB *join_tab, bool end_of_records); static int test_if_group_changed(List<Cached_item> &list); -static int join_read_const_table(JOIN_TAB *tab, POSITION *pos); +static int join_read_const_table(THD *thd, JOIN_TAB *tab, POSITION *pos); static int join_read_system(JOIN_TAB *tab); static int join_read_const(JOIN_TAB *tab); static int join_read_key(JOIN_TAB *tab); @@ -3297,7 +3297,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array, if (select_options & SELECT_DESCRIBE) free_join= 0; - if (!(join= new JOIN(thd, fields, select_options, result))) + if (!(join= new (thd->mem_root) JOIN(thd, fields, select_options, result))) DBUG_RETURN(TRUE); THD_STAGE_INFO(thd, stage_init); thd->lex->used_tables=0; @@ -3647,7 +3647,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list, int tmp; s->type=JT_SYSTEM; join->const_table_map|=s->table->map; - if ((tmp=join_read_const_table(s, p_pos))) + if ((tmp=join_read_const_table(join->thd, s, p_pos))) { if (tmp > 0) goto error; // Fatal error @@ -3730,7 +3730,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list, s->type=JT_SYSTEM; join->const_table_map|=table->map; set_position(join,const_count++,s,(KEYUSE*) 0); - if ((tmp= join_read_const_table(s, join->positions+const_count-1))) + if ((tmp= join_read_const_table(join->thd, s, join->positions+const_count-1))) { if (tmp > 0) goto error; // Fatal error @@ -3811,7 +3811,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list, if (create_ref_for_key(join, s, start_keyuse, FALSE, found_const_table_map)) goto error; - if ((tmp=join_read_const_table(s, + if ((tmp=join_read_const_table(join->thd, s, join->positions+const_count-1))) { if (tmp > 0) @@ -8474,13 +8474,13 @@ get_best_combination(JOIN *join) fix_semijoin_strategies_for_picked_join_order(join); JOIN_TAB_RANGE *root_range; - if (!(root_range= new JOIN_TAB_RANGE)) + if (!(root_range= new (thd->mem_root) JOIN_TAB_RANGE)) DBUG_RETURN(TRUE); root_range->start= join->join_tab; /* root_range->end will be set later */ join->join_tab_ranges.empty(); - if (join->join_tab_ranges.push_back(root_range)) + if (join->join_tab_ranges.push_back(root_range, thd->mem_root)) DBUG_RETURN(TRUE); JOIN_TAB *sjm_nest_end= NULL; @@ -12417,7 +12417,7 @@ finish: FALSE otherwise */ -static bool check_simple_equality(Item *left_item, Item *right_item, +static bool check_simple_equality(THD *thd, Item *left_item, Item *right_item, Item *item, COND_EQUAL *cond_equal) { Item *orig_left_item= left_item; @@ -12474,14 +12474,14 @@ static bool check_simple_equality(Item *left_item, Item *right_item, if (left_copyfl) { /* left_item_equal of an upper level contains left_item */ - left_item_equal= new Item_equal(left_item_equal); + left_item_equal= new (thd->mem_root) Item_equal(left_item_equal); left_item_equal->set_context_field(((Item_field*) left_item)); cond_equal->current_level.push_back(left_item_equal); } if (right_copyfl) { /* right_item_equal of an upper level contains right_item */ - right_item_equal= new Item_equal(right_item_equal); + right_item_equal= new (thd->mem_root) Item_equal(right_item_equal); right_item_equal->set_context_field(((Item_field*) right_item)); cond_equal->current_level.push_back(right_item_equal); } @@ -12494,7 +12494,7 @@ static bool check_simple_equality(Item *left_item, Item *right_item, else { /* Merge two multiple equalities forming a new one */ - left_item_equal->merge(right_item_equal); + left_item_equal->merge(thd, right_item_equal); /* Remove the merged multiple equality from the list */ List_iterator<Item_equal> li(cond_equal->current_level); while ((li++) != right_item_equal) ; @@ -12509,9 +12509,9 @@ static bool check_simple_equality(Item *left_item, Item *right_item, else { /* None of the fields was found in multiple equalities */ - Item_equal *item_equal= new Item_equal(orig_left_item, - orig_right_item, - FALSE); + Item_equal *item_equal= new (thd->mem_root) Item_equal(orig_left_item, + orig_right_item, + FALSE); item_equal->set_context_field((Item_field*)left_item); cond_equal->current_level.push_back(item_equal); } @@ -12552,7 +12552,8 @@ static bool check_simple_equality(Item *left_item, Item *right_item, if (!item) { Item_func_eq *eq_item; - if (!(eq_item= new Item_func_eq(orig_left_item, orig_right_item)) || + if (!(eq_item= new (thd->mem_root) Item_func_eq(orig_left_item, + orig_right_item)) || eq_item->set_cmp_func()) return FALSE; eq_item->quick_fix_field(); @@ -12567,7 +12568,7 @@ static bool check_simple_equality(Item *left_item, Item *right_item, field_item->field, ©fl); if (copyfl) { - item_equal= new Item_equal(item_equal); + item_equal= new (thd->mem_root) Item_equal(item_equal); cond_equal->current_level.push_back(item_equal); item_equal->set_context_field(field_item); } @@ -12578,13 +12579,14 @@ static bool check_simple_equality(Item *left_item, Item *right_item, already contains a constant and its value is not equal to the value of const_item. */ - item_equal->add_const(const_item, orig_field_item); + item_equal->add_const(thd, const_item, orig_field_item); } else { - item_equal= new Item_equal(const_item, orig_field_item, TRUE); + item_equal= new (thd->mem_root) Item_equal(const_item, orig_field_item, + TRUE); item_equal->set_context_field(field_item); - cond_equal->current_level.push_back(item_equal); + cond_equal->current_level.push_back(item_equal, thd->mem_root); } return TRUE; } @@ -12638,7 +12640,8 @@ static bool check_row_equality(THD *thd, Item *left_row, Item_row *right_row, } else { - is_converted= check_simple_equality(left_item, right_item, 0, cond_equal); + is_converted= check_simple_equality(thd, left_item, right_item, 0, + cond_equal); } if (!is_converted) @@ -12699,7 +12702,7 @@ bool Item_func_eq::check_equality(THD *thd, COND_EQUAL *cond_equal, (Item_row *) right_item, cond_equal, eq_list); } - return check_simple_equality(left_item, right_item, this, cond_equal); + return check_simple_equality(thd, left_item, right_item, this, cond_equal); } @@ -13061,8 +13064,8 @@ static COND *build_equal_items(JOIN *join, COND *cond, else if (cond->type() == Item::FUNC_ITEM && ((Item_cond*) cond)->functype() == Item_func::MULT_EQUAL_FUNC) { - cond_equal= new COND_EQUAL; - cond_equal->current_level.push_back((Item_equal *) cond); + cond_equal= new (thd->mem_root) COND_EQUAL; + cond_equal->current_level.push_back((Item_equal *) cond, thd->mem_root); } } if (cond_equal) @@ -13657,7 +13660,8 @@ static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab, @param const_key mark key parts as constant */ -static void update_const_equal_items(COND *cond, JOIN_TAB *tab, bool const_key) +static void update_const_equal_items(THD *thd, COND *cond, JOIN_TAB *tab, + bool const_key) { if (!(cond->used_tables() & tab->table->map)) return; @@ -13668,7 +13672,7 @@ static void update_const_equal_items(COND *cond, JOIN_TAB *tab, bool const_key) List_iterator_fast<Item> li(*cond_list); Item *item; while ((item= li++)) - update_const_equal_items(item, tab, + update_const_equal_items(thd, item, tab, (((Item_cond*) cond)->top_level() && ((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)); @@ -13678,7 +13682,7 @@ static void update_const_equal_items(COND *cond, JOIN_TAB *tab, bool const_key) { Item_equal *item_equal= (Item_equal *) cond; bool contained_const= item_equal->get_const() != NULL; - item_equal->update_const(); + item_equal->update_const(thd); if (!contained_const && item_equal->get_const()) { /* Update keys for range analysis */ @@ -14734,7 +14738,7 @@ void propagate_new_equalities(THD *thd, Item *cond, List_iterator<Item_equal> it(*new_equalities); while ((equal_item= it++)) { - equal_item->merge_into_list(cond_equalities, true, true); + equal_item->merge_into_list(thd, cond_equalities, true, true); } List_iterator<Item_equal> ei(*cond_equalities); while ((equal_item= ei++)) @@ -14768,7 +14772,7 @@ void propagate_new_equalities(THD *thd, Item *cond, equality->upper_levels= inherited; while ((equal_item= it++)) { - equality->merge_with_check(equal_item, true); + equality->merge_with_check(thd, equal_item, true); } if (equality->const_item() && !equality->val_int()) *is_simplifiable_cond= true; @@ -15088,7 +15092,7 @@ internal_remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value) while ((equality= it++)) { equality->upper_levels= cond_equal->upper_levels; - equality->merge_into_list(cond_equalities, false, false); + equality->merge_into_list(thd, cond_equalities, false, false); List_iterator_fast<Item_equal> ei(*cond_equalities); while ((equality= ei++)) { @@ -18324,7 +18328,7 @@ int safe_index_read(JOIN_TAB *tab) */ static int -join_read_const_table(JOIN_TAB *tab, POSITION *pos) +join_read_const_table(THD *thd, JOIN_TAB *tab, POSITION *pos) { int error; TABLE_LIST *tbl; @@ -18421,7 +18425,7 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos) List_iterator<TABLE_LIST> ti(join->select_lex->leaf_tables); /* Check appearance of new constant items in Item_equal objects */ if (join->conds) - update_const_equal_items(join->conds, tab, TRUE); + update_const_equal_items(thd, join->conds, tab, TRUE); while ((tbl= ti++)) { TABLE_LIST *embedded; @@ -18430,7 +18434,7 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos) { embedded= embedding; if (embedded->on_expr) - update_const_equal_items(embedded->on_expr, tab, TRUE); + update_const_equal_items(thd, embedded->on_expr, tab, TRUE); embedding= embedded->embedding; } while (embedding && @@ -20912,7 +20916,7 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order, for (ORDER *ord= join->order; ord; ord= ord->next) length++; if (!(join->sortorder= - make_unireg_sortorder(order, &length, join->sortorder))) + make_unireg_sortorder(thd, order, &length, join->sortorder))) goto err; /* purecov: inspected */ table->sort.io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE), @@ -21329,7 +21333,7 @@ err: } -SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length, +SORT_FIELD *make_unireg_sortorder(THD *thd, ORDER *order, uint *length, SORT_FIELD *sortorder) { uint count; @@ -21340,8 +21344,8 @@ SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length, for (ORDER *tmp = order; tmp; tmp=tmp->next) count++; if (!sortorder) - sortorder= (SORT_FIELD*) sql_alloc(sizeof(SORT_FIELD) * - (MY_MAX(count, *length) + 1)); + sortorder= (SORT_FIELD*) thd->alloc(sizeof(SORT_FIELD) * + (MY_MAX(count, *length) + 1)); pos= sort= sortorder; if (!pos) @@ -22239,7 +22243,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, DBUG_ENTER("setup_copy_fields"); if (param->field_count && - !(copy=param->copy_field= new Copy_field[param->field_count])) + !(copy=param->copy_field= new (thd->mem_root) Copy_field[param->field_count])) goto err2; param->copy_funcs.empty(); @@ -22335,7 +22339,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, else if (param->copy_funcs.push_back(pos)) goto err; } - res_all_fields.push_back(pos); + res_all_fields.push_back(pos, thd->mem_root); ref_pointer_array[((i < border)? all_fields.elements-i-1 : i-border)]= pos; } @@ -22591,7 +22595,7 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array, else item_field= item; - res_all_fields.push_back(item_field); + res_all_fields.push_back(item_field, thd->mem_root); ref_pointer_array[((i < border)? all_fields.elements-i-1 : i-border)]= item_field; } diff --git a/sql/sql_select.h b/sql/sql_select.h index 33468dcfdc7..66789ee7730 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1805,7 +1805,7 @@ int report_error(TABLE *table, int error); int safe_index_read(JOIN_TAB *tab); COND *remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value); int get_quick_record(SQL_SELECT *select); -SORT_FIELD * make_unireg_sortorder(ORDER *order, uint *length, +SORT_FIELD * make_unireg_sortorder(THD *thd, ORDER *order, uint *length, SORT_FIELD *sortorder); int setup_order(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, List<Item> &fields, List <Item> &all_fields, ORDER *order); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 1f967934e44..e349e5b30f2 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -9354,7 +9354,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, if (thd->lex->select_lex.setup_ref_array(thd, order_num) || setup_order(thd, thd->lex->select_lex.ref_pointer_array, &tables, fields, all_fields, order) || - !(sortorder= make_unireg_sortorder(order, &length, NULL)) || + !(sortorder= make_unireg_sortorder(thd, order, &length, NULL)) || (from->sort.found_records= filesort(thd, from, sortorder, length, NULL, HA_POS_ERROR, true, diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 830d26fd62e..890e72f3314 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -557,7 +557,7 @@ int mysql_update(THD *thd, Filesort_tracker *fs_tracker= thd->lex->explain->get_upd_del_plan()->filesort_tracker; - if (!(sortorder=make_unireg_sortorder(order, &length, NULL)) || + if (!(sortorder=make_unireg_sortorder(thd, order, &length, NULL)) || (table->sort.found_records= filesort(thd, table, sortorder, length, select, limit, true, diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 47a06ab73d5..72b8ef76ea3 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -8797,7 +8797,7 @@ bool_pri: } | bool_pri comp_op predicate %prec EQ { - $$= (*$2)(0)->create($1,$3); + $$= (*$2)(0)->create(thd, $1, $3); if ($$ == NULL) MYSQL_YYABORT; } @@ -11328,7 +11328,7 @@ order_clause: */ DBUG_ASSERT(sel->master_unit()->fake_select_lex); lex->current_select= sel->master_unit()->fake_select_lex; - lex->push_context(&lex->current_select->context); + lex->push_context(&lex->current_select->context, thd->mem_root); } } order_list @@ -13862,20 +13862,20 @@ field_ident: table_ident: ident { - $$= new Table_ident($1); + $$= new (thd->mem_root) Table_ident($1); if ($$ == NULL) MYSQL_YYABORT; } | ident '.' ident { - $$= new Table_ident(thd, $1,$3,0); + $$= new (thd->mem_root) Table_ident(thd, $1, $3, 0); if ($$ == NULL) MYSQL_YYABORT; } | '.' ident { /* For Delphi */ - $$= new Table_ident($2); + $$= new (thd->mem_root) Table_ident($2); if ($$ == NULL) MYSQL_YYABORT; } @@ -13884,13 +13884,13 @@ table_ident: table_ident_opt_wild: ident opt_wild { - $$= new Table_ident($1); + $$= new (thd->mem_root) Table_ident($1); if ($$ == NULL) MYSQL_YYABORT; } | ident '.' ident opt_wild { - $$= new Table_ident(thd, $1,$3,0); + $$= new (thd->mem_root) Table_ident(thd, $1, $3, 0); if ($$ == NULL) MYSQL_YYABORT; } @@ -13900,7 +13900,7 @@ table_ident_nodb: ident { LEX_STRING db={(char*) any_db,3}; - $$= new Table_ident(thd, db,$1,0); + $$= new (thd->mem_root) Table_ident(thd, db, $1, 0); if ($$ == NULL) MYSQL_YYABORT; } |