diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/event_data_objects.cc | 2 | ||||
-rw-r--r-- | sql/ha_partition.cc | 6 | ||||
-rw-r--r-- | sql/log.cc | 3 | ||||
-rw-r--r-- | sql/mysqld.cc | 4 | ||||
-rw-r--r-- | sql/opt_range.cc | 24 | ||||
-rw-r--r-- | sql/opt_subselect.cc | 3 | ||||
-rw-r--r-- | sql/rpl_handler.h | 2 | ||||
-rw-r--r-- | sql/rpl_tblmap.cc | 3 | ||||
-rw-r--r-- | sql/sp_head.cc | 13 | ||||
-rw-r--r-- | sql/sql_acl.cc | 6 | ||||
-rw-r--r-- | sql/sql_class.cc | 4 | ||||
-rw-r--r-- | sql/sql_class.h | 6 | ||||
-rw-r--r-- | sql/sql_error.cc | 2 | ||||
-rw-r--r-- | sql/sql_handler.cc | 3 | ||||
-rw-r--r-- | sql/sql_lex.cc | 4 | ||||
-rw-r--r-- | sql/sql_plugin.cc | 8 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 9 | ||||
-rw-r--r-- | sql/sql_repl.cc | 5 | ||||
-rw-r--r-- | sql/sql_select.cc | 17 | ||||
-rw-r--r-- | sql/sql_servers.cc | 5 | ||||
-rw-r--r-- | sql/sql_show.cc | 7 | ||||
-rw-r--r-- | sql/sql_table.cc | 3 | ||||
-rw-r--r-- | sql/sql_trigger.cc | 10 | ||||
-rw-r--r-- | sql/sql_udf.cc | 2 | ||||
-rw-r--r-- | sql/table.cc | 12 | ||||
-rw-r--r-- | sql/table.h | 3 | ||||
-rw-r--r-- | sql/table_cache.cc | 3 | ||||
-rw-r--r-- | sql/thr_malloc.cc | 7 | ||||
-rw-r--r-- | sql/thr_malloc.h | 4 | ||||
-rw-r--r-- | sql/tztime.cc | 9 |
30 files changed, 112 insertions, 77 deletions
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index ef334233085..d42a503e9d2 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -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; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 4a40e0c1fc4..e0e4418ab22 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -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; diff --git a/sql/log.cc b/sql/log.cc index 62d98b9c0da..b6867bf6566 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -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 diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a53a031eca7..831b7b4be5d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -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, diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 3294b8f11f9..9c5dbc1c470 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -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; } diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index b11fc34c428..3b98b650f8f 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -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), diff --git a/sql/rpl_handler.h b/sql/rpl_handler.h index afcfd9d55b1..71550f0a577 100644 --- a/sql/rpl_handler.h +++ b/sql/rpl_handler.h @@ -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() diff --git a/sql/rpl_tblmap.cc b/sql/rpl_tblmap.cc index 48111bc5d0a..06e1d19d0c8 100644 --- a/sql/rpl_tblmap.cc +++ b/sql/rpl_tblmap.cc @@ -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; } diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 9351babdab5..6a4e274d00a 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -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))) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 6d8506a8e43..b62e3ae74d2 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -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(); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 0b776a2e2fe..c5c29e4efbc 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -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; diff --git a/sql/sql_class.h b/sql/sql_class.h index 70a57fa22f7..cbd4b26f135 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -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; diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 144cf9d4a30..5d70a543771 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -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; } diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index babb09a1267..a2b53045815 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -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); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index aed04842c90..b8245ce0a09 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -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, diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index be57c433b65..2b3ee37213a 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -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)) diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 33a7ee7f78f..2fd0f9c0531 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -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; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 91931b46771..11b9296c865 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -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"; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 2784938b654..f88db1048ad 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -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); } diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc index 5e826dff2e0..58c5bb7dd78 100644 --- a/sql/sql_servers.cc +++ b/sql/sql_servers.cc @@ -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)) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e29e8658ae4..919e2871b40 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -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++) { diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 9aa9b7becdb..44d507412ec 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -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 diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index e7e7dd9589d..ebc5b28f598 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -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 diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 612cc97f6a2..70da4d1160b 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -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)) diff --git a/sql/table.cc b/sql/table.cc index 1e0099cbe4f..afd6b14079f 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -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; diff --git a/sql/table.h b/sql/table.h index 8f83bfc5ef2..83a1e8702b7 100644 --- a/sql/table.h +++ b/sql/table.h @@ -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() { diff --git a/sql/table_cache.cc b/sql/table_cache.cc index be990543757..393fe931a82 100644 --- a/sql/table_cache.cc +++ b/sql/table_cache.cc @@ -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; diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc index cbed769a424..94ae1a4431c 100644 --- a/sql/thr_malloc.cc +++ b/sql/thr_malloc.cc @@ -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; } diff --git a/sql/thr_malloc.h b/sql/thr_malloc.h index fc23c87c9fd..a36059b97b2 100644 --- a/sql/thr_malloc.h +++ b/sql/thr_malloc.h @@ -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, diff --git a/sql/tztime.cc b/sql/tztime.cc index a9db91668bb..45af8f24943 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -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); |