diff options
Diffstat (limited to 'storage/myisam')
-rw-r--r-- | storage/myisam/ft_boolean_search.c | 4 | ||||
-rw-r--r-- | storage/myisam/ft_nlq_search.c | 2 | ||||
-rw-r--r-- | storage/myisam/ft_parser.c | 7 | ||||
-rw-r--r-- | storage/myisam/ft_stopwords.c | 9 | ||||
-rw-r--r-- | storage/myisam/ha_myisam.cc | 2 | ||||
-rw-r--r-- | storage/myisam/mi_check.c | 21 | ||||
-rw-r--r-- | storage/myisam/mi_create.c | 3 | ||||
-rw-r--r-- | storage/myisam/mi_dynrec.c | 2 | ||||
-rw-r--r-- | storage/myisam/mi_open.c | 9 | ||||
-rw-r--r-- | storage/myisam/mi_packrec.c | 12 | ||||
-rw-r--r-- | storage/myisam/mi_preload.c | 3 | ||||
-rw-r--r-- | storage/myisam/mi_static.c | 50 | ||||
-rw-r--r-- | storage/myisam/mi_test2.c | 2 | ||||
-rw-r--r-- | storage/myisam/mi_write.c | 9 | ||||
-rw-r--r-- | storage/myisam/myisamdef.h | 22 | ||||
-rw-r--r-- | storage/myisam/myisamlog.c | 8 | ||||
-rw-r--r-- | storage/myisam/myisampack.c | 20 | ||||
-rw-r--r-- | storage/myisam/rt_index.c | 7 | ||||
-rw-r--r-- | storage/myisam/sort.c | 17 |
19 files changed, 152 insertions, 57 deletions
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index 406a9bbc951..a91467c5b8d 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -566,7 +566,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, uchar *query, FTB_EXPR *ftbe; FTB_WORD *ftbw; - if (!(ftb=(FTB *)my_malloc(sizeof(FTB), MYF(MY_WME)))) + if (!(ftb=(FTB *)my_malloc(mi_key_memory_FTB, sizeof(FTB), MYF(MY_WME)))) return 0; ftb->please= (struct _ft_vft *) & _ft_vft_boolean; ftb->state=UNINITIALIZED; @@ -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, "fulltext", 1024, 1024, MYF(0)); + init_alloc_root(mi_key_memory_FTB, &ftb->mem_root, 1024, 1024, MYF(0)); ftb->queue.max_elements= 0; if (!(ftbe=(FTB_EXPR *)alloc_root(&ftb->mem_root, sizeof(FTB_EXPR)))) goto err; diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c index 3e433b71761..eb95d1e0b94 100644 --- a/storage/myisam/ft_nlq_search.c +++ b/storage/myisam/ft_nlq_search.c @@ -287,7 +287,7 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, uchar *query, If ndocs == 0, this will not allocate RAM for FT_INFO.doc[], so if ndocs == 0, FT_INFO.doc[] must not be accessed. */ - dlist=(FT_INFO *)my_malloc(sizeof(FT_INFO)+ + dlist=(FT_INFO *)my_malloc(mi_key_memory_FT_INFO, sizeof(FT_INFO)+ sizeof(FT_DOC)* (int)(aio.dtree.elements_in_tree-1), MYF(0)); diff --git a/storage/myisam/ft_parser.c b/storage/myisam/ft_parser.c index 9f62250f760..4584dbd4b91 100644 --- a/storage/myisam/ft_parser.c +++ b/storage/myisam/ft_parser.c @@ -341,9 +341,10 @@ MYSQL_FTPARSER_PARAM* ftparser_alloc_param(MI_INFO *info) (ftb_check_phrase_internal, ftb_phrase_add_word). Thus MAX_PARAM_NR=2. */ 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, "fulltext_parser", + my_malloc(mi_key_memory_FTPARSER_PARAM, + MAX_PARAM_NR * sizeof(MYSQL_FTPARSER_PARAM) * info->s->ftkeys, + MYF(MY_WME | MY_ZEROFILL)); + init_alloc_root(mi_key_memory_ft_memroot, &info->ft_memroot, FTPARSER_MEMROOT_ALLOC_SIZE, 0, MYF(0)); } return info->ftparser_param; diff --git a/storage/myisam/ft_stopwords.c b/storage/myisam/ft_stopwords.c index 3422a82a111..34c445cc163 100644 --- a/storage/myisam/ft_stopwords.c +++ b/storage/myisam/ft_stopwords.c @@ -59,7 +59,8 @@ int ft_init_stopwords() DBUG_ENTER("ft_init_stopwords"); if (!stopwords3) { - if (!(stopwords3=(TREE *)my_malloc(sizeof(TREE),MYF(0)))) + if (!(stopwords3=(TREE *)my_malloc(mi_key_memory_ft_stopwords, + sizeof(TREE), MYF(0)))) DBUG_RETURN(-1); init_tree(stopwords3,0,0,sizeof(FT_STOPWORD),(qsort_cmp2)&FT_STOPWORD_cmp, (ft_stopword_file ? (tree_element_free)&FT_STOPWORD_free : 0), @@ -89,13 +90,15 @@ int ft_init_stopwords() DBUG_RETURN(-1); len=(size_t)my_seek(fd, 0L, MY_SEEK_END, MYF(0)); my_seek(fd, 0L, MY_SEEK_SET, MYF(0)); - if (!(start=buffer=my_malloc(len+1, MYF(MY_WME)))) + if (!(start= buffer= my_malloc(mi_key_memory_ft_stopwords, len+1, + MYF(MY_WME)))) goto err0; len=my_read(fd, buffer, len, MYF(MY_WME)); end=start+len; while (ft_simple_get_word(ft_stopword_cs, &start, end, &w, TRUE)) { - if (ft_add_stopword(my_strndup((char*) w.pos, w.len, MYF(0)))) + if (ft_add_stopword(my_strndup(mi_key_memory_ft_stopwords, + (char*) w.pos, w.len, MYF(0)))) goto err1; } error=0; diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 38091dae0ba..1e9aadf038b 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -254,7 +254,7 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out, TABLE_SHARE *share= table_arg->s; uint options= share->db_options_in_use; DBUG_ENTER("table2myisam"); - if (!(my_multi_malloc(MYF(MY_WME), + if (!(my_multi_malloc(PSI_INSTRUMENT_ME, MYF(MY_WME), recinfo_out, (share->fields * 2 + 2) * sizeof(MI_COLUMNDEF), keydef_out, share->keys * sizeof(MI_KEYDEF), &keyseg, diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 3f3c60a4249..88c6a4837e4 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -2139,7 +2139,7 @@ int filecopy(HA_CHECK *param, File to,File from,my_off_t start, DBUG_ENTER("filecopy"); buff_length=(ulong) MY_MIN(param->write_buffer_length,length); - if (!(buff=my_malloc(buff_length,MYF(0)))) + if (!(buff=my_malloc(mi_key_memory_filecopy, buff_length, MYF(0)))) { buff=tmp_buff; buff_length=IO_SIZE; } @@ -2294,8 +2294,8 @@ 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, "sort", FTPARSER_MEMROOT_ALLOC_SIZE, 0, - MYF(param->malloc_flags)); + init_alloc_root(mi_key_memory_MI_SORT_PARAM_wordroot, &sort_param.wordroot, + FTPARSER_MEMROOT_ALLOC_SIZE, 0, MYF(param->malloc_flags)); if (share->data_file_type == DYNAMIC_RECORD) length=MY_MAX(share->base.min_pack_length+1,share->base.min_block_length); @@ -2789,7 +2789,7 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info, if (share->options & HA_OPTION_COMPRESS_RECORD) set_if_bigger(max_pack_reclength, share->max_pack_length); if (!(sort_param=(MI_SORT_PARAM *) - my_malloc((uint) share->base.keys * + my_malloc(mi_key_memory_MI_SORT_PARAM, (uint) share->base.keys * (sizeof(MI_SORT_PARAM) + max_pack_reclength), MYF(MY_ZEROFILL)))) { @@ -2872,8 +2872,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, "sort", - FTPARSER_MEMROOT_ALLOC_SIZE, 0, + init_alloc_root(mi_key_memory_MI_SORT_PARAM_wordroot, + &sort_param[i].wordroot, FTPARSER_MEMROOT_ALLOC_SIZE, 0, MYF(param->malloc_flags)); } } @@ -3717,7 +3717,8 @@ int sort_write_record(MI_SORT_PARAM *sort_param) MI_DYN_DELETE_BLOCK_HEADER; if (sort_info->buff_length < reclength) { - if (!(sort_info->buff=my_realloc(sort_info->buff, (uint) reclength, + if (!(sort_info->buff=my_realloc(mi_key_memory_SORT_INFO_buffer, + sort_info->buff, (uint) reclength, MYF(MY_FREE_ON_ERROR | MY_WME | MY_ALLOW_ZERO_PTR)))) DBUG_RETURN(1); @@ -3934,7 +3935,8 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a) sort_info->info->s->rec_reflength) && (sort_info->info->s->options & (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD))) - ft_buf=(SORT_FT_BUF *)my_malloc(sort_param->keyinfo->block_length + + ft_buf=(SORT_FT_BUF *)my_malloc(mi_key_memory_SORT_FT_BUF, + sort_param->keyinfo->block_length + sizeof(SORT_FT_BUF), MYF(MY_WME)); if (!ft_buf) @@ -4205,7 +4207,8 @@ static SORT_KEY_BLOCKS *alloc_key_blocks(HA_CHECK *param, uint blocks, SORT_KEY_BLOCKS *block; DBUG_ENTER("alloc_key_blocks"); - if (!(block=(SORT_KEY_BLOCKS*) my_malloc((sizeof(SORT_KEY_BLOCKS)+ + if (!(block=(SORT_KEY_BLOCKS*) my_malloc(mi_key_memory_SORT_KEY_BLOCKS, + (sizeof(SORT_KEY_BLOCKS)+ buffer_length+IO_SIZE)*blocks, MYF(0)))) { diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index c91c1af5f60..fcdb4569f4c 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -94,7 +94,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ci->reloc_rows=ci->max_rows; /* Check if wrong parameter */ if (!(rec_per_key_part= - (ulong*) my_malloc((keys + uniques)*HA_MAX_KEY_SEG*sizeof(long), + (ulong*) my_malloc(mi_key_memory_MYISAM_SHARE, + (keys + uniques) * HA_MAX_KEY_SEG * sizeof(long), MYF(MY_WME | MY_ZEROFILL)))) DBUG_RETURN(my_errno); diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index 69c13ab96cf..09c10040f9c 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -43,7 +43,7 @@ static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos, /* Play it safe; We have a small stack when using threads */ #undef my_alloca #undef my_afree -#define my_alloca(A) my_malloc((A),MYF(0)) +#define my_alloca(A) my_malloc(PSI_NOT_INSTRUMENTED, (A),MYF(0)) #define my_afree(A) my_free((A)) /* Interface function from MI_INFO */ diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 4d3c227dcc3..cca2afa0b03 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -310,7 +310,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) /* Add space for node pointer */ share->base.max_key_length+= share->base.key_reflength; - if (!my_multi_malloc(MY_WME, + if (!my_multi_malloc(mi_key_memory_MYISAM_SHARE, MYF(MY_WME), &share,sizeof(*share), &share->state.rec_per_key_part, sizeof(long)*base_key_parts, @@ -599,7 +599,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) } /* alloc and set up private structure parts */ - if (!my_multi_malloc(MY_WME, + if (!my_multi_malloc(mi_key_memory_MI_INFO, MYF(MY_WME), &m_info,sizeof(MI_INFO), &info.blobs,sizeof(MI_BLOB)*share->base.blobs, &info.buff,(share->base.max_key_block_length*2+ @@ -759,7 +759,8 @@ uchar *mi_alloc_rec_buff(MI_INFO *info, ulong length, uchar **buf) MI_REC_BUFF_OFFSET : 0); if (extra && newptr) newptr-= MI_REC_BUFF_OFFSET; - if (!(newptr=(uchar*) my_realloc((uchar*)newptr, length+extra+8, + if (!(newptr=(uchar*) my_realloc(mi_key_memory_record_buffer, + (uchar*)newptr, length + extra + 8, MYF(MY_ALLOW_ZERO_PTR)))) return NULL; *((uint32 *) newptr)= (uint32) length; @@ -1004,7 +1005,7 @@ uchar *mi_state_info_read(uchar *ptr, MI_STATE_INFO *state) if (!state->rec_per_key_part) { - if (!my_multi_malloc(MY_WME, + if (!my_multi_malloc(mi_key_memory_MYISAM_SHARE, MYF(MY_WME), &state->rec_per_key_part,sizeof(long)*key_parts, &state->key_root, keys*sizeof(my_off_t), &state->key_del, key_blocks*sizeof(my_off_t), diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c index b28eaf21090..637b1e69bfd 100644 --- a/storage/myisam/mi_packrec.c +++ b/storage/myisam/mi_packrec.c @@ -195,8 +195,8 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) - Distinct column values */ if (!(share->decode_trees=(MI_DECODE_TREE*) - my_malloc((uint) (trees*sizeof(MI_DECODE_TREE)+ - intervall_length*sizeof(uchar)), + my_malloc(mi_key_memory_MI_DECODE_TREE, + trees*sizeof(MI_DECODE_TREE) + intervall_length*sizeof(uchar), MYF(MY_WME)))) goto err0; intervall_buff=(uchar*) (share->decode_trees+trees); @@ -218,7 +218,8 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) data, we add (BITS_SAVED / 8) - 1 bytes to the buffer size. */ if (!(share->decode_tables=(uint16*) - my_malloc((length + OFFSET_TABLE_SIZE) * sizeof(uint16) + + my_malloc(mi_key_memory_MYISAM_SHARE_decode_tables, + (length + OFFSET_TABLE_SIZE) * sizeof(uint16) + (uint) (share->pack.header_length - sizeof(header) + (BITS_SAVED / 8) - 1), MYF(MY_WME | MY_ZEROFILL)))) goto err1; @@ -258,9 +259,10 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) goto err3; /* Reallocate the decoding tables to the used size. */ decode_table=(uint16*) - my_realloc((uchar*) share->decode_tables, + my_realloc(mi_key_memory_MYISAM_SHARE_decode_tables, + (uchar*) share->decode_tables, (uint) ((uchar*) decode_table - (uchar*) share->decode_tables), - MYF(MY_HOLD_ON_ERROR)); + MYF(0)); /* Fix the table addresses in the tree heads. */ { my_ptrdiff_t diff=PTR_BYTE_DIFF(decode_table,share->decode_tables); diff --git a/storage/myisam/mi_preload.c b/storage/myisam/mi_preload.c index d52a2ea46ea..5f9132abe14 100644 --- a/storage/myisam/mi_preload.c +++ b/storage/myisam/mi_preload.c @@ -73,7 +73,8 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) length= info->preload_buff_size/block_length * block_length; set_if_bigger(length, block_length); - if (!(buff= (uchar *) my_malloc(length, MYF(MY_WME)))) + if (!(buff= (uchar *) my_malloc(mi_key_memory_preload_buffer, length, + MYF(MY_WME)))) DBUG_RETURN(my_errno= HA_ERR_OUT_OF_MEM); if (flush_key_blocks(share->key_cache, share->kfile, &share->dirty_part_map, diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c index 3679ea4a329..d0c3995d9de 100644 --- a/storage/myisam/mi_static.c +++ b/storage/myisam/mi_static.c @@ -61,6 +61,28 @@ uint myisam_readnext_vec[]= SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_SMALLER }; +PSI_memory_key mi_key_memory_MYISAM_SHARE; +PSI_memory_key mi_key_memory_MI_INFO; +PSI_memory_key mi_key_memory_MI_INFO_ft1_to_ft2; +PSI_memory_key mi_key_memory_MI_INFO_bulk_insert; +PSI_memory_key mi_key_memory_record_buffer; +PSI_memory_key mi_key_memory_FTB; +PSI_memory_key mi_key_memory_FT_INFO; +PSI_memory_key mi_key_memory_FTPARSER_PARAM; +PSI_memory_key mi_key_memory_ft_memroot; +PSI_memory_key mi_key_memory_ft_stopwords; +PSI_memory_key mi_key_memory_MI_SORT_PARAM; +PSI_memory_key mi_key_memory_MI_SORT_PARAM_wordroot; +PSI_memory_key mi_key_memory_SORT_FT_BUF; +PSI_memory_key mi_key_memory_SORT_KEY_BLOCKS; +PSI_memory_key mi_key_memory_filecopy; +PSI_memory_key mi_key_memory_SORT_INFO_buffer; +PSI_memory_key mi_key_memory_MI_DECODE_TREE; +PSI_memory_key mi_key_memory_MYISAM_SHARE_decode_tables; +PSI_memory_key mi_key_memory_preload_buffer; +PSI_memory_key mi_key_memory_stPageList_pages; +PSI_memory_key mi_key_memory_keycache_thread_var; + #ifdef HAVE_PSI_INTERFACE PSI_mutex_key mi_key_mutex_MYISAM_SHARE_intern_lock, mi_key_mutex_MI_SORT_INFO_mutex, mi_key_mutex_MI_CHECK_print_msg; @@ -106,6 +128,31 @@ static PSI_thread_info all_myisam_threads[]= { &mi_key_thread_find_all_keys, "find_all_keys", 0}, }; +static PSI_memory_info all_myisam_memory[]= +{ + { &mi_key_memory_MYISAM_SHARE, "MYISAM_SHARE", 0}, + { &mi_key_memory_MI_INFO, "MI_INFO", 0}, + { &mi_key_memory_MI_INFO_ft1_to_ft2, "MI_INFO::ft1_to_ft2", 0}, + { &mi_key_memory_MI_INFO_bulk_insert, "MI_INFO::bulk_insert", 0}, + { &mi_key_memory_record_buffer, "record_buffer", 0}, + { &mi_key_memory_FTB, "FTB", 0}, + { &mi_key_memory_FT_INFO, "FT_INFO", 0}, + { &mi_key_memory_FTPARSER_PARAM, "FTPARSER_PARAM", 0}, + { &mi_key_memory_ft_memroot, "ft_memroot", 0}, + { &mi_key_memory_ft_stopwords, "ft_stopwords", 0}, + { &mi_key_memory_MI_SORT_PARAM, "MI_SORT_PARAM", 0}, + { &mi_key_memory_MI_SORT_PARAM_wordroot, "MI_SORT_PARAM::wordroot", 0}, + { &mi_key_memory_SORT_FT_BUF, "SORT_FT_BUF", 0}, + { &mi_key_memory_SORT_KEY_BLOCKS, "SORT_KEY_BLOCKS", 0}, + { &mi_key_memory_filecopy, "filecopy", 0}, + { &mi_key_memory_SORT_INFO_buffer, "SORT_INFO::buffer", 0}, + { &mi_key_memory_MI_DECODE_TREE, "MI_DECODE_TREE", 0}, + { &mi_key_memory_MYISAM_SHARE_decode_tables, "MYISAM_SHARE::decode_tables", 0}, + { &mi_key_memory_preload_buffer, "preload_buffer", 0}, + { &mi_key_memory_stPageList_pages, "stPageList::pages", 0}, + { &mi_key_memory_keycache_thread_var, "keycache_thread_var", 0} +}; + void init_myisam_psi_keys() { const char* category= "myisam"; @@ -125,6 +172,9 @@ void init_myisam_psi_keys() count= array_elements(all_myisam_threads); mysql_thread_register(category, all_myisam_threads, count); + + count= array_elements(all_myisam_memory); + mysql_memory_register(category, all_myisam_memory, count); } #endif /* HAVE_PSI_INTERFACE */ diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c index 48a091e80de..5a66e958139 100644 --- a/storage/myisam/mi_test2.c +++ b/storage/myisam/mi_test2.c @@ -1021,7 +1021,7 @@ static void put_blob_in_record(uchar *blob_pos, char **blob_buffer) if (rnd(10) == 0) { if (! *blob_buffer && - !(*blob_buffer=my_malloc((uint) use_blob,MYF(MY_WME)))) + !(*blob_buffer=my_malloc(PSI_NOT_INSTRUMENTED, use_blob,MYF(MY_WME)))) { use_blob=0; return; diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c index 7345ab1604d..512a2a11bf2 100644 --- a/storage/myisam/mi_write.c +++ b/storage/myisam/mi_write.c @@ -546,8 +546,10 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo, { /* yup. converting */ info->ft1_to_ft2=(DYNAMIC_ARRAY *) - my_malloc(sizeof(DYNAMIC_ARRAY), MYF(MY_WME)); - my_init_dynamic_array(info->ft1_to_ft2, ft2len, 300, 50, MYF(0)); + my_malloc(mi_key_memory_MI_INFO_ft1_to_ft2, + sizeof(DYNAMIC_ARRAY), MYF(MY_WME)); + my_init_dynamic_array(info->ft1_to_ft2, mi_key_memory_MI_INFO_ft1_to_ft2, + ft2len, 300, 50, MYF(0)); /* now, adding all keys from the page to dynarray @@ -998,7 +1000,8 @@ int mi_init_bulk_insert(MI_INFO *info, size_t cache_size, ha_rows rows) cache_size/=total_keylength*16; info->bulk_insert=(TREE *) - my_malloc((sizeof(TREE)*share->base.keys+ + my_malloc(mi_key_memory_MI_INFO_bulk_insert, + (sizeof(TREE)*share->base.keys+ sizeof(bulk_insert_param)*num_keys),MYF(0)); if (!info->bulk_insert) diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index b92c012e5f4..c5975f42315 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -777,4 +777,26 @@ extern PSI_thread_key mi_key_thread_find_all_keys; void init_myisam_psi_keys(); #endif /* HAVE_PSI_INTERFACE */ +extern PSI_memory_key mi_key_memory_MYISAM_SHARE; +extern PSI_memory_key mi_key_memory_MI_INFO; +extern PSI_memory_key mi_key_memory_MI_INFO_ft1_to_ft2; +extern PSI_memory_key mi_key_memory_MI_INFO_bulk_insert; +extern PSI_memory_key mi_key_memory_record_buffer; +extern PSI_memory_key mi_key_memory_FTB; +extern PSI_memory_key mi_key_memory_FT_INFO; +extern PSI_memory_key mi_key_memory_FTPARSER_PARAM; +extern PSI_memory_key mi_key_memory_ft_memroot; +extern PSI_memory_key mi_key_memory_ft_stopwords; +extern PSI_memory_key mi_key_memory_MI_SORT_PARAM; +extern PSI_memory_key mi_key_memory_MI_SORT_PARAM_wordroot; +extern PSI_memory_key mi_key_memory_SORT_FT_BUF; +extern PSI_memory_key mi_key_memory_SORT_KEY_BLOCKS; +extern PSI_memory_key mi_key_memory_filecopy; +extern PSI_memory_key mi_key_memory_SORT_INFO_buffer; +extern PSI_memory_key mi_key_memory_MI_DECODE_TREE; +extern PSI_memory_key mi_key_memory_MYISAM_SHARE_decode_tables; +extern PSI_memory_key mi_key_memory_preload_buffer; +extern PSI_memory_key mi_key_memory_stPageList_pages; +extern PSI_memory_key mi_key_memory_keycache_thread_var; + C_MODE_END diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c index 9bef2be929f..40d473dc532 100644 --- a/storage/myisam/myisamlog.c +++ b/storage/myisam/myisamlog.c @@ -422,7 +422,7 @@ static int examine_log(char * file_name, char **table_names) * The additional space is needed for the sprintf commands two lines * below. */ - file_info.show_name=my_memdup(isam_file_name, + file_info.show_name=my_memdup(PSI_NOT_INSTRUMENTED, isam_file_name, (uint) strlen(isam_file_name)+10, MYF(MY_WME)); if (file_info.id > 1) @@ -451,8 +451,8 @@ static int examine_log(char * file_name, char **table_names) if (!(file_info.isam= mi_open(isam_file_name,O_RDWR, HA_OPEN_WAIT_IF_LOCKED))) goto com_err; - if (!(file_info.record=my_malloc(file_info.isam->s->base.reclength, - MYF(MY_WME)))) + if (!(file_info.record=my_malloc(PSI_NOT_INSTRUMENTED, + file_info.isam->s->base.reclength, MYF(MY_WME)))) goto end; files_open++; file_info.closed=0; @@ -683,7 +683,7 @@ static int read_string(IO_CACHE *file, register uchar* *to, register uint length if (*to) my_free(*to); - if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) || + if (!(*to= (uchar*) my_malloc(PSI_NOT_INSTRUMENTED, length+1,MYF(MY_WME))) || my_b_read(file,(uchar*) *to,length)) { if (*to) diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index b2a2909ad73..1267ddc724d 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -439,7 +439,7 @@ static my_bool open_isam_files(PACK_MRG_INFO *mrg, char **names, uint count) uint i,j; mrg->count=0; mrg->current=0; - mrg->file=(MI_INFO**) my_malloc(sizeof(MI_INFO*)*count,MYF(MY_FAE)); + mrg->file=(MI_INFO**) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(MI_INFO*)*count,MYF(MY_FAE)); mrg->free_file=1; mrg->src_file_has_indexes_disabled= 0; for (i=0; i < count ; i++) @@ -518,7 +518,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) < 0) goto err; length=(uint) share->base.keystart; - if (!(buff= (uchar*) my_malloc(length,MYF(MY_WME)))) + if (!(buff= (uchar*) my_malloc(PSI_NOT_INSTRUMENTED, length,MYF(MY_WME)))) goto err; if (my_pread(share->kfile,buff,length,0L,MYF(MY_WME | MY_NABP)) || my_write(join_isam_file,buff,length, @@ -798,7 +798,7 @@ static HUFF_COUNTS *init_huff_count(MI_INFO *info,my_off_t records) { reg2 uint i; reg1 HUFF_COUNTS *count; - if ((count = (HUFF_COUNTS*) my_malloc(info->s->base.fields* + if ((count = (HUFF_COUNTS*) my_malloc(PSI_NOT_INSTRUMENTED, info->s->base.fields* sizeof(HUFF_COUNTS), MYF(MY_ZEROFILL | MY_WME)))) { @@ -825,7 +825,7 @@ static HUFF_COUNTS *init_huff_count(MI_INFO *info,my_off_t records) NULL, MYF(0)); if (records && type != FIELD_BLOB && type != FIELD_VARCHAR) count[i].tree_pos=count[i].tree_buff = - my_malloc(count[i].field_length > 1 ? tree_buff_length : 2, + my_malloc(PSI_NOT_INSTRUMENTED, count[i].field_length > 1 ? tree_buff_length : 2, MYF(MY_WME)); } } @@ -1476,7 +1476,7 @@ static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts, uint trees) HUFF_TREE *huff_tree; DBUG_ENTER("make_huff_trees"); - if (!(huff_tree=(HUFF_TREE*) my_malloc(trees*sizeof(HUFF_TREE), + if (!(huff_tree=(HUFF_TREE*) my_malloc(PSI_NOT_INSTRUMENTED, trees*sizeof(HUFF_TREE), MYF(MY_WME | MY_ZEROFILL)))) DBUG_RETURN(0); @@ -1554,14 +1554,14 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts) if (!huff_tree->element_buffer) { if (!(huff_tree->element_buffer= - (HUFF_ELEMENT*) my_malloc(found*2*sizeof(HUFF_ELEMENT),MYF(MY_WME)))) + (HUFF_ELEMENT*) my_malloc(PSI_NOT_INSTRUMENTED, found*2*sizeof(HUFF_ELEMENT),MYF(MY_WME)))) return 1; } else { HUFF_ELEMENT *temp; if (!(temp= - (HUFF_ELEMENT*) my_realloc((uchar*) huff_tree->element_buffer, + (HUFF_ELEMENT*) my_realloc(PSI_NOT_INSTRUMENTED, (uchar*) huff_tree->element_buffer, found*2*sizeof(HUFF_ELEMENT), MYF(MY_WME)))) return 1; @@ -1930,7 +1930,7 @@ static int make_huff_decode_table(HUFF_TREE *huff_tree, uint trees) { elements=huff_tree->counts->tree_buff ? huff_tree->elements : 256; if (!(huff_tree->code = - (ulonglong*) my_malloc(elements* + (ulonglong*) my_malloc(PSI_NOT_INSTRUMENTED, elements* (sizeof(ulonglong) + sizeof(uchar)), MYF(MY_WME | MY_ZEROFILL)))) return 1; @@ -2823,7 +2823,7 @@ static char *make_old_name(char *new_name, char *old_name) static void init_file_buffer(File file, pbool read_buffer) { file_buffer.file=file; - file_buffer.buffer= (uchar*) my_malloc(ALIGN_SIZE(RECORD_CACHE_SIZE), + file_buffer.buffer= (uchar*) my_malloc(PSI_NOT_INSTRUMENTED, ALIGN_SIZE(RECORD_CACHE_SIZE), MYF(MY_WME)); file_buffer.end=file_buffer.buffer+ALIGN_SIZE(RECORD_CACHE_SIZE)-8; file_buffer.pos_in_file=0; @@ -2880,7 +2880,7 @@ static int flush_buffer(ulong neaded_length) { char *tmp; neaded_length+=256; /* some margin */ - tmp= my_realloc((char*) file_buffer.buffer, neaded_length,MYF(MY_WME)); + tmp= my_realloc(PSI_NOT_INSTRUMENTED, (char*) file_buffer.buffer, neaded_length,MYF(MY_WME)); if (!tmp) return 1; file_buffer.pos= ((uchar*) tmp + diff --git a/storage/myisam/rt_index.c b/storage/myisam/rt_index.c index 08543ec2b22..651e2e79478 100644 --- a/storage/myisam/rt_index.c +++ b/storage/myisam/rt_index.c @@ -733,8 +733,11 @@ static int rtree_fill_reinsert_list(stPageList *ReinsertList, my_off_t page, if (ReinsertList->n_pages == ReinsertList->m_pages) { ReinsertList->m_pages += REINSERT_BUFFER_INC; - if (!(ReinsertList->pages = (stPageLevel*)my_realloc((uchar*)ReinsertList->pages, - ReinsertList->m_pages * sizeof(stPageLevel), MYF(MY_ALLOW_ZERO_PTR)))) + if (!(ReinsertList->pages = (stPageLevel*) + my_realloc(mi_key_memory_stPageList_pages, + (uchar*)ReinsertList->pages, + ReinsertList->m_pages * sizeof(stPageLevel), + MYF(MY_ALLOW_ZERO_PTR)))) goto err1; } /* save page to ReinsertList */ diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index e586543363b..910867b13a8 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -190,10 +190,12 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, } if ((sort_keys= ((uchar **) - my_malloc((size_t) (keys*(sort_length+sizeof(char*))+ + my_malloc(PSI_INSTRUMENT_ME, + (size_t) (keys*(sort_length+sizeof(char*))+ HA_FT_MAXBYTELEN), MYF(0))))) { - if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer, + if (my_init_dynamic_array(&buffpek, PSI_INSTRUMENT_ME, + sizeof(BUFFPEK), maxbuffer, MY_MIN(maxbuffer/2, 1000), MYF(0))) { my_free(sort_keys); @@ -406,12 +408,14 @@ static my_bool thr_find_all_keys_exec(MI_SORT_PARAM *sort_param) } while ((maxbuffer= (uint) (idx/(keys-1)+1)) != maxbuffer_org); } - if ((sort_keys= (uchar**) my_malloc((size_t)(keys * (sort_length + sizeof(char*)) + + if ((sort_keys= (uchar**) my_malloc(PSI_INSTRUMENT_ME, + (size_t)(keys * (sort_length + sizeof(char*)) + ((sort_param->keyinfo->flag & HA_FULLTEXT) ? HA_FT_MAXBYTELEN : 0)), MYF(0)))) { - if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK), - maxbuffer, MY_MIN(maxbuffer / 2, 1000), MYF(0))) + if (my_init_dynamic_array(&sort_param->buffpek, PSI_INSTRUMENT_ME, + sizeof(BUFFPEK), maxbuffer, + MY_MIN(maxbuffer / 2, 1000), MYF(0))) { my_free(sort_keys); sort_keys= NULL; /* Safety against double free on error. */ @@ -607,7 +611,8 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) length=param->sort_buffer_length; while (length >= MIN_SORT_BUFFER) { - if ((mergebuf= my_malloc((size_t) length, MYF(0)))) + if ((mergebuf= my_malloc(PSI_INSTRUMENT_ME, + (size_t) length, MYF(0)))) break; length=length*3/4; } |