summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
diff options
context:
space:
mode:
authorbell@sanja.is.com.ua <>2004-03-04 18:32:55 +0200
committerbell@sanja.is.com.ua <>2004-03-04 18:32:55 +0200
commitd03034d3062f528266ac4853ab2f2ba17f01dfdb (patch)
treef122123efc8dd764d21d073a89045021aecd2992 /sql/sql_cache.cc
parentf8345cc6171edd0cbe78900975b16ed8d77f67d3 (diff)
downloadmariadb-git-d03034d3062f528266ac4853ab2f2ba17f01dfdb.tar.gz
invalidation of locking for write tables (BUG#2693)
fixed linking query_prealloc_size to query cache presence
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r--sql/sql_cache.cc31
1 files changed, 31 insertions, 0 deletions
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
*/