cleanup: add operator new(size_t, const THD*) for single-object allocations

Made as a part of MDEV-34309
This commit is contained in:
Nikita Malyavin 2024-11-23 15:05:48 +01:00
parent 8260743ada
commit 019f40218e
29 changed files with 84 additions and 67 deletions

View file

@ -6097,7 +6097,7 @@ bool Item_func_like::find_selective_predicates_list_processor(void *arg)
THD *thd= data->table->in_use;
COND_STATISTIC *stat;
Item *arg0;
if (!(stat= thd->alloc<COND_STATISTIC>(1)))
if (!(stat= new (thd) COND_STATISTIC()))
return TRUE;
stat->cond= this;
arg0= args[0]->real_item();

View file

@ -82,7 +82,7 @@ static inline bool test_if_sum_overflows_ull(ulonglong arg1, ulonglong arg2)
/**
Allocate memory for arguments using tmp_args or thd->alloc().
Allocate memory for arguments using tmp_args or new (thd) Item*[].
@retval false - success
@retval true - error (arg_count is set to 0 for conveniece)
*/
@ -2832,7 +2832,7 @@ bool Item_func_rand::fix_fields(THD *thd,Item **ref)
)
) || rand);
if (!rand &&
!(rand= thd->active_stmt_arena_to_use()->alloc<my_rnd_struct>(1)))
!(rand= new (thd->active_stmt_arena_to_use()) my_rnd_struct()))
return TRUE;
}
else

View file

@ -5398,7 +5398,7 @@ bool subselect_hash_sj_engine::make_semi_join_conds()
if (!(semi_join_conds= new (thd) Item_cond_and(thd)))
DBUG_RETURN(TRUE);
if (!(tmp_table_ref= thd->alloc<TABLE_LIST>(1)))
if (!(tmp_table_ref= new (thd) TABLE_LIST()))
DBUG_RETURN(TRUE);
table_name.str= tmp_table->alias.c_ptr();
@ -5466,7 +5466,7 @@ subselect_hash_sj_engine::make_unique_engine()
- here we initialize only those members that are used by
subselect_uniquesubquery_engine, so these objects are incomplete.
*/
if (!(tab= thd->alloc<JOIN_TAB>(1)))
if (!(tab= new (thd) JOIN_TAB()))
DBUG_RETURN(NULL);
tab->table= tmp_table;

View file

