From a2e4449bfc8f0e4a1dcde20fb2545a4d41f794d9 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 19 Feb 2009 18:09:35 -0300 Subject: Bug#41098: Query Cache returns wrong result with concurrent insert The problem is that select queries executed concurrently with a concurrent insert on a MyISAM table could be cached if the select started after the query cache invalidation but before the unlock of tables performed by the concurrent insert. This race could happen because the concurrent insert was failing to prevent cache of select queries happening at the same time. The solution is to add a 'uncacheable' status flag to signal that a concurrent insert is being performed on the table and that queries executing at the same time shouldn't cache the results. --- sql/sql_cache.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sql/sql_cache.cc') diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 7c97ee4cf32..4a5b75c4f78 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1518,6 +1518,9 @@ void Query_cache::invalidate(THD *thd, TABLE_LIST *tables_used, invalidate_table(thd, tables_used); } + DBUG_EXECUTE_IF("wait_after_query_cache_invalidate", + debug_wait_for_kill("wait_after_query_cache_invalidate");); + DBUG_VOID_RETURN; } -- cgit v1.2.1