diff options
| author | Davi Arnaut <davi.arnaut@oracle.com> | 2010-10-08 09:16:20 -0300 |
|---|---|---|
| committer | Davi Arnaut <davi.arnaut@oracle.com> | 2010-10-08 09:16:20 -0300 |
| commit | 657b157511d70d77da79920a29befbd9edb96898 (patch) | |
| tree | f3b1c0750f4c6f092874c062ab7a0a8352089f0a /sql/sql_cache.cc | |
| parent | 921fd5297510a063e90aa813f6a0273b90e72b2d (diff) | |
| download | mariadb-git-657b157511d70d77da79920a29befbd9edb96898.tar.gz | |
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.
Diffstat (limited to 'sql/sql_cache.cc')
| -rw-r--r-- | sql/sql_cache.cc | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 8c3abdbf1b0..9876c46bbb3 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -385,6 +385,22 @@ TODO list: /** + 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) |