@ -613,7 +613,7 @@ void TABLE::add_splitting_info_for_key_field(KEY_FIELD *key_field)
}
if (!eq_item)
return;
KEY_FIELD *added_key_field= thd->alloc<KEY_FIELD>(1);
KEY_FIELD *added_key_field= new (thd) KEY_FIELD();
if (!added_key_field ||
spl_opt_info->added_key_fields.push_back(added_key_field,thd->mem_root))
return;
@ -1105,7 +1105,7 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(uint idx,
key_map spl_keys= table->keys_usable_for_splitting;
if (!(first_non_const_pos->key &&
spl_keys.is_set(first_non_const_pos->key->key)) ||
!(spl_plan= thd->alloc<SplM_plan_info>(1)) ||
!(spl_plan= new (thd) SplM_plan_info()) ||
!(spl_plan->best_positions= new (thd) POSITION[join->table_count]) ||
spl_opt_info->plan_cache.push_back(spl_plan))
{

View file

@ -5176,7 +5176,7 @@ int init_dups_weedout(JOIN *join, uint first_table, int first_fanout_table, uint
if (jt_rowid_offset) /* Temptable has at least one rowid */
{
size_t ntabs= last_tab - sjtabs;
if (!(sjtbl= thd->alloc<SJ_TMP_TABLE>(1)) ||
if (!(sjtbl= new (thd) SJ_TMP_TABLE()) ||
!(sjtbl->tabs= new (thd) SJ_TMP_TABLE::TAB[ntabs]))
DBUG_RETURN(TRUE); /* purecov: inspected */
memcpy(sjtbl->tabs, sjtabs, ntabs * sizeof(SJ_TMP_TABLE::TAB));
@ -5196,7 +5196,7 @@ int init_dups_weedout(JOIN *join, uint first_table, int first_fanout_table, uint
not depend on anything at all, ie this is
WHERE const IN (uncorrelated select)
*/
if (!(sjtbl= thd->alloc<SJ_TMP_TABLE>(1)))
if (!(sjtbl= new (thd) SJ_TMP_TABLE()))
DBUG_RETURN(TRUE); /* purecov: inspected */
sjtbl->tmp_table= NULL;
sjtbl->is_degenerate= TRUE;

View file

@ -1729,7 +1729,7 @@ void Dep_analysis_context::create_unique_pseudo_key_if_needed(
auto max_possible_elements= first_select->join->fields_list.elements;
void *buf;
MY_BITMAP *exposed_fields= (MY_BITMAP*)
current_thd->alloc<MY_BITMAP>(1);
new (current_thd) MY_BITMAP();
if (!(buf= current_thd->alloc(bitmap_buffer_size(max_possible_elements))) ||
my_bitmap_init(exposed_fields, (my_bitmap_map*)buf,
max_possible_elements))

View file

@ -2409,7 +2409,7 @@ bool sp_add_used_routine(Query_tables_list *prelocking_ctx, Query_arena *arena,
if (!my_hash_search(&prelocking_ctx->sroutines, key->ptr(), key->length()))
{
Sroutine_hash_entry *rn= arena->alloc<Sroutine_hash_entry>(1);
Sroutine_hash_entry *rn= new (arena) Sroutine_hash_entry();
if (unlikely(!rn)) // OOM. Error will be reported using fatal_error().
return FALSE;
MDL_REQUEST_INIT_BY_KEY(&rn->mdl_request, key, MDL_SHARED, MDL_TRANSACTION);

View file

@ -2573,7 +2573,7 @@ int
sp_head::push_backpatch(THD *thd, sp_instr *i, sp_label *lab,
List<bp_t> *list, backpatch_instr_type itype)
{
bp_t *bp= thd->alloc<bp_t>(1);
bp_t *bp= new (thd) bp_t();
if (!bp)
return 1;

View file

@ -12044,7 +12044,7 @@ bool sp_grant_privileges(THD *thd,
Lex_cstring_strlen sctx_user(sctx->priv_user);
Lex_cstring_strlen sctx_host(sctx->priv_host);
if (!(combo= thd->alloc<LEX_USER>(1)))
if (!(combo= new (thd) LEX_USER()))
DBUG_RETURN(TRUE);
mysql_mutex_lock(&acl_cache->lock);

View file

@ -49,10 +49,14 @@ public:
};
void* operator new[](size_t size, const THD *thd) noexcept;
void* operator new(size_t size, const THD *thd) noexcept;
void operator delete[](void *ptr, const THD *thd) noexcept;
void operator delete(void *ptr, const THD *thd) noexcept;
class Query_arena;
void* operator new[](size_t size, const Query_arena *thd) noexcept;
void* operator new(size_t size, const Query_arena *thd) noexcept;
void operator delete[](void *ptr, const Query_arena *thd) noexcept;
void operator delete(void *ptr, const Query_arena *thd) noexcept;
#endif /* SQL_ALLOC_INCLUDED */

View file

@ -3394,7 +3394,7 @@ request_backoff_action(enum_open_table_action action_arg,
{
DBUG_ASSERT(action_arg == OT_DISCOVER || action_arg == OT_REPAIR ||
action_arg == OT_ADD_HISTORY_PARTITION);
m_failed_table= m_thd->alloc<TABLE_LIST>(1);
m_failed_table= new (m_thd) TABLE_LIST();
if (m_failed_table == NULL)
return TRUE;
m_failed_table->init_one_table(&table->db, &table->table_name, &table->alias, TL_WRITE);
@ -5000,7 +5000,7 @@ add_internal_tables(THD *thd, Query_tables_list *prelocking_ctx,
continue;
}
TABLE_LIST *tl= thd->alloc<TABLE_LIST>(1);
TABLE_LIST *tl= new (thd) TABLE_LIST();
if (!tl)
DBUG_RETURN(TRUE);
tl->init_one_table_for_prelocking(&tables->db,
@ -5075,7 +5075,7 @@ prepare_fk_prelocking_list(THD *thd, Query_tables_list *prelocking_ctx,
&fk->foreign_db, &fk->foreign_table, lock_type))
continue;
TABLE_LIST *tl= thd->alloc<TABLE_LIST>(1);
TABLE_LIST *tl= new (thd) TABLE_LIST();
tl->init_one_table_for_prelocking(&fk->foreign_db, &fk->foreign_table,
NULL, lock_type, TABLE_LIST::PRELOCK_FK, table_list->belong_to_view,
op, &prelocking_ctx->query_tables_last, table_list->for_insert_data);

View file

@ -5133,7 +5133,7 @@ TABLE *open_purge_table(THD *thd, const char *db, size_t dblen,
/* Purge already hold the MDL for the table */
Open_table_context ot_ctx(thd, MYSQL_OPEN_HAS_MDL_LOCK);
TABLE_LIST *tl= thd->alloc<TABLE_LIST>(1);
TABLE_LIST *tl= new (thd) TABLE_LIST();
LEX_CSTRING db_name= {db, dblen };
LEX_CSTRING table_name= { tb, tblen };
@ -8848,13 +8848,30 @@ void* operator new[](size_t size, const THD *thd) noexcept
return alloc_root(thd->mem_root, size);
}
void* operator new(size_t size, const THD *thd) noexcept
{
return alloc_root(thd->mem_root, size);
}
void operator delete[](void *ptr, const THD *thd) noexcept
{}
void operator delete(void *ptr, const THD *thd) noexcept
{}
void* operator new[](size_t size, const Query_arena *thd) noexcept
{
return alloc_root(thd->mem_root, size);
}
void* operator new(size_t size, const Query_arena *thd) noexcept
{
return alloc_root(thd->mem_root, size);
}
void operator delete[](void *ptr, const Query_arena *thd) noexcept
{}
void operator delete(void *ptr, const Query_arena *thd) noexcept
{}

View file

@ -4862,10 +4862,7 @@ void st_select_lex::fix_prepare_information(THD *thd, Item **conds,
if (group_list.first)
{
if (!group_list_ptrs)
{
void *mem= active_arena->alloc<Group_list_ptrs>(1);
group_list_ptrs= new (mem) Group_list_ptrs(active_arena->mem_root);
}
group_list_ptrs= new (thd) Group_list_ptrs(active_arena->mem_root);
group_list_ptrs->reserve(group_list.elements);
for (ORDER *order= group_list.first; order; order= order->next)
{

View file

@ -2275,7 +2275,7 @@ dispatch_command_return dispatch_command(enum enum_server_command command, THD *
char buff[250];
uint buff_len= sizeof(buff);
if (!(current_global_status_var= thd->alloc<STATUS_VAR>(1)))
if (!(current_global_status_var= new (thd) STATUS_VAR()))
break;
general_log_print(thd, command, NullS);
status_var_increment(thd->status_var.com_stat[SQLCOM_SHOW_STATUS]);
@ -8002,7 +8002,7 @@ bool add_to_list(THD *thd, SQL_I_List<ORDER> &list, Item *item,bool asc)
{
ORDER *order;
DBUG_ENTER("add_to_list");
if (unlikely(!(order= thd->alloc<ORDER>(1))))
if (unlikely(!(order= new (thd) ORDER())))
DBUG_RETURN(1);
order->item_ptr= item;
order->item= &order->item_ptr;
@ -8128,12 +8128,11 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
}
bool has_alias_ptr= alias != nullptr;
void *memregion= thd->alloc(sizeof(TABLE_LIST));
TABLE_LIST *ptr= new (memregion) TABLE_LIST(thd, db, fqtn, alias_str,
has_alias_ptr, table, lock_type,
mdl_type, table_options,
info_schema, this,
index_hints_arg, option);
TABLE_LIST *ptr= new (thd) TABLE_LIST(thd, db, fqtn, alias_str,
has_alias_ptr, table, lock_type,
mdl_type, table_options,
info_schema, this,
index_hints_arg, option);
if (!ptr->table_name.str)
DBUG_RETURN(0); // EOM
@ -10005,7 +10004,7 @@ LEX_USER *create_default_definer(THD *thd, bool role)
{
LEX_USER *definer;
if (unlikely(!(definer= thd->alloc<LEX_USER>(1))))
if (unlikely(!(definer= new (thd) LEX_USER())))
return 0;
thd->get_definer(definer, role);
@ -10040,7 +10039,7 @@ LEX_USER *create_definer(THD *thd, LEX_CSTRING *user_name,
/* Create and initialize. */
if (unlikely(!(definer= thd->alloc<LEX_USER>(1))))
if (unlikely(!(definer= new (thd) LEX_USER())))
return 0;
definer->user= *user_name;

View file

@ -509,7 +509,7 @@ rename_tables(THD *thd, TABLE_LIST *table_list, DDL_LOG_STATE *ddl_log_state,
when only using temporary tables. We don't need the log as
all temporary tables will disappear anyway in a crash.
*/
TABLE_PAIR *pair= thd->alloc<TABLE_PAIR>(1);
TABLE_PAIR *pair= new (thd) TABLE_PAIR();
if (! pair || tmp_tables.push_front(pair, thd->mem_root))
goto revert_rename;
pair->from= ren_table;

View file

@ -3523,7 +3523,7 @@ setup_subq_exit:
if (select_lex->have_window_funcs())
{
if (!(join_tab= thd->alloc<JOIN_TAB>(1)))
if (!(join_tab= new (thd) JOIN_TAB()))
DBUG_RETURN(1);
#ifndef DBUG_OFF
dbug_join_tab_array_size= 1;
@ -13379,7 +13379,7 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
if (!key_parts)
DBUG_RETURN(TRUE);
/* This memory is allocated only once for the joined table join_tab */
if (!(keyinfo= thd->alloc<KEY>(1)) ||
if (!(keyinfo= new (thd) KEY()) ||
!(key_part_info = new (thd) KEY_PART_INFO[key_parts]))
DBUG_RETURN(TRUE);
keyinfo->usable_key_parts= keyinfo->user_defined_key_parts = key_parts;

View file

@ -11100,7 +11100,7 @@ TABLE_LIST *get_trigger_table(THD *thd, const sp_name *trg_name)
return NULL;
/* We need to reset statement table list to be PS/SP friendly. */
if (!(table= thd->alloc<TABLE_LIST>(1)))
if (!(table= new (thd) TABLE_LIST()))
return NULL;
db= thd->make_ident_opt_casedn(trg_name->m_db, lower_case_table_names);

View file

@ -18488,14 +18488,14 @@ xid:
text_string
{
MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE);
if (unlikely(!(Lex->xid= thd->alloc<XID>(1))))
if (unlikely(!(Lex->xid= new (thd) XID())))
MYSQL_YYABORT;
Lex->xid->set(1L, $1->ptr(), $1->length(), 0, 0);
}
| text_string ',' text_string
{
MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
if (unlikely(!(Lex->xid= thd->alloc<XID>(1))))
if (unlikely(!(Lex->xid= new (thd) XID())))
MYSQL_YYABORT;
Lex->xid->set(1L, $1->ptr(), $1->length(), $3->ptr(), $3->length());
}
@ -18505,7 +18505,7 @@ xid:
$3->length() <= MAXBQUALSIZE &&
$5 <= static_cast<ulong>(
std::numeric_limits<int32_t>::max()));
if (unlikely(!(Lex->xid= thd->alloc<XID>(1))))
if (unlikely(!(Lex->xid= new (thd) XID())))
MYSQL_YYABORT;
Lex->xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length());
}

View file

@ -3007,7 +3007,7 @@ private:
bool do_check(THD *thd, set_var *var) override
{
Charset_collation_map_st *map= thd->alloc<Charset_collation_map_st>(1);
Charset_collation_map_st *map= new (thd) Charset_collation_map_st();
if (!map || charset_collation_map_from_item(map, var->value,
thd->get_utf8_flag()))
return true;

View file

@ -911,7 +911,7 @@ static bool pack_header(THD *thd, uchar *forminfo,
*/
uint count= field->typelib()->count;
field->save_interval= field->typelib();
field->set_typelib(tmpint= thd->alloc<TYPELIB>(1));
field->set_typelib(tmpint= new (thd) TYPELIB());
*tmpint= *field->save_interval;
tmpint->type_names= new (thd) const char*[count + 1];
tmpint->type_lengths= new (thd) uint[count + 1];

View file

@ -1239,7 +1239,7 @@ int ha_maria::write_row(const uchar * buf)
int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt)
{
int error, fatal_error;
HA_CHECK *param= thd->alloc<HA_CHECK>(1);
HA_CHECK *param= new (thd) HA_CHECK();
MARIA_SHARE *share= file->s;
const char *old_proc_info;
TRN *old_trn= file->trn;
@ -1393,7 +1393,7 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt)
int ha_maria::analyze(THD *thd, HA_CHECK_OPT * check_opt)
{
int error= 0;
HA_CHECK *param= thd->alloc<HA_CHECK>(1);
HA_CHECK *param= new (thd) HA_CHECK();
MARIA_SHARE *share= file->s;
const char *old_proc_info;
@ -1432,7 +1432,7 @@ int ha_maria::analyze(THD *thd, HA_CHECK_OPT * check_opt)
int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt)
{
int error;
HA_CHECK *param= thd->alloc<HA_CHECK>(1);
HA_CHECK *param= new (thd) HA_CHECK();
ha_rows start_records;
const char *old_proc_info;
@ -1519,7 +1519,7 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt)
int ha_maria::zerofill(THD * thd, HA_CHECK_OPT *check_opt)
{
int error;
HA_CHECK *param= thd->alloc<HA_CHECK>(1);
HA_CHECK *param= new (thd) HA_CHECK();
TRN *old_trn;
MARIA_SHARE *share= file->s;
@ -1558,7 +1558,7 @@ int ha_maria::zerofill(THD * thd, HA_CHECK_OPT *check_opt)
int ha_maria::optimize(THD * thd, HA_CHECK_OPT *check_opt)
{
int error;
HA_CHECK *param= thd->alloc<HA_CHECK>(1);
HA_CHECK *param= new (thd) HA_CHECK();
if (!file || !param)
return HA_ADMIN_INTERNAL_ERROR;
@ -1921,7 +1921,7 @@ int ha_maria::preload_keys(THD * thd, HA_CHECK_OPT *check_opt)
errmsg= buf;
}
HA_CHECK *param= thd->alloc<HA_CHECK>(1);
HA_CHECK *param= new (thd) HA_CHECK();
if (!param)
return HA_ADMIN_INTERNAL_ERROR;
@ -2032,7 +2032,7 @@ int ha_maria::enable_indexes(key_map map, bool persist)
else
{
THD *thd= table->in_use;
HA_CHECK *param= thd->alloc<HA_CHECK>(1);
HA_CHECK *param= new (thd) HA_CHECK();
if (!param)
return HA_ADMIN_INTERNAL_ERROR;

View file

@ -1001,7 +1001,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
{
if (!file) return HA_ADMIN_INTERNAL_ERROR;
int error;
HA_CHECK *param= thd->alloc<HA_CHECK>(1);
HA_CHECK *param= new (thd) HA_CHECK();
MYISAM_SHARE* share = file->s;
const char *old_proc_info=thd->proc_info;
@ -1111,7 +1111,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt)
{
int error=0;
HA_CHECK *param= thd->alloc<HA_CHECK>(1);
HA_CHECK *param= new (thd) HA_CHECK();
MYISAM_SHARE* share = file->s;
if (!param)
@ -1150,7 +1150,7 @@ int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt)
int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
{
int error;
HA_CHECK *param= thd->alloc<HA_CHECK>(1);
HA_CHECK *param= new (thd) HA_CHECK();
ha_rows start_records;
if (!file || !param) return HA_ADMIN_INTERNAL_ERROR;
@ -1208,7 +1208,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt)
{
int error;
HA_CHECK *param= thd->alloc<HA_CHECK>(1);
HA_CHECK *param= new (thd) HA_CHECK();
if (!file || !param) return HA_ADMIN_INTERNAL_ERROR;
@ -1472,7 +1472,7 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt)
if (error != HA_ADMIN_OK)
{
/* Send error to user */
HA_CHECK *param= thd->alloc<HA_CHECK>(1);
HA_CHECK *param= new (thd) HA_CHECK();
if (!param)
return HA_ADMIN_INTERNAL_ERROR;
@ -1539,7 +1539,7 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt)
err:
{
HA_CHECK *param= thd->alloc<HA_CHECK>(1);
HA_CHECK *param= new (thd) HA_CHECK();
if (!param)
return HA_ADMIN_INTERNAL_ERROR;
myisamchk_init(param);
@ -1644,7 +1644,7 @@ int ha_myisam::enable_indexes(key_map map, bool persist)
{
THD *thd= table->in_use;
int was_error= thd->is_error();
HA_CHECK *param= thd->alloc<HA_CHECK>(1);
HA_CHECK *param= new (thd) HA_CHECK();
const char *save_proc_info=thd->proc_info;
if (!param)

View file

@ -462,7 +462,7 @@ int ha_myisammrg::add_children_list(void)
LEX_CSTRING db;
LEX_CSTRING table_name;
child_l= thd->alloc<TABLE_LIST>(1);
child_l= new (thd) TABLE_LIST();
db.str= (char*) thd->memdup(mrg_child_def->db.str, mrg_child_def->db.length+1);
db.length= mrg_child_def->db.length;
table_name.str= (char*) thd->memdup(mrg_child_def->name.str,

View file

@ -109,8 +109,8 @@ int table_global_status::rnd_init(bool scan)
If scan == true, then allocate a new context from mem_root and store in TLS.
If scan == false, then restore from TLS.
*/
m_context= current_thd->alloc<table_global_status_context>(1);
new (m_context) table_global_status_context(status_version, !scan);
m_context= new (current_thd) table_global_status_context(status_version,
!scan);
return 0;
}

View file

@ -97,8 +97,8 @@ int table_session_status::rnd_init(bool scan)
If scan == true, then allocate a new context from mem_root and store in TLS.
If scan == false, then restore from TLS.
*/
m_context= current_thd->alloc<table_session_status_context>(1);
new (m_context) table_session_status_context(status_version, !scan);
m_context= new (current_thd) table_session_status_context(status_version,
!scan);
return 0;
}

View file

@ -116,8 +116,8 @@ int table_status_by_account::rnd_init(bool scan)
allocate a new context from mem_root and store in TLS. If scan == false,
then restore from TLS.
*/
m_context= current_thd->alloc<table_status_by_account_context>(1);
new (m_context) table_status_by_account_context(status_version, !scan);
m_context= new (current_thd) table_status_by_account_context(status_version,
!scan);
return 0;
}

View file

@ -116,8 +116,8 @@ int table_status_by_host::rnd_init(bool scan)
allocate a new context from mem_root and store in TLS. If scan == false,
then restore from TLS.
*/
m_context= current_thd->alloc<table_status_by_host_context>(1);
new (m_context) table_status_by_host_context(status_version, !scan);
m_context= new (current_thd) table_status_by_host_context(status_version,
!scan);
return 0;
}

View file

@ -116,8 +116,8 @@ int table_status_by_thread::rnd_init(bool scan)
allocate a new context from mem_root and store in TLS. If scan == false,
then restore from TLS.
*/
m_context= current_thd->alloc<table_status_by_thread_context>(1);
new (m_context) table_status_by_thread_context(status_version, !scan);
m_context= new (current_thd) table_status_by_thread_context(status_version,
!scan);
return 0;
}

View file

@ -117,8 +117,8 @@ int table_status_by_user::rnd_init(bool scan)
allocate a new context from mem_root and store in TLS. If scan == false,
then restore from TLS.
*/
m_context= current_thd->alloc<table_status_by_user_context>(1);
new (m_context) table_status_by_user_context(status_version, !scan);
m_context= new (current_thd) table_status_by_user_context(status_version,
!scan);
return 0;
}