Skip to content

Commit 67b24a2

Browse files
committed
Remove some allocations not needed for internal temporary tables.
1 parent e787012 commit 67b24a2

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

storage/heap/hp_create.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,12 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info,
211211
my_free(share);
212212
goto err;
213213
}
214-
thr_lock_init(&share->lock);
215-
mysql_mutex_init(hp_key_mutex_HP_SHARE_intern_lock,
216-
&share->intern_lock, MY_MUTEX_INIT_FAST);
214+
217215
if (!create_info->internal_table)
218216
{
217+
thr_lock_init(&share->lock);
218+
mysql_mutex_init(hp_key_mutex_HP_SHARE_intern_lock,
219+
&share->intern_lock, MY_MUTEX_INIT_FAST);
219220
share->open_list.data= (void*) share;
220221
heap_share_list= list_add(heap_share_list,&share->open_list);
221222
}
@@ -340,11 +341,13 @@ void heap_drop_table(HP_INFO *info)
340341

341342
void hp_free(HP_SHARE *share)
342343
{
343-
if (share->open_list.data) /* If not internal table */
344+
if (!share->internal)
345+
{
344346
heap_share_list= list_delete(heap_share_list, &share->open_list);
347+
thr_lock_delete(&share->lock);
348+
mysql_mutex_destroy(&share->intern_lock);
349+
}
345350
hp_clear(share); /* Remove blocks from memory */
346-
thr_lock_delete(&share->lock);
347-
mysql_mutex_destroy(&share->intern_lock);
348351
my_free(share->name);
349352
my_free(share);
350353
return;

0 commit comments

Comments
 (0)