Added name to MEM_ROOT for esier debugging

This will make it easier to how memory allocation is done when debugging
with either DBUG or gdb.

Will especially help when debugging stored procedures

Main change is a name argument as second argument to init_alloc_root()
init_sql_alloc()

Other things:
- Added DBUG_ENTER/EXIT to some Virtual_tmp_table functions
This commit is contained in:
Monty 2018-02-02 11:08:36 +02:00
parent 1e5e3d562b
commit d69642dedd
60 changed files with 187 additions and 122 deletions

View file

@ -49,7 +49,7 @@ int completion_hash_init(HashTable *ht, uint nSize)
ht->initialized = 0;
return FAILURE;
}
init_alloc_root(&ht->mem_root, 8192, 0, MYF(0));
init_alloc_root(&ht->mem_root, "completion_hash", 8192, 0, MYF(0));
ht->pHashFunction = hashpjw;
ht->nTableSize = nSize;
ht->initialized = 1;

View file

@ -1207,7 +1207,7 @@ int main(int argc,char *argv[])
}
glob_buffer.realloc(512);
completion_hash_init(&ht, 128);
init_alloc_root(&hash_mem_root, 16384, 0, MYF(0));
init_alloc_root(&hash_mem_root, "hash", 16384, 0, MYF(0));
if (sql_connect(current_host,current_db,current_user,opt_password,
opt_silent))
{

View file

@ -4938,7 +4938,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
if (init_dumping(db, init_dumping_tables))
DBUG_RETURN(1);
init_alloc_root(&glob_root, 8192, 0, MYF(0));
init_alloc_root(&glob_root, "glob_root", 8192, 0, MYF(0));
if (!(dump_tables= pos= (char**) alloc_root(&glob_root,
tables * sizeof(char *))))
die(EX_EOM, "alloc_root failure.");

View file

@ -9117,7 +9117,7 @@ int main(int argc, char **argv)
#endif
init_dynamic_string(&ds_res, "", 2048, 2048);
init_alloc_root(&require_file_root, 1024, 1024, MYF(0));
init_alloc_root(&require_file_root, "require_file", 1024, 1024, MYF(0));
parse_args(argc, argv);

View file

@ -52,6 +52,7 @@ typedef struct st_mem_root
unsigned int first_block_usage;
void (*error_handler)(void);
const char *name;
} MEM_ROOT;
#ifdef __cplusplus

View file

@ -894,8 +894,9 @@ extern void my_free_lock(void *ptr);
#define alloc_root_inited(A) ((A)->min_malloc != 0)
#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8)
#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0)
extern void init_alloc_root(MEM_ROOT *mem_root, size_t block_size,
size_t pre_alloc_size, myf my_flags);
extern void init_alloc_root(MEM_ROOT *mem_root, const char *name,
size_t block_size, size_t pre_alloc_size,
myf my_flags);
extern void *alloc_root(MEM_ROOT *mem_root, size_t Size);
extern void *multi_alloc_root(MEM_ROOT *mem_root, ...);
extern void free_root(MEM_ROOT *root, myf MyFLAGS);

View file

@ -240,6 +240,7 @@ typedef struct st_mem_root
unsigned int block_num;
unsigned int first_block_usage;
void (*error_handler)(void);
const char *name;
} MEM_ROOT;
typedef struct st_typelib {
unsigned int count;

View file

@ -418,7 +418,7 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src)
if (!data)
goto err;
init_alloc_root(&data->alloc, 8192,0,MYF(0));
init_alloc_root(&data->alloc, "embedded_query_cache", 8192,0,MYF(0));
f_alloc= &data->alloc;
data->fields= src->load_int();

View file

@ -655,7 +655,7 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag)
thd->mysql= mysql;
mysql->server_version= server_version;
mysql->client_flag= client_flag;
init_alloc_root(&mysql->field_alloc, 8192, 0, MYF(0));
init_alloc_root(&mysql->field_alloc, "fields", 8192, 0, MYF(0));
}
/**
@ -972,7 +972,7 @@ int Protocol::begin_dataset()
return 1;
alloc= &data->alloc;
/* Assume rowlength < 8192 */
init_alloc_root(alloc, 8192, 0, MYF(0));
init_alloc_root(alloc, "protocol", 8192, 0, MYF(0));
alloc->min_malloc= sizeof(MYSQL_ROWS);
return 0;
}

View file

@ -1533,8 +1533,9 @@ mysql_stmt_init(MYSQL *mysql)
DBUG_RETURN(NULL);
}
init_alloc_root(&stmt->mem_root, 2048,2048, MYF(MY_THREAD_SPECIFIC));
init_alloc_root(&stmt->result.alloc, 4096, 4096, MYF(MY_THREAD_SPECIFIC));
init_alloc_root(&stmt->mem_root, "stmt", 2048,2048, MYF(MY_THREAD_SPECIFIC));
init_alloc_root(&stmt->result.alloc, "result", 4096, 4096,
MYF(MY_THREAD_SPECIFIC));
stmt->result.alloc.min_malloc= sizeof(MYSQL_ROWS);
mysql->stmts= list_add(mysql->stmts, &stmt->list);
stmt->list.data= stmt;
@ -1545,7 +1546,7 @@ mysql_stmt_init(MYSQL *mysql)
strmov(stmt->sqlstate, not_error_sqlstate);
/* The rest of statement members was bzeroed inside malloc */
init_alloc_root(&stmt->extension->fields_mem_root, 2048, 0,
init_alloc_root(&stmt->extension->fields_mem_root, "extension", 2048, 0,
MYF(MY_THREAD_SPECIFIC));
DBUG_RETURN(stmt);

View file

@ -32,6 +32,7 @@
SYNOPSIS
init_alloc_root()
mem_root - memory root to initialize
name - name of memroot (for debugging)
block_size - size of chunks (blocks) used for memory allocation
(It is external size of chunk i.e. it should include
memory required for internal structures, thus it
@ -51,13 +52,13 @@
Because of this, we store in MY_THREAD_SPECIFIC as bit 1 in block_size
*/
void init_alloc_root(MEM_ROOT *mem_root, size_t block_size,
void init_alloc_root(MEM_ROOT *mem_root, const char *name, size_t block_size,
size_t pre_alloc_size __attribute__((unused)),
myf my_flags)
{
DBUG_ENTER("init_alloc_root");
DBUG_PRINT("enter",("root: %p prealloc: %zu", mem_root,
pre_alloc_size));
DBUG_PRINT("enter",("root: %p name: %s prealloc: %zu", mem_root,
name, pre_alloc_size));
mem_root->free= mem_root->used= mem_root->pre_alloc= 0;
mem_root->min_malloc= 32;
@ -69,6 +70,7 @@ void init_alloc_root(MEM_ROOT *mem_root, size_t block_size,
mem_root->block_num= 4; /* We shift this with >>2 */
mem_root->first_block_usage= 0;
mem_root->total_alloc= 0;
mem_root->name= name;
#if !(defined(HAVE_valgrind) && defined(EXTRA_DEBUG))
if (pre_alloc_size)
@ -172,7 +174,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
#if defined(HAVE_valgrind) && defined(EXTRA_DEBUG)
reg1 USED_MEM *next;
DBUG_ENTER("alloc_root");
DBUG_PRINT("enter",("root: %p", mem_root));
DBUG_PRINT("enter",("root: %p name: %s", mem_root, mem_root->name));
DBUG_ASSERT(alloc_root_inited(mem_root));
@ -207,7 +209,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
reg1 USED_MEM *next= 0;
reg2 USED_MEM **prev;
DBUG_ENTER("alloc_root");
DBUG_PRINT("enter",("root: %p", mem_root));
DBUG_PRINT("enter",("root: %p name: %s", mem_root, mem_root->name));
DBUG_ASSERT(alloc_root_inited(mem_root));
DBUG_EXECUTE_IF("simulate_out_of_memory",
@ -298,6 +300,10 @@ void *multi_alloc_root(MEM_ROOT *root, ...)
char **ptr, *start, *res;
size_t tot_length, length;
DBUG_ENTER("multi_alloc_root");
/*
We don't need to do DBUG_PRINT here as it will be done when alloc_root
is called
*/
va_start(args, root);
tot_length= 0;
@ -382,7 +388,8 @@ void free_root(MEM_ROOT *root, myf MyFlags)
{
reg1 USED_MEM *next,*old;
DBUG_ENTER("free_root");
DBUG_PRINT("enter",("root: %p flags: %u", root, (uint) MyFlags));
DBUG_PRINT("enter",("root: %p name: %s flags: %u", root, root->name,
(uint) MyFlags));
#if !(defined(HAVE_valgrind) && defined(EXTRA_DEBUG))
/*

View file

@ -518,7 +518,7 @@ int my_load_defaults(const char *conf_file, const char **groups,
uint args_sep= my_getopt_use_args_separator ? 1 : 0;
DBUG_ENTER("load_defaults");
init_alloc_root(&alloc, 512, 0, MYF(0));
init_alloc_root(&alloc, "my_load_defaults", 512, 0, MYF(0));
if ((dirs= init_default_directories(&alloc)) == NULL)
goto err;
/*
@ -1041,7 +1041,7 @@ void my_print_default_files(const char *conf_file)
{
const char **dirs;
MEM_ROOT alloc;
init_alloc_root(&alloc, 512, 0, MYF(0));
init_alloc_root(&alloc, "my_print_defaults", 512, 0, MYF(0));
if ((dirs= init_default_directories(&alloc)) == NULL)
{

View file

@ -136,7 +136,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
MYF(MyFlags)))
goto error;
init_alloc_root(&dirh->root, NAMES_START_SIZE, NAMES_START_SIZE,
init_alloc_root(&dirh->root, "dir", NAMES_START_SIZE, NAMES_START_SIZE,
MYF(MyFlags));
dp= (struct dirent*) dirent_tmp;
@ -245,7 +245,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
MYF(MyFlags)))
goto error;
init_alloc_root(&dirh->root, NAMES_START_SIZE, NAMES_START_SIZE,
init_alloc_root(&dirh->root, "dir", NAMES_START_SIZE, NAMES_START_SIZE,
MYF(MyFlags));
if ((handle=_findfirst(tmp_path,&find)) == -1L)

View file

@ -130,7 +130,8 @@ void init_tree(TREE *tree, size_t default_alloc_size, size_t memory_limit,
}
if (!(tree->with_delete= MY_TEST(my_flags & MY_TREE_WITH_DELETE)))
{
init_alloc_root(&tree->mem_root, default_alloc_size, 0, MYF(my_flags));
init_alloc_root(&tree->mem_root, "tree", default_alloc_size, 0,
MYF(my_flags));
tree->mem_root.min_malloc= sizeof(TREE_ELEMENT)+tree->size_of_element;
}
DBUG_VOID_RETURN;

View file

@ -740,7 +740,7 @@ void free_old_query(MYSQL *mysql)
if (mysql->fields)
free_root(&mysql->field_alloc,MYF(0));
/* Assume rowlength < 8192 */
init_alloc_root(&mysql->field_alloc, 8192, 0,
init_alloc_root(&mysql->field_alloc, "fields", 8192, 0,
MYF(mysql->options.use_thread_specific_memory ?
MY_THREAD_SPECIFIC : 0));
mysql->fields= 0;
@ -1464,7 +1464,7 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
DBUG_RETURN(0);
}
/* Assume rowlength < 8192 */
init_alloc_root(&result->alloc, 8192, 0,
init_alloc_root(&result->alloc, "result", 8192, 0,
MYF(mysql->options.use_thread_specific_memory ?
MY_THREAD_SPECIFIC : 0));
result->alloc.min_malloc=sizeof(MYSQL_ROWS);

View file

@ -251,7 +251,7 @@ int mysql_client_plugin_init()
bzero(&mysql, sizeof(mysql)); /* dummy mysql for set_mysql_extended_error */
mysql_mutex_init(0, &LOCK_load_client_plugin, MY_MUTEX_INIT_SLOW);
init_alloc_root(&mem_root, 128, 128, MYF(0));
init_alloc_root(&mem_root, "client_plugin", 128, 128, MYF(0));
bzero(&plugin_list, sizeof(plugin_list));

View file

@ -209,7 +209,7 @@ Event_basic::Event_basic()
{
DBUG_ENTER("Event_basic::Event_basic");
/* init memory root */
init_sql_alloc(&mem_root, 256, 512, MYF(0));
init_sql_alloc(&mem_root, "Event_basic", 256, 512, MYF(0));
dbname.str= name.str= NULL;
dbname.length= name.length= 0;
time_zone= NULL;

View file

@ -249,7 +249,7 @@ ha_partition::ha_partition(handlerton *hton, TABLE_SHARE *share)
:handler(hton, share)
{
DBUG_ENTER("ha_partition::ha_partition(table)");
init_alloc_root(&m_mem_root, 512, 512, MYF(0));
init_alloc_root(&m_mem_root, "ha_partition", 512, 512, MYF(0));
init_handler_variables();
DBUG_VOID_RETURN;
}
@ -271,7 +271,7 @@ ha_partition::ha_partition(handlerton *hton, partition_info *part_info)
{
DBUG_ENTER("ha_partition::ha_partition(part_info)");
DBUG_ASSERT(part_info);
init_alloc_root(&m_mem_root, 512, 512, MYF(0));
init_alloc_root(&m_mem_root, "ha_partition", 512, 512, MYF(0));
init_handler_variables();
m_part_info= part_info;
m_create_handler= TRUE;
@ -298,7 +298,7 @@ ha_partition::ha_partition(handlerton *hton, TABLE_SHARE *share,
:handler(hton, share)
{
DBUG_ENTER("ha_partition::ha_partition(clone)");
init_alloc_root(&m_mem_root, 512, 512, MYF(0));
init_alloc_root(&m_mem_root, "ha_partition", 512, 512, MYF(0));
init_handler_variables();
m_part_info= part_info_arg;
m_create_handler= TRUE;

View file

@ -10012,7 +10012,8 @@ int TC_LOG_BINLOG::recover(LOG_INFO *linfo, const char *last_log_name,
goto err1;
if (do_xa)
init_alloc_root(&mem_root, TC_LOG_PAGE_SIZE, TC_LOG_PAGE_SIZE, MYF(0));
init_alloc_root(&mem_root, "TC_LOG_BINLOG", TC_LOG_PAGE_SIZE,
TC_LOG_PAGE_SIZE, MYF(0));
fdle->flags&= ~LOG_EVENT_BINLOG_IN_USE_F; // abort on the first error

View file

@ -1347,7 +1347,7 @@ private:
void Buffered_logs::init()
{
init_alloc_root(&m_root, 1024, 0, MYF(0));
init_alloc_root(&m_root, "Buffered_logs", 1024, 0, MYF(0));
}
void Buffered_logs::cleanup()
@ -8614,7 +8614,7 @@ static int option_cmp(my_option *a, my_option *b)
static void print_help()
{
MEM_ROOT mem_root;
init_alloc_root(&mem_root, 4096, 4096, MYF(0));
init_alloc_root(&mem_root, "help", 4096, 4096, MYF(0));
pop_dynamic(&all_options);
add_many_options(&all_options, pfs_early_options,

View file

@ -1253,7 +1253,8 @@ QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr,
if (!no_alloc && !parent_alloc)
{
// Allocates everything through the internal memroot
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0,
init_sql_alloc(&alloc, "QUICK_RANGE_SELECT",
thd->variables.range_alloc_block_size, 0,
MYF(MY_THREAD_SPECIFIC));
thd->mem_root= &alloc;
}
@ -1350,7 +1351,8 @@ QUICK_INDEX_SORT_SELECT::QUICK_INDEX_SORT_SELECT(THD *thd_param,
index= MAX_KEY;
head= table;
bzero(&read_record, sizeof(read_record));
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0,
init_sql_alloc(&alloc, "QUICK_INDEX_SORT_SELECT",
thd->variables.range_alloc_block_size, 0,
MYF(MY_THREAD_SPECIFIC));
DBUG_VOID_RETURN;
}
@ -1421,7 +1423,8 @@ QUICK_ROR_INTERSECT_SELECT::QUICK_ROR_INTERSECT_SELECT(THD *thd_param,
head= table;
record= head->record[0];
if (!parent_alloc)
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0,
init_sql_alloc(&alloc, "QUICK_ROR_INTERSECT_SELECT",
thd->variables.range_alloc_block_size, 0,
MYF(MY_THREAD_SPECIFIC));
else
bzero(&alloc, sizeof(MEM_ROOT));
@ -1697,7 +1700,8 @@ QUICK_ROR_UNION_SELECT::QUICK_ROR_UNION_SELECT(THD *thd_param,
head= table;
rowid_length= table->file->ref_length;
record= head->record[0];
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0,
init_sql_alloc(&alloc, "QUICK_ROR_UNION_SELECT",
thd->variables.range_alloc_block_size, 0,
MYF(MY_THREAD_SPECIFIC));
thd_param->mem_root= &alloc;
}
@ -2452,7 +2456,8 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
param.possible_keys.clear_all();
thd->no_errors=1; // Don't warn about NULL
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0,
init_sql_alloc(&alloc, "test_quick_select",
thd->variables.range_alloc_block_size, 0,
MYF(MY_THREAD_SPECIFIC));
if (!(param.key_parts=
(KEY_PART*) alloc_root(&alloc,
@ -3026,7 +3031,8 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond)
SEL_TREE *tree;
double rows;
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0,
init_sql_alloc(&alloc, "calculate_cond_selectivity_for_table",
thd->variables.range_alloc_block_size, 0,
MYF(MY_THREAD_SPECIFIC));
param.thd= thd;
param.mem_root= &alloc;
@ -3443,7 +3449,8 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond)
my_bitmap_map *old_sets[2];
prune_param.part_info= part_info;
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0,
init_sql_alloc(&alloc, "prune_partitions",
thd->variables.range_alloc_block_size, 0,
MYF(MY_THREAD_SPECIFIC));
range_par->mem_root= &alloc;
range_par->old_root= thd->mem_root;
@ -13611,7 +13618,8 @@ QUICK_GROUP_MIN_MAX_SELECT(TABLE *table, JOIN *join_arg, bool have_min_arg,
DBUG_ASSERT(!parent_alloc);
if (!parent_alloc)
{
init_sql_alloc(&alloc, join->thd->variables.range_alloc_block_size, 0,
init_sql_alloc(&alloc, "QUICK_GROUP_MIN_MAX_SELECT",
join->thd->variables.range_alloc_block_size, 0,
MYF(MY_THREAD_SPECIFIC));
join->thd->mem_root= &alloc;
}

View file

@ -4118,7 +4118,8 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
using_unique_constraint= TRUE;
/* STEP 3: Allocate memory for temptable description */
init_sql_alloc(&own_root, TABLE_ALLOC_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC));
init_sql_alloc(&own_root, "SJ_TMP_TABLE",
TABLE_ALLOC_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC));
if (!multi_alloc_root(&own_root,
&table, sizeof(*table),
&share, sizeof(*share),

View file

@ -121,7 +121,7 @@ public:
inited= FALSE;
if (my_rwlock_init(&lock, NULL))
return;
init_sql_alloc(&memroot, 1024, 0, MYF(0));
init_sql_alloc(&memroot, "Delegate", 1024, 0, MYF(0));
inited= TRUE;
}
~Delegate()

View file

@ -46,7 +46,8 @@ table_mapping::table_mapping()
offsetof(entry,table_id),sizeof(ulong),
0,0,0);
/* We don't preallocate any block, this is consistent with m_free=0 above */
init_alloc_root(&m_mem_root, TABLE_ID_HASH_SIZE*sizeof(entry), 0, MYF(0));
init_alloc_root(&m_mem_root, "table_mapping",
TABLE_ID_HASH_SIZE*sizeof(entry), 0, MYF(0));
DBUG_VOID_RETURN;
}

View file

@ -471,7 +471,8 @@ sp_head::operator new(size_t size) throw()
MEM_ROOT own_root;
sp_head *sp;
init_sql_alloc(&own_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC, MYF(0));
init_sql_alloc(&own_root, "sp_head",
MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC, MYF(0));
sp= (sp_head *) alloc_root(&own_root, size);
if (sp == NULL)
DBUG_RETURN(NULL);
@ -993,7 +994,8 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
thd->select_number+= m_select_number;
/* init per-instruction memroot */
init_sql_alloc(&execute_mem_root, MEM_ROOT_BLOCK_SIZE, 0, MYF(0));
init_sql_alloc(&execute_mem_root, "per_instruction_memroot",
MEM_ROOT_BLOCK_SIZE, 0, MYF(0));
DBUG_ASSERT(!(m_flags & IS_INVOKED));
m_flags|= IS_INVOKED;
@ -1507,7 +1509,6 @@ sp_head::execute_trigger(THD *thd,
MEM_ROOT call_mem_root;
Query_arena call_arena(&call_mem_root, Query_arena::STMT_INITIALIZED_FOR_SP);
Query_arena backup_arena;
DBUG_ENTER("sp_head::execute_trigger");
DBUG_PRINT("info", ("trigger %s", m_name.str));
@ -1563,7 +1564,8 @@ sp_head::execute_trigger(THD *thd,
TODO: we should create sp_rcontext once per command and reuse it
on subsequent executions of a trigger.
*/
init_sql_alloc(&call_mem_root, MEM_ROOT_BLOCK_SIZE, 0, MYF(0));
init_sql_alloc(&call_mem_root, "execute_trigger", MEM_ROOT_BLOCK_SIZE, 0,
MYF(0));
thd->set_n_backup_active_arena(&call_arena, &backup_arena);
Row_definition_list defs;
@ -1676,7 +1678,8 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
TODO: we should create sp_rcontext once per command and reuse
it on subsequent executions of a function/trigger.
*/
init_sql_alloc(&call_mem_root, MEM_ROOT_BLOCK_SIZE, 0, MYF(0));
init_sql_alloc(&call_mem_root, "execute_function", MEM_ROOT_BLOCK_SIZE, 0,
MYF(0));
thd->set_n_backup_active_arena(&call_arena, &backup_arena);
if (!(nctx= rcontext_create(thd, return_value_fld, argp, argcount)))

View file

@ -1827,7 +1827,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
grant_version++; /* Privileges updated */
const Host_table& host_table= tables.host_table();
init_sql_alloc(&acl_memroot, ACL_ALLOC_BLOCK_SIZE, 0, MYF(0));
init_sql_alloc(&acl_memroot, "ACL", ACL_ALLOC_BLOCK_SIZE, 0, MYF(0));
if (host_table.table_exists()) // "host" table may not exist (e.g. in MySQL 5.6.7+)
{
if (host_table.init_read_record(&read_record_info, thd))
@ -2243,7 +2243,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
DBUG_RETURN(TRUE);
MEM_ROOT temp_root;
init_alloc_root(&temp_root, ACL_ALLOC_BLOCK_SIZE, 0, MYF(0));
init_alloc_root(&temp_root, "ACL_tmp", ACL_ALLOC_BLOCK_SIZE, 0, MYF(0));
while (!(read_record_info.read_record(&read_record_info)))
{
char *hostname= safe_str(get_field(&temp_root, roles_mapping_table.host()));
@ -7310,7 +7310,7 @@ static bool grant_load(THD *thd,
0,0,0, (my_hash_get_key) get_grant_table, 0,0);
(void) my_hash_init(&func_priv_hash, &my_charset_utf8_bin,
0,0,0, (my_hash_get_key) get_grant_table, 0,0);
init_sql_alloc(&grant_memroot, ACL_ALLOC_BLOCK_SIZE, 0, MYF(0));
init_sql_alloc(&grant_memroot, "GRANT", ACL_ALLOC_BLOCK_SIZE, 0, MYF(0));
t_table= tables_priv.table();
c_table= columns_priv.table();

View file

@ -782,8 +782,8 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
the destructor works OK in case of an error. The main_mem_root
will be re-initialized in init_for_queries().
*/
init_sql_alloc(&main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0,
MYF(MY_THREAD_SPECIFIC));
init_sql_alloc(&main_mem_root, "THD::main_mem_root",
ALLOC_ROOT_MIN_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC));
stmt_arena= this;
thread_stack= 0;

View file

@ -1791,7 +1791,8 @@ public:
m_reopen_array(NULL),
m_locked_tables_count(0)
{
init_sql_alloc(&m_locked_tables_root, MEM_ROOT_BLOCK_SIZE, 0,
init_sql_alloc(&m_locked_tables_root, "Locked_tables_list",
MEM_ROOT_BLOCK_SIZE, 0,
MYF(MY_THREAD_SPECIFIC));
}
void unlock_locked_tables(THD *thd);
@ -2540,7 +2541,8 @@ public:
{
bzero((char*)this, sizeof(*this));
xid_state.xid.null();
init_sql_alloc(&mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0,
init_sql_alloc(&mem_root, "THD::transactions",
ALLOC_ROOT_MIN_BLOCK_SIZE, 0,
MYF(MY_THREAD_SPECIFIC));
}
} transaction;

View file

@ -506,7 +506,7 @@ void Warning_info::init()
{
/* Initialize sub structures */
DBUG_ASSERT(initialized == 0);
init_sql_alloc(&m_warn_root, WARN_ALLOC_BLOCK_SIZE,
init_sql_alloc(&m_warn_root, "Warning_info", WARN_ALLOC_BLOCK_SIZE,
WARN_ALLOC_PREALLOC_SIZE, MYF(MY_THREAD_SPECIFIC));
initialized= 1;
}

View file

@ -324,7 +324,8 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen)
/* copy data to sql_handler */
if (!(sql_handler= new SQL_HANDLER(thd)))
goto err;
init_alloc_root(&sql_handler->mem_root, 1024, 0, MYF(MY_THREAD_SPECIFIC));
init_alloc_root(&sql_handler->mem_root, "sql_handler", 1024, 0,
MYF(MY_THREAD_SPECIFIC));
sql_handler->db.length= strlen(tables->db);
sql_handler->table_name.length= strlen(tables->table_name);

View file

@ -4810,8 +4810,8 @@ bool LEX::set_arena_for_set_stmt(Query_arena *backup)
mem_root_for_set_stmt= new MEM_ROOT();
if (!(mem_root_for_set_stmt))
DBUG_RETURN(1);
init_sql_alloc(mem_root_for_set_stmt, ALLOC_ROOT_SET, ALLOC_ROOT_SET,
MYF(MY_THREAD_SPECIFIC));
init_sql_alloc(mem_root_for_set_stmt, "set_stmt",
ALLOC_ROOT_SET, ALLOC_ROOT_SET, MYF(MY_THREAD_SPECIFIC));
}
if (!(arena_for_set_stmt= new(mem_root_for_set_stmt)
Query_arena_memroot(mem_root_for_set_stmt,

View file

@ -1152,7 +1152,7 @@ static bool plugin_add(MEM_ROOT *tmp_root,
goto err;
if (my_hash_insert(&plugin_hash[plugin->type], (uchar*)tmp_plugin_ptr))
tmp_plugin_ptr->state= PLUGIN_IS_FREED;
init_alloc_root(&tmp_plugin_ptr->mem_root, 4096, 4096, MYF(0));
init_alloc_root(&tmp_plugin_ptr->mem_root, "plugin", 4096, 4096, MYF(0));
if (name->str)
DBUG_RETURN(FALSE); // all done
@ -1542,9 +1542,9 @@ int plugin_init(int *argc, char **argv, int flags)
dlopen_count =0;
init_alloc_root(&plugin_mem_root, 4096, 4096, MYF(0));
init_alloc_root(&plugin_vars_mem_root, 4096, 4096, MYF(0));
init_alloc_root(&tmp_root, 4096, 4096, MYF(0));
init_alloc_root(&plugin_mem_root, "plugin", 4096, 4096, MYF(0));
init_alloc_root(&plugin_vars_mem_root, "plugin_vars", 4096, 4096, MYF(0));
init_alloc_root(&tmp_root, "plugin_tmp", 4096, 4096, MYF(0));
if (my_hash_init(&bookmark_hash, &my_charset_bin, 32, 0, 0,
get_bookmark_hash_key, NULL, HASH_UNIQUE))

View file

@ -3699,8 +3699,10 @@ Prepared_statement::Prepared_statement(THD *thd_arg)
read_types(0),
m_sql_mode(thd->variables.sql_mode)
{
init_sql_alloc(&main_mem_root, thd_arg->variables.query_alloc_block_size,
thd_arg->variables.query_prealloc_size, MYF(MY_THREAD_SPECIFIC));
init_sql_alloc(&main_mem_root, "Prepared_statement",
thd_arg->variables.query_alloc_block_size,
thd_arg->variables.query_prealloc_size,
MYF(MY_THREAD_SPECIFIC));
*last_error= '\0';
}
@ -5362,7 +5364,8 @@ bool Protocol_local::send_result_set_metadata(List<Item> *columns, uint)
{
DBUG_ASSERT(m_rset == 0 && !alloc_root_inited(&m_rset_root));
init_sql_alloc(&m_rset_root, MEM_ROOT_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC));
init_sql_alloc(&m_rset_root, "send_result_set_metadata",
MEM_ROOT_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC));
if (! (m_rset= new (&m_rset_root) List<Ed_row>))
return TRUE;

View file

@ -1196,8 +1196,9 @@ gtid_find_binlog_file(slave_connection_state *state, char *out_name,
const char *errormsg= NULL;
char buf[FN_REFLEN];
init_alloc_root(&memroot, 10*(FN_REFLEN+sizeof(binlog_file_entry)), 0,
MYF(MY_THREAD_SPECIFIC));
init_alloc_root(&memroot, "gtid_find_binlog_file",
10*(FN_REFLEN+sizeof(binlog_file_entry)),
0, MYF(MY_THREAD_SPECIFIC));
if (!(list= get_binlog_list(&memroot)))
{
errormsg= "Out of memory while looking for GTID position in binlog";

View file

@ -16890,7 +16890,8 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
if (param->precomputed_group_by)
copy_func_count+= param->sum_func_count;
init_sql_alloc(&own_root, TABLE_ALLOC_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC));
init_sql_alloc(&own_root, "tmp_table", TABLE_ALLOC_BLOCK_SIZE, 0,
MYF(MY_THREAD_SPECIFIC));
if (!multi_alloc_root(&own_root,
&table, sizeof(*table),
@ -17641,18 +17642,19 @@ bool Virtual_tmp_table::init(uint field_count)
{
uint *blob_field;
uchar *bitmaps;
DBUG_ENTER("Virtual_tmp_table::init");
if (!multi_alloc_root(in_use->mem_root,
&s, sizeof(*s),
&field, (field_count + 1) * sizeof(Field*),
&blob_field, (field_count + 1) * sizeof(uint),
&bitmaps, bitmap_buffer_size(field_count) * 6,
NullS))
return true;
DBUG_RETURN(true);
bzero(s, sizeof(*s));
s->blob_field= blob_field;
setup_tmp_table_column_bitmaps(this, bitmaps, field_count);
m_alloced_field_count= field_count;
return false;
DBUG_RETURN(false);
};
@ -17661,17 +17663,18 @@ bool Virtual_tmp_table::add(List<Spvar_definition> &field_list)
/* Create all fields and calculate the total length of record */
Spvar_definition *cdef; /* column definition */
List_iterator_fast<Spvar_definition> it(field_list);
for ( ; (cdef= it++); )
DBUG_ENTER("Virtual_tmp_table::add");
while ((cdef= it++))
{
Field *tmp;
if (!(tmp= cdef->make_field(s, in_use->mem_root, 0,
(uchar*) (f_maybe_null(cdef->pack_flag) ? "" : 0),
f_maybe_null(cdef->pack_flag) ? 1 : 0,
&cdef->field_name)))
return true;
add(tmp);
DBUG_RETURN(true);
add(tmp);
}
return false;
DBUG_RETURN(false);
}

View file

@ -154,7 +154,8 @@ bool servers_init(bool dont_read_servers_table)
}
/* Initialize the mem root for data */
init_sql_alloc(&mem, ACL_ALLOC_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC));
init_sql_alloc(&mem, "servers", ACL_ALLOC_BLOCK_SIZE, 0,
MYF(MY_THREAD_SPECIFIC));
if (dont_read_servers_table)
goto end;
@ -203,7 +204,7 @@ static bool servers_load(THD *thd, TABLE_LIST *tables)
my_hash_reset(&servers_cache);
free_root(&mem, MYF(0));
init_sql_alloc(&mem, ACL_ALLOC_BLOCK_SIZE, 0, MYF(0));
init_sql_alloc(&mem, "servers_load", ACL_ALLOC_BLOCK_SIZE, 0, MYF(0));
if (init_read_record(&read_record_info,thd,table=tables[0].table, NULL, NULL,
1,0, FALSE))

View file

@ -4800,7 +4800,8 @@ static int fill_schema_table_from_frm(THD *thd, TABLE *table,
if (schema_table->i_s_requested_object & OPEN_TRIGGER_ONLY)
{
init_sql_alloc(&tbl.mem_root, TABLE_ALLOC_BLOCK_SIZE, 0, MYF(0));
init_sql_alloc(&tbl.mem_root, "fill_schema_table_from_frm",
TABLE_ALLOC_BLOCK_SIZE, 0, MYF(0));
if (!Table_triggers_list::check_n_load(thd, db_name->str,
table_name->str, &tbl, 1))
{
@ -5033,8 +5034,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
goto err;
/* Use tmp_mem_root to allocate data for opened tables */
init_alloc_root(&tmp_mem_root, SHOW_ALLOC_BLOCK_SIZE, SHOW_ALLOC_BLOCK_SIZE,
MY_THREAD_SPECIFIC);
init_alloc_root(&tmp_mem_root, "get_all_tables", SHOW_ALLOC_BLOCK_SIZE,
SHOW_ALLOC_BLOCK_SIZE, MY_THREAD_SPECIFIC);
for (size_t i=0; i < db_names.elements(); i++)
{

View file

@ -1112,7 +1112,8 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
ddl_log_entry->tmp_name));
handler_name.str= (char*)ddl_log_entry->handler_name;
handler_name.length= strlen(ddl_log_entry->handler_name);
init_sql_alloc(&mem_root, TABLE_ALLOC_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC));
init_sql_alloc(&mem_root, "execute_ddl_log_action", TABLE_ALLOC_BLOCK_SIZE,
0, MYF(MY_THREAD_SPECIFIC));
if (!strcmp(ddl_log_entry->handler_name, reg_ext))
frm_action= TRUE;
else

View file

@ -1789,10 +1789,11 @@ bool Table_triggers_list::drop_all_triggers(THD *thd, const char *db,
TABLE table;
char path[FN_REFLEN];
bool result= 0;
DBUG_ENTER("drop_all_triggers");
DBUG_ENTER("Triggers::drop_all_triggers");
bzero(&table, sizeof(table));
init_sql_alloc(&table.mem_root, 8192, 0, MYF(0));
init_sql_alloc(&table.mem_root, "Triggers::drop_all_triggers", 8192, 0,
MYF(0));
if (Table_triggers_list::check_n_load(thd, db, name, &table, 1))
{
@ -2038,10 +2039,11 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db,
bool result= 0;
bool upgrading50to51= FALSE;
Trigger *err_trigger;
DBUG_ENTER("change_table_name");
DBUG_ENTER("Triggers::change_table_name");
bzero(&table, sizeof(table));
init_sql_alloc(&table.mem_root, 8192, 0, MYF(0));
init_sql_alloc(&table.mem_root, "Triggers::change_table_name", 8192, 0,
MYF(0));
/*
This method interfaces the mysql server code protected by

View file

@ -153,7 +153,7 @@ void udf_init()
mysql_rwlock_init(key_rwlock_THR_LOCK_udf, &THR_LOCK_udf);
init_sql_alloc(&mem, UDF_ALLOC_BLOCK_SIZE, 0, MYF(0));
init_sql_alloc(&mem, "udf", UDF_ALLOC_BLOCK_SIZE, 0, MYF(0));
THD *new_thd = new THD(0);
if (!new_thd ||
my_hash_init(&udf_hash,system_charset_info,32,0,0,get_hash_key, NULL, 0))

View file

@ -310,7 +310,7 @@ TABLE_SHARE *alloc_table_share(const char *db, const char *table_name,
path_length= build_table_filename(path, sizeof(path) - 1,
db, table_name, "", 0);
init_sql_alloc(&mem_root, TABLE_ALLOC_BLOCK_SIZE, 0, MYF(0));
init_sql_alloc(&mem_root, "table_share", TABLE_ALLOC_BLOCK_SIZE, 0, MYF(0));
if (multi_alloc_root(&mem_root,
&share, sizeof(*share),
&key_buff, key_length,
@ -331,7 +331,8 @@ TABLE_SHARE *alloc_table_share(const char *db, const char *table_name,
/* The following will be fixed in open_table_from_share */
share->cached_row_logging_check= 1;
init_sql_alloc(&share->stats_cb.mem_root, TABLE_ALLOC_BLOCK_SIZE, 0, MYF(0));
init_sql_alloc(&share->stats_cb.mem_root, "share_stats",
TABLE_ALLOC_BLOCK_SIZE, 0, MYF(0));
memcpy((char*) &share->mem_root, (char*) &mem_root, sizeof(mem_root));
mysql_mutex_init(key_TABLE_SHARE_LOCK_share,
@ -388,8 +389,8 @@ void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key,
This can't be MY_THREAD_SPECIFIC for slaves as they are freed
during cleanup() from Relay_log_info::close_temporary_tables()
*/
init_sql_alloc(&share->mem_root, TABLE_ALLOC_BLOCK_SIZE, 0,
MYF(thd->slave_thread ? 0 : MY_THREAD_SPECIFIC));
init_sql_alloc(&share->mem_root, "tmp_table_share", TABLE_ALLOC_BLOCK_SIZE,
0, MYF(thd->slave_thread ? 0 : MY_THREAD_SPECIFIC));
share->table_category= TABLE_CATEGORY_TEMPORARY;
share->tmp_table= INTERNAL_TMP_TABLE;
share->db.str= (char*) key;
@ -3040,7 +3041,8 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
error= OPEN_FRM_NEEDS_REBUILD;
goto err;
}
init_sql_alloc(&outparam->mem_root, TABLE_ALLOC_BLOCK_SIZE, 0, MYF(0));
init_sql_alloc(&outparam->mem_root, "table", TABLE_ALLOC_BLOCK_SIZE, 0,
MYF(0));
if (outparam->alias.copy(alias, strlen(alias), table_alias_charset))
goto err;

View file

@ -979,7 +979,8 @@ private:
public:
Blob_mem_storage() :truncated_value(false)
{
init_alloc_root(&storage, MAX_FIELD_VARCHARLENGTH, 0, MYF(0));
init_alloc_root(&storage, "Blob_mem_storage", MAX_FIELD_VARCHARLENGTH, 0,
MYF(0));
}
~ Blob_mem_storage()
{

View file

@ -1284,7 +1284,8 @@ int tdc_iterate(THD *thd, my_hash_walk_action action, void *argument,
if (no_dups)
{
init_alloc_root(&no_dups_argument.root, 4096, 4096, MYF(alloc_flags));
init_alloc_root(&no_dups_argument.root, "no_dups", 4096, 4096,
MYF(alloc_flags));
my_hash_init(&no_dups_argument.hash, &my_charset_bin, tdc_records(), 0, 0,
eliminate_duplicates_get_key, 0, hash_flags);
no_dups_argument.action= action;

View file

@ -58,10 +58,11 @@ extern "C" {
}
}
void init_sql_alloc(MEM_ROOT *mem_root, uint block_size, uint pre_alloc,
myf my_flags)
void init_sql_alloc(MEM_ROOT *mem_root,
const char *area_name __attribute__((unused)),
uint block_size, uint pre_alloc, myf my_flags)
{
init_alloc_root(mem_root, block_size, pre_alloc, my_flags);
init_alloc_root(mem_root, area_name, block_size, pre_alloc, my_flags);
mem_root->error_handler=sql_alloc_error_handler;
}

View file

@ -20,8 +20,8 @@
typedef struct st_mem_root MEM_ROOT;
void init_sql_alloc(MEM_ROOT *root, uint block_size, uint pre_alloc_size,
myf my_flags);
void init_sql_alloc(MEM_ROOT *root, const char *area_name, uint block_size,
uint pre_alloc_size, myf my_flags);
char *sql_strmake_with_convert(THD *thd, const char *str, size_t arg_length,
CHARSET_INFO *from_cs,
size_t max_res_length,

View file

@ -1639,7 +1639,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
my_hash_free(&tz_names);
goto end;
}
init_sql_alloc(&tz_storage, 32 * 1024, 0, MYF(0));
init_sql_alloc(&tz_storage, "timezone_storage", 32 * 1024, 0, MYF(0));
mysql_mutex_init(key_tz_LOCK, &tz_LOCK, MY_MUTEX_INIT_FAST);
tz_inited= 1;
@ -2565,7 +2565,8 @@ scan_tz_dir(char * name_end, uint symlink_recursion_level, uint verbose)
}
else if (MY_S_ISREG(cur_dir->dir_entry[i].mystat->st_mode))
{
init_alloc_root(&tz_storage, 32768, 0, MYF(MY_THREAD_SPECIFIC));
init_alloc_root(&tz_storage, "timezone_storage", 32768, 0,
MYF(MY_THREAD_SPECIFIC));
if (!tz_load(fullname, &tz_info, &tz_storage))
print_tz_as_sql(root_name_end + 1, &tz_info);
else
@ -2739,7 +2740,7 @@ main(int argc, char **argv)
First argument is timezonefile.
The second is timezonename if opt_leap is not given
*/
init_alloc_root(&tz_storage, 32768, 0, MYF(0));
init_alloc_root(&tz_storage, "timezone_storage", 32768, 0, MYF(0));
if (tz_load(argv[0], &tz_info, &tz_storage))
{
@ -2813,7 +2814,7 @@ main(int argc, char **argv)
MY_INIT(argv[0]);
init_alloc_root(&tz_storage, 32768, MYF(0));
init_alloc_root(&tz_storage, "timezone_storage", 32768, MYF(0));
/* let us set some well known timezone */
setenv("TZ", "MET", 1);

View file

@ -866,7 +866,7 @@ static void alloc_strings_memroot(MEM_ROOT *mem_root)
The mem_root used to allocate UUID (of length 36 + \0) so make
appropriate allocated size
*/
init_alloc_root(mem_root,
init_alloc_root(mem_root, "cassandra",
(36 + 1 + ALIGN_SIZE(sizeof(USED_MEM))) * 10 +
ALLOC_ROOT_MIN_BLOCK_SIZE,
(36 + 1 + ALIGN_SIZE(sizeof(USED_MEM))) * 10 +

View file

@ -514,7 +514,7 @@ ha_tina::ha_tina(handlerton *hton, TABLE_SHARE *table_arg)
buffer.set((char*)byte_buffer, IO_SIZE, &my_charset_bin);
chain= chain_buffer;
file_buff= new Transparent_file();
init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0, MYF(0));
init_alloc_root(&blobroot, "ha_tina", BLOB_MEMROOT_ALLOC_SIZE, 0, MYF(0));
}
@ -976,7 +976,7 @@ int ha_tina::open(const char *name, int mode, uint open_options)
*/
thr_lock_data_init(&share->lock, &lock, (void*) this);
ref_length= sizeof(my_off_t);
init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0, MYF(0));
init_alloc_root(&blobroot, "ha_tina", BLOB_MEMROOT_ALLOC_SIZE, 0, MYF(0));
share->lock.get_status= tina_get_status;
share->lock.update_status= tina_update_status;

View file

@ -1517,7 +1517,7 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table)
*/
query.length(0);
init_alloc_root(&mem_root, 256, 0, MYF(0));
init_alloc_root(&mem_root, "federated_share", 256, 0, MYF(0));
mysql_mutex_lock(&federated_mutex);

View file

@ -1520,7 +1520,7 @@ static FEDERATEDX_SERVER *get_server(FEDERATEDX_SHARE *share, TABLE *table)
mysql_mutex_assert_owner(&federatedx_mutex);
init_alloc_root(&mem_root, 4096, 4096, MYF(0));
init_alloc_root(&mem_root, "federated", 4096, 4096, MYF(0));
fill_server(&mem_root, &tmp_server, share, table ? table->s->table_charset : 0);
@ -1578,7 +1578,7 @@ static FEDERATEDX_SHARE *get_share(const char *table_name, TABLE *table)
query.length(0);
bzero(&tmp_share, sizeof(tmp_share));
init_alloc_root(&mem_root, 256, 0, MYF(0));
init_alloc_root(&mem_root, "federated", 256, 0, MYF(0));
mysql_mutex_lock(&federatedx_mutex);

View file

@ -3783,7 +3783,7 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info,
param->read_cache.end_of_file= sort_info.filelength;
sort_param.wordlist=NULL;
init_alloc_root(&sort_param.wordroot, FTPARSER_MEMROOT_ALLOC_SIZE, 0,
init_alloc_root(&sort_param.wordroot, "sort", FTPARSER_MEMROOT_ALLOC_SIZE, 0,
MYF(param->malloc_flags));
sort_param.key_cmp=sort_key_cmp;
@ -4431,7 +4431,8 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
(FT_MAX_WORD_LEN_FOR_SORT *
sort_param[i].keyinfo->seg->charset->mbmaxlen);
sort_param[i].key_length+=ft_max_word_len_for_sort-HA_FT_MAXBYTELEN;
init_alloc_root(&sort_param[i].wordroot, FTPARSER_MEMROOT_ALLOC_SIZE, 0,
init_alloc_root(&sort_param[i].wordroot, "sort",
FTPARSER_MEMROOT_ALLOC_SIZE, 0,
MYF(param->malloc_flags));
}
}

View file

@ -574,7 +574,7 @@ FT_INFO * maria_ft_init_boolean_search(MARIA_HA *info, uint keynr,
bzero(& ftb->no_dupes, sizeof(TREE));
ftb->last_word= 0;
init_alloc_root(&ftb->mem_root, 1024, 1024, 0);
init_alloc_root(&ftb->mem_root, "fulltext", 1024, 1024, 0);
ftb->queue.max_elements= 0;
if (!(ftbe=(FTB_EXPR *)alloc_root(&ftb->mem_root, sizeof(FTB_EXPR))))
goto err;

View file

@ -348,7 +348,8 @@ MYSQL_FTPARSER_PARAM* maria_ftparser_alloc_param(MARIA_HA *info)
info->ftparser_param= (MYSQL_FTPARSER_PARAM *)
my_malloc(MAX_PARAM_NR * sizeof(MYSQL_FTPARSER_PARAM) *
info->s->ftkeys, MYF(MY_WME | MY_ZEROFILL));
init_alloc_root(&info->ft_memroot, FTPARSER_MEMROOT_ALLOC_SIZE, 0, MYF(0));
init_alloc_root(&info->ft_memroot, "fulltext_parser",
FTPARSER_MEMROOT_ALLOC_SIZE, 0, MYF(0));
}
return info->ftparser_param;
}

View file

@ -60,7 +60,10 @@
# define KEY_N_KEY_PARTS(key) (key)->key_parts
#endif
#if defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100000
#if defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100213
# define mrn_init_alloc_root(PTR, SZ1, SZ2, FLAG) \
init_alloc_root(PTR, "mroonga", SZ1, SZ2, FLAG)
#elif defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100000
# define mrn_init_alloc_root(PTR, SZ1, SZ2, FLAG) \
init_alloc_root(PTR, SZ1, SZ2, FLAG)
#elif MYSQL_VERSION_ID >= 50706
@ -238,7 +241,13 @@
#endif
#if defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100000
# if MYSQL_VERSION_ID >= 100104
# if MYSQL_VERSION_ID >= 100213
# define mrn_init_sql_alloc(thd, mem_root) \
init_sql_alloc(mem_root, "Mroonga", \
TABLE_ALLOC_BLOCK_SIZE, \
0, \
MYF(thd->slave_thread ? 0 : MY_THREAD_SPECIFIC))
#elif MYSQL_VERSION_ID >= 100104
# define mrn_init_sql_alloc(thd, mem_root) \
init_sql_alloc(mem_root, \
TABLE_ALLOC_BLOCK_SIZE, \

View file

@ -579,7 +579,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, uchar *query,
bzero(& ftb->no_dupes, sizeof(TREE));
ftb->last_word= 0;
init_alloc_root(&ftb->mem_root, 1024, 1024, MYF(0));
init_alloc_root(&ftb->mem_root, "fulltext", 1024, 1024, MYF(0));
ftb->queue.max_elements= 0;
if (!(ftbe=(FTB_EXPR *)alloc_root(&ftb->mem_root, sizeof(FTB_EXPR))))
goto err;

View file

@ -342,7 +342,8 @@ MYSQL_FTPARSER_PARAM* ftparser_alloc_param(MI_INFO *info)
info->ftparser_param= (MYSQL_FTPARSER_PARAM *)
my_malloc(MAX_PARAM_NR * sizeof(MYSQL_FTPARSER_PARAM) *
info->s->ftkeys, MYF(MY_WME | MY_ZEROFILL));
init_alloc_root(&info->ft_memroot, FTPARSER_MEMROOT_ALLOC_SIZE, 0, MYF(0));
init_alloc_root(&info->ft_memroot, "fulltext_parser",
FTPARSER_MEMROOT_ALLOC_SIZE, 0, MYF(0));
}
return info->ftparser_param;
}

View file

@ -2292,7 +2292,7 @@ int mi_repair_by_sort(HA_CHECK *param, register MI_INFO *info,
mysql_file_seek(param->read_cache.file, 0L, MY_SEEK_END, MYF(0));
sort_param.wordlist=NULL;
init_alloc_root(&sort_param.wordroot, FTPARSER_MEMROOT_ALLOC_SIZE, 0,
init_alloc_root(&sort_param.wordroot, "sort", FTPARSER_MEMROOT_ALLOC_SIZE, 0,
MYF(param->malloc_flags));
if (share->data_file_type == DYNAMIC_RECORD)
@ -2870,7 +2870,8 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info,
uint ft_max_word_len_for_sort=FT_MAX_WORD_LEN_FOR_SORT*
sort_param[i].keyinfo->seg->charset->mbmaxlen;
sort_param[i].key_length+=ft_max_word_len_for_sort-HA_FT_MAXBYTELEN;
init_alloc_root(&sort_param[i].wordroot, FTPARSER_MEMROOT_ALLOC_SIZE, 0,
init_alloc_root(&sort_param[i].wordroot, "sort",
FTPARSER_MEMROOT_ALLOC_SIZE, 0,
MYF(param->malloc_flags));
}
}

View file

@ -120,7 +120,7 @@ static handler *myisammrg_create_handler(handlerton *hton,
ha_myisammrg::ha_myisammrg(handlerton *hton, TABLE_SHARE *table_arg)
:handler(hton, table_arg), file(0), is_cloned(0)
{
init_sql_alloc(&children_mem_root,
init_sql_alloc(&children_mem_root, "ha_myisammrg",
FN_REFLEN + ALLOC_ROOT_MIN_BLOCK_SIZE, 0, MYF(0));
}

View file

@ -562,7 +562,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
init_tmp_table_share( thd, share, table->s->db.str, table->s->db.length, options->table_name, "");
// because of that, we need to reinitialize the memroot (to reset MY_THREAD_SPECIFIC flag)
DBUG_ASSERT(share->mem_root.used == NULL); // it's still empty
init_sql_alloc(&share->mem_root, TABLE_ALLOC_BLOCK_SIZE, 0, MYF(0));
init_sql_alloc(&share->mem_root, "share", TABLE_ALLOC_BLOCK_SIZE, 0, MYF(0));
// What I think this code is doing:
// * Our OQGRAPH table is `database_blah/name`

View file

@ -16,7 +16,12 @@
#ifndef HS_COMPAT_H
#define HS_COMPAT_H
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100213
#define SPD_INIT_DYNAMIC_ARRAY2(A, B, C, D, E, F) \
my_init_dynamic_array2(A, B, C, D, E, F)
#define SPD_INIT_ALLOC_ROOT(A, B, C, D) \
init_alloc_root(A, "spider", B, C, D)
#elif defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
#define SPD_INIT_DYNAMIC_ARRAY2(A, B, C, D, E, F) \
my_init_dynamic_array2(A, B, C, D, E, F)
#define SPD_INIT_ALLOC_ROOT(A, B, C, D) \