Bug #1898 DROP database invalidates whole query cache
Submitted: 20 Nov 2003 4:41 Modified: 9 Dec 2003 14:20
Reporter: Oleksandr Byelkin
Status: Closed
Category:Server Severity:S3 (Non-critical)
Version:4.0 OS:Any (any)
Assigned to: Oleksandr Byelkin Target Version:

[20 Nov 2003 4:41] Oleksandr Byelkin
Description:
DROP database invalidates whole query cache 

How to repeat:
+ set GLOBAL query_cache_size=1355776; 
+ drop table if exists t1; 
+ drop database if exists mysqltest; 
+ create table t1(a int); 
+ select * from t1; 
+ a 
+ show status like "Qcache_queries_in_cache"; 
+ Variable_name Value 
+ Qcache_queries_in_cache       1 
+ create database mysqltest; 
+ create table mysqltest.t1 (i int not null auto_increment, a int, primary key 
(i)); 
+ select * from mysqltest.t1; 
+ i     a 
+ show status like "Qcache_queries_in_cache"; 
+ Variable_name Value 
+ Qcache_queries_in_cache       2 
+ drop database mysqltest; 
+ show status like "Qcache_queries_in_cache"; 
+ Variable_name Value 
+ Qcache_queries_in_cache       0 
+ drop table t1; 
+ set GLOBAL query_cache_size=0; 
 

Suggested fix:
fix Query_cache::invalidate(char *db)
[20 Nov 2003 9:26] Oleksandr Byelkin
ChangeSet 
  1.1623 03/11/20 18:12:49 bell@sanja.is.com.ua +3 -0 
  database invalidation invalidate queries only of given database (BUG#1898)