From d4f43e511ceb9a9f010f2a504a735699a8872b9b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Mar 2004 18:32:55 +0200 Subject: invalidation of locking for write tables (BUG#2693) fixed linking query_prealloc_size to query cache presence mysql-test/r/query_cache.result: test of QC invalidation by LOCK command mysql-test/t/query_cache.test: test of QC invalidation by LOCK command sql/mysqld.cc: new variable query_cache_wlock_invalidate fixed query_prealloc_size with QC absence sql/set_var.cc: new variable query_cache_wlock_invalidate sql/sql_cache.cc: new method for table invalidation sql/sql_cache.h: new method for table invalidation sql/sql_class.h: new variable query_cache_wlock_invalidate sql/sql_parse.cc: layout fixed --- sql/sql_cache.cc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'sql/sql_cache.cc') diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 63d4e4222b4..77bdcb79a8d 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1090,6 +1090,37 @@ void Query_cache::invalidate(CHANGED_TABLE_LIST *tables_used) DBUG_VOID_RETURN; } + +/* + Invalidate locked for write + + SYNOPSIS + Query_cache::invalidate_locked_for_write() + tables_used - table list + + NOTE + can be used only for opened tables +*/ +void Query_cache::invalidate_locked_for_write(TABLE_LIST *tables_used) +{ + DBUG_ENTER("Query_cache::invalidate (changed table list)"); + if (query_cache_size > 0 && tables_used) + { + STRUCT_LOCK(&structure_guard_mutex); + if (query_cache_size > 0) + { + DUMP(this); + for (; tables_used; tables_used= tables_used->next) + { + if (tables_used->lock_type & (TL_WRITE_LOW_PRIORITY | TL_WRITE)) + invalidate_table(tables_used->table); + } + } + STRUCT_UNLOCK(&structure_guard_mutex); + } + DBUG_VOID_RETURN; +} + /* Remove all cached queries that uses the given table */ -- cgit v1.2.1