diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-01-31 09:48:19 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-01-31 09:48:19 +0100 |
commit | ab83952f293ea46c00e421c81b81a394c9cae2b4 (patch) | |
tree | 6a3e995bd1330828a0e988d896bca218863fc74c /storage/heap | |
parent | 055b62f404ee0a0463ee8ff98a0e24c083b95f1d (diff) | |
parent | 5267af5e9e5e601d4f4b1ef40730da1e36d38d9d (diff) | |
download | mariadb-git-ab83952f293ea46c00e421c81b81a394c9cae2b4.tar.gz |
10.0-base merge
Diffstat (limited to 'storage/heap')
-rw-r--r-- | storage/heap/ha_heap.cc | 2 | ||||
-rw-r--r-- | storage/heap/heapdef.h | 3 | ||||
-rw-r--r-- | storage/heap/hp_block.c | 8 | ||||
-rw-r--r-- | storage/heap/hp_create.c | 9 | ||||
-rw-r--r-- | storage/heap/hp_open.c | 4 | ||||
-rw-r--r-- | storage/heap/hp_write.c | 4 |
6 files changed, 21 insertions, 9 deletions
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index b9eef0d155b..8e63799680b 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -634,7 +634,7 @@ heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table, if (!(keydef= (HP_KEYDEF*) my_malloc(keys * sizeof(HP_KEYDEF) + parts * sizeof(HA_KEYSEG), - MYF(MY_WME)))) + MYF(MY_WME | MY_THREAD_SPECIFIC)))) return my_errno; seg= reinterpret_cast<HA_KEYSEG*>(keydef + keys); for (key= 0; key < keys; key++) diff --git a/storage/heap/heapdef.h b/storage/heap/heapdef.h index db00ea87a01..d5c0ad96b05 100644 --- a/storage/heap/heapdef.h +++ b/storage/heap/heapdef.h @@ -62,7 +62,8 @@ typedef struct { extern HP_SHARE *hp_find_named_heap(const char *name); extern int hp_rectest(HP_INFO *info,const uchar *old); extern uchar *hp_find_block(HP_BLOCK *info,ulong pos); -extern int hp_get_new_block(HP_BLOCK *info, size_t* alloc_length); +extern int hp_get_new_block(HP_SHARE *info, HP_BLOCK *block, + size_t* alloc_length); extern void hp_free(HP_SHARE *info); extern uchar *hp_free_level(HP_BLOCK *block,uint level,HP_PTRS *pos, uchar *last_pos); diff --git a/storage/heap/hp_block.c b/storage/heap/hp_block.c index 01978e2b4e8..1c40f982422 100644 --- a/storage/heap/hp_block.c +++ b/storage/heap/hp_block.c @@ -45,6 +45,7 @@ uchar *hp_find_block(HP_BLOCK *block, ulong pos) SYNOPSIS hp_get_new_block() + info heap handle block HP_BLOCK tree-like block alloc_length OUT Amount of memory allocated from the heap @@ -54,7 +55,7 @@ uchar *hp_find_block(HP_BLOCK *block, ulong pos) 1 Out of memory */ -int hp_get_new_block(HP_BLOCK *block, size_t *alloc_length) +int hp_get_new_block(HP_SHARE *info, HP_BLOCK *block, size_t *alloc_length) { reg1 uint i,j; HP_PTRS *root; @@ -77,7 +78,10 @@ int hp_get_new_block(HP_BLOCK *block, size_t *alloc_length) */ *alloc_length= (sizeof(HP_PTRS)* ((i == block->levels) ? i : i - 1) + block->records_in_block* block->recbuffer); - if (!(root=(HP_PTRS*) my_malloc(*alloc_length,MYF(MY_WME)))) + if (!(root=(HP_PTRS*) my_malloc(*alloc_length, + MYF(MY_WME | + (info->internal ? + MY_THREAD_SPECIFIC : 0))))) return 1; if (i == 0) diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c index d170d1abc65..a8bc8e63810 100644 --- a/storage/heap/hp_create.c +++ b/storage/heap/hp_create.c @@ -146,7 +146,9 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info, if (!(share= (HP_SHARE*) my_malloc((uint) sizeof(HP_SHARE)+ keys*sizeof(HP_KEYDEF)+ key_segs*sizeof(HA_KEYSEG), - MYF(MY_ZEROFILL)))) + MYF(MY_ZEROFILL | + (create_info->internal_table ? + MY_THREAD_SPECIFIC : 0))))) goto err; share->keydef= (HP_KEYDEF*) (share + 1); share->key_stat_version= 1; @@ -171,7 +173,9 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info, keyseg++; init_tree(&keyinfo->rb_tree, 0, 0, sizeof(uchar*), - (qsort_cmp2)keys_compare, 1, NULL, NULL); + (qsort_cmp2)keys_compare, NULL, NULL, + MYF((create_info->internal_table ? MY_THREAD_SPECIFIC : 0) | + MY_TREE_WITH_DELETE)); keyinfo->delete_key= hp_rb_delete_key; keyinfo->write_key= hp_rb_write_key; } @@ -199,6 +203,7 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info, share->auto_key_type= create_info->auto_key_type; share->auto_increment= create_info->auto_increment; share->create_time= (long) time((time_t*) 0); + share->internal= create_info->internal_table; /* Must be allocated separately for rename to work */ if (!(share->name= my_strdup(name,MYF(0)))) { diff --git a/storage/heap/hp_open.c b/storage/heap/hp_open.c index c456dbdfc84..fc7397989f2 100644 --- a/storage/heap/hp_open.c +++ b/storage/heap/hp_open.c @@ -32,7 +32,9 @@ HP_INFO *heap_open_from_share(HP_SHARE *share, int mode) if (!(info= (HP_INFO*) my_malloc((uint) sizeof(HP_INFO) + 2 * share->max_key_length, - MYF(MY_ZEROFILL)))) + MYF(MY_ZEROFILL + + (share->internal ? + MY_THREAD_SPECIFIC : 0))))) { DBUG_RETURN(0); } diff --git a/storage/heap/hp_write.c b/storage/heap/hp_write.c index 8bfecc7747c..c84fc4b6104 100644 --- a/storage/heap/hp_write.c +++ b/storage/heap/hp_write.c @@ -162,7 +162,7 @@ static uchar *next_free_record_pos(HP_SHARE *info) my_errno=HA_ERR_RECORD_FILE_FULL; DBUG_RETURN(NULL); } - if (hp_get_new_block(&info->block,&length)) + if (hp_get_new_block(info, &info->block,&length)) DBUG_RETURN(NULL); info->data_length+=length; } @@ -407,7 +407,7 @@ static HASH_INFO *hp_find_free_hash(HP_SHARE *info, return hp_find_hash(block,records); if (!(block_pos=(records % block->records_in_block))) { - if (hp_get_new_block(block,&length)) + if (hp_get_new_block(info, block, &length)) return(NULL); info->index_length+=length; } |