diff options
author | Daniele Sciascia <daniele.sciascia@galeracluster.com> | 2015-10-22 17:30:20 +0200 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2016-02-22 22:10:51 -0500 |
commit | 235bebe02ee74154a5782326d7a4d624ec55c07b (patch) | |
tree | 560802ead26635f4321be64714f84c6d7cc84c01 /sql/sql_cache.cc | |
parent | 17ac9597163916d418c6cca2641242f20d682956 (diff) | |
download | mariadb-git-235bebe02ee74154a5782326d7a4d624ec55c07b.tar.gz |
refs codership/mysql-wsrep#201
- Eliminates code duplication in query cache patch
- Reduces the number of iterations in mysql-wsrep#201.test
to shorten the execution time
- Adds a new test case that exercises more scenarios
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r-- | sql/sql_cache.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 6a0f811d3a2..2e9e90346fb 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1846,7 +1846,6 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length) goto err; } } - /* Try to obtain an exclusive lock on the query cache. If the cache is disabled or if a full cache flush is in progress, the attempt to @@ -1946,6 +1945,13 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d", (int)flags.autocommit)); memcpy((uchar *)(sql + (tot_length - QUERY_CACHE_FLAGS_SIZE)), (uchar*) &flags, QUERY_CACHE_FLAGS_SIZE); + +#ifdef WITH_WSREP + bool once_more; + once_more= true; +lookup: +#endif /* WITH_WSREP */ + query_block = (Query_cache_block *) my_hash_search(&queries, (uchar*) sql, tot_length); /* Quick abort on unlocked data */ @@ -1959,21 +1965,15 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d", DBUG_PRINT("qcache", ("Query in query hash 0x%lx", (ulong)query_block)); #ifdef WITH_WSREP - if (WSREP_CLIENT(thd) && wsrep_must_sync_wait(thd)) { + if (once_more && WSREP_CLIENT(thd) && wsrep_must_sync_wait(thd)) + { unlock(); if (wsrep_sync_wait(thd)) goto err; if (try_lock(thd, Query_cache::TIMEOUT)) goto err; - query_block = (Query_cache_block *) my_hash_search(&queries, - (uchar*) sql, - tot_length); - if (query_block == 0 || - query_block->query()->result() == 0 || - query_block->query()->result()->type != Query_cache_block::RESULT) - { - goto err_unlock; - } + once_more= false; + goto lookup; } #endif /* WITH_WSREP */ |