mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug#56822: Add a thread state for sessions waiting on the query cache lock
Only wait for a single debug signal at a time as the signal state is global. Also, do not activate the query cache debug sync points if the thread has no associated THD session.
This commit is contained in:
@ -384,6 +384,22 @@ TODO list:
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
Macro that executes the requested action at a synchronization point
|
||||
only if the thread has a associated THD session.
|
||||
*/
|
||||
#if defined(ENABLED_DEBUG_SYNC)
|
||||
#define QC_DEBUG_SYNC(name) \
|
||||
do { \
|
||||
THD *thd= current_thd; \
|
||||
if (thd) \
|
||||
DEBUG_SYNC(thd, name); \
|
||||
} while (0)
|
||||
#else
|
||||
#define QC_DEBUG_SYNC(name)
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
Thread state to be used when the query cache lock needs to be acquired.
|
||||
Sets the thread state name in the constructor, resets on destructor.
|
||||
@ -879,7 +895,7 @@ Query_cache::insert(Query_cache_tls *query_cache_tls,
|
||||
if (is_disabled() || query_cache_tls->first_query_block == NULL)
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
DEBUG_SYNC(current_thd, "wait_in_query_cache_insert");
|
||||
QC_DEBUG_SYNC("wait_in_query_cache_insert");
|
||||
|
||||
if (try_lock())
|
||||
DBUG_VOID_RETURN;
|
||||
@ -1975,7 +1991,7 @@ void Query_cache::flush()
|
||||
if (is_disabled())
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
DEBUG_SYNC(current_thd, "wait_in_query_cache_flush1");
|
||||
QC_DEBUG_SYNC("wait_in_query_cache_flush1");
|
||||
|
||||
lock_and_suspend();
|
||||
if (query_cache_size > 0)
|
||||
@ -2315,7 +2331,7 @@ void Query_cache::free_cache()
|
||||
|
||||
void Query_cache::flush_cache()
|
||||
{
|
||||
DEBUG_SYNC(current_thd, "wait_in_query_cache_flush2");
|
||||
QC_DEBUG_SYNC("wait_in_query_cache_flush2");
|
||||
|
||||
my_hash_reset(&queries);
|
||||
while (queries_blocks != 0)
|
||||
|
Reference in New Issue
Block a user