Skip to content

Commit 58ee0e2

Browse files
author
Dmitry Lenev
committed
WL#8356 "Improve scalability by not acquiring unnecessary locks for internal temp tables".
Follow-up for the patch removing initialization of THR_LOCK and THR_LOCK_DATA structs for internal temporary Heap tables. Remove HP_SHARE::intern_lock mutex which was not used for anything.
1 parent 3c1593d commit 58ee0e2

File tree

4 files changed

+8
-25
lines changed

4 files changed

+8
-25
lines changed

include/heap.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ typedef struct st_heap_share
149149
char * name; /* Name of "memory-file" */
150150
time_t create_time;
151151
THR_LOCK lock;
152-
mysql_mutex_t intern_lock; /* Locking for use with _locking */
153152
my_bool delete_on_close;
154153
LIST open_list;
155154
uint auto_key;

storage/heap/heapdef.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ extern PSI_memory_key hp_key_memory_HP_PTRS;
111111
extern PSI_memory_key hp_key_memory_HP_KEYDEF;
112112

113113
#ifdef HAVE_PSI_INTERFACE
114-
extern PSI_mutex_key hp_key_mutex_HP_SHARE_intern_lock;
115114

116115
void init_heap_psi_keys();
117116
#endif /* HAVE_PSI_INTERFACE */

storage/heap/hp_create.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,14 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info,
195195
my_free(share);
196196
goto err;
197197
}
198-
/*
199-
Do not initialize THR_LOCK object for internal temporary tables.
200-
It is not needed for such tables. Calling thr_lock_init() can
201-
cause scalability issues since it acquires global lock.
202-
*/
203-
if (!create_info->internal_table)
204-
thr_lock_init(&share->lock);
205-
mysql_mutex_init(hp_key_mutex_HP_SHARE_intern_lock,
206-
&share->intern_lock, MY_MUTEX_INIT_FAST);
207198
if (!create_info->internal_table)
208199
{
200+
/*
201+
Do not initialize THR_LOCK object for internal temporary tables.
202+
It is not needed for such tables. Calling thr_lock_init() can
203+
cause scalability issues since it acquires global lock.
204+
*/
205+
thr_lock_init(&share->lock);
209206
share->open_list.data= (void*) share;
210207
heap_share_list= list_add(heap_share_list,&share->open_list);
211208
}
@@ -311,7 +308,6 @@ void hp_free(HP_SHARE *share)
311308
hp_clear(share); /* Remove blocks from memory */
312309
if (not_internal_table)
313310
thr_lock_delete(&share->lock);
314-
mysql_mutex_destroy(&share->intern_lock);
315311
my_free(share->name);
316312
my_free(share);
317313
return;

storage/heap/hp_static.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -30,16 +30,6 @@ PSI_memory_key hp_key_memory_HP_PTRS;
3030
PSI_memory_key hp_key_memory_HP_KEYDEF;
3131

3232
#ifdef HAVE_PSI_INTERFACE
33-
PSI_mutex_key hp_key_mutex_HP_SHARE_intern_lock;
34-
35-
static PSI_mutex_info all_heap_mutexes[]=
36-
{
37-
{ & hp_key_mutex_HP_SHARE_intern_lock, "HP_SHARE::intern_lock", 0}
38-
/*
39-
Note:
40-
THR_LOCK_heap is part of mysys, not storage/heap.
41-
*/
42-
};
4333

4434
static PSI_memory_info all_heap_memory[]=
4535
{
@@ -54,8 +44,7 @@ void init_heap_psi_keys()
5444
const char* category= "memory";
5545
int count;
5646

57-
count= array_elements(all_heap_mutexes);
58-
mysql_mutex_register(category, all_heap_mutexes, count);
47+
/* Note: THR_LOCK_heap is part of mysys, not storage/heap. */
5948

6049
count= array_elements(all_heap_memory);
6150
mysql_memory_register(category, all_heap_memory, count);

0 commit comments

Comments
 (0)