Fix ndb_cache* test failures in the -runtime tree.
Do not try to acquire structure_guard_mutex for the second time when invalidating a table from send_result_to_client. sql/sql_cache.cc: Do not try to acquire mutex when invalidating a table from send_result_to_client(). A follow up patch for the patch for Bug#21074. Reuse code by moving locking-independent invalidation functionality into invalidate_table_internal. sql/sql_cache.h: Add a new declaration.
This commit is contained in:
parent
146b0e1475
commit
b6c0fb605d
@ -1347,7 +1347,9 @@ def_week_frmt: %lu",
|
||||
("Handler require invalidation queries of %s.%s %lu-%lu",
|
||||
table_list.db, table_list.alias,
|
||||
(ulong) engine_data, (ulong) table->engine_data()));
|
||||
invalidate_table(thd, (uchar *) table->db(), table->key_length());
|
||||
invalidate_table_internal(thd,
|
||||
(uchar *) table->db(),
|
||||
table->key_length());
|
||||
}
|
||||
else
|
||||
thd->lex->safe_to_cache_query= 0; // Don't try to cache this
|
||||
@ -2468,13 +2470,8 @@ void Query_cache::invalidate_table(THD *thd, uchar * key, uint32 key_length)
|
||||
m_cache_status= Query_cache::TABLE_FLUSH_IN_PROGRESS;
|
||||
STRUCT_UNLOCK(&structure_guard_mutex);
|
||||
|
||||
Query_cache_block *table_block=
|
||||
(Query_cache_block*)hash_search(&tables, key, key_length);
|
||||
if (query_cache_size > 0 && table_block)
|
||||
{
|
||||
Query_cache_block_table *list_root= table_block->table(0);
|
||||
invalidate_query_block_list(thd, list_root);
|
||||
}
|
||||
if (query_cache_size > 0)
|
||||
invalidate_table_internal(thd, key, key_length);
|
||||
|
||||
STRUCT_LOCK(&structure_guard_mutex);
|
||||
m_cache_status= Query_cache::NO_FLUSH_IN_PROGRESS;
|
||||
@ -2488,6 +2485,26 @@ void Query_cache::invalidate_table(THD *thd, uchar * key, uint32 key_length)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Try to locate and invalidate a table by name.
|
||||
The caller must ensure that no other thread is trying to work with
|
||||
the query cache when this function is executed.
|
||||
|
||||
@pre structure_guard_mutex is acquired or TABLE_FLUSH_IN_PROGRESS is set.
|
||||
*/
|
||||
|
||||
void
|
||||
Query_cache::invalidate_table_internal(THD *thd, uchar *key, uint32 key_length)
|
||||
{
|
||||
Query_cache_block *table_block=
|
||||
(Query_cache_block*)hash_search(&tables, key, key_length);
|
||||
if (table_block)
|
||||
{
|
||||
Query_cache_block_table *list_root= table_block->table(0);
|
||||
invalidate_query_block_list(thd, list_root);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Invalidate a linked list of query cache blocks.
|
||||
|
||||
|
@ -279,6 +279,7 @@ private:
|
||||
Cache_status m_cache_status;
|
||||
|
||||
void free_query_internal(Query_cache_block *point);
|
||||
void invalidate_table_internal(THD *thd, uchar *key, uint32 key_length);
|
||||
|
||||
protected:
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user