mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
- 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
This commit is contained in:
committed by
Nirbhay Choubey
parent
17ac959716
commit
235bebe02e
@ -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 */
|
||||
|
||||
|
Reference in New Issue
Block a user