• Igor Babaev's avatar
    Fixed LP bug #1008293. · 7b32d88c
    Igor Babaev authored
    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.
    7b32d88c
keycache.h 8.26 KB