summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-06-11 22:12:47 -0700
committerIgor Babaev <igor@askmonty.org>2012-06-11 22:12:47 -0700
commit7b32d88c05756a37b15e7f11f4cd83fec25f42e2 (patch)
treed8463d63a4abcc99d560cc1897ae396c54c82d9f /include
parent41d860ef53e4461fa665da063fa34efb947ec4cd (diff)
downloadmariadb-git-7b32d88c05756a37b15e7f11f4cd83fec25f42e2.tar.gz
Fixed LP bug #1008293.
One of the reported problems manifested itself in the scenario when one thread tried to to get statistics on a key cache while the second thread had not finished initialization of the key cache structure yet. The problem was resolved by forcing serialization of such operations on key caches. To serialize function calls to perform certain operations over a key cache a new mutex associated with the key cache now is used. It is stored in the field op_lock of the KEY_CACHE structure. It is locked when the operation is performed. Some of the serialized key cache operations utilize calls for other key cache operations. To avoid recursive locking of op_lock the new functions that perform the operations of key cache initialization, destruction and re-partitioning with an additional parameter were introduced. The parameter says whether the operation over op_lock are to be performed or are to be omitted. The old functions for the operations of key cache initialization, destruction,and re-partitioning now just call the corresponding new functions with the additional parameter set to true requesting to use op_lock while all other calls of these new function have this parameter set to false. Another problem reported in the bug entry concerned the operation of assigning an index to a key cache. This operation can be called while the key cache structures are not initialized yet. In this case any call of flush_key_blocks() should return without any actions. No test case is provided with this patch.
Diffstat (limited to 'include')
-rw-r--r--include/keycache.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/keycache.h b/include/keycache.h
index 12338037ea1..c19fa5988f8 100644
--- a/include/keycache.h
+++ b/include/keycache.h
@@ -150,9 +150,10 @@ typedef struct st_key_cache
ulong param_partitions; /* number of the key cache partitions */
my_bool key_cache_inited; /* <=> key cache has been created */
my_bool can_be_used; /* usage of cache for read/write is allowed */
- my_bool in_init; /* Set to 1 in MySQL during init/resize */
+ my_bool in_init; /* set to 1 in MySQL during init/resize */
uint partitions; /* actual number of partitions */
size_t key_cache_mem_size; /* specified size of the cache memory */
+ pthread_mutex_t op_lock; /* to serialize operations like 'resize' */
} KEY_CACHE;