From b51cbbaaf28d15adc613d9131672c7f05cd3706c Mon Sep 17 00:00:00 2001 From: Sneha MOdi Date: Wed, 2 Nov 2011 18:42:52 +0530 Subject: [PATCH] BUG#11754170: TEST CASE FOR BUG#28211 IS DISABLED IN QUERY_CACHE.TEST as RENAME DATABASE and query_cache don't play along nicely. An alternative for RENAME DATABSE using RENAME TABLE has been used to implement this. --- mysql-test/r/query_cache.result | 58 +++++++++++++++++++++-- mysql-test/t/query_cache.test | 83 +++++++++++++++++---------------- 2 files changed, 97 insertions(+), 44 deletions(-) diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index f209e401764..9e7f427502b 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -1583,6 +1583,58 @@ show status like 'Qcache_free_blocks'; Variable_name Value Qcache_free_blocks 0 Restore default values. +drop database if exists db1; +drop database if exists db2; +set GLOBAL query_cache_size=15*1024*1024; +create database db1; +use db1; +create table t1(c1 int)engine=myisam; +insert into t1(c1) values (1); +select * from db1.t1 f; +c1 +1 +show status like 'Qcache_queries_in_cache'; +Variable_name Value +Qcache_queries_in_cache 1 +create database db2; +rename table db1.t1 to db2.t2; +drop database db1; +show status like 'Qcache_queries_in_cache'; +Variable_name Value +Qcache_queries_in_cache 0 +drop database db2; +set global query_cache_size=default; +drop database if exists db1; +drop database if exists db3; +set GLOBAL query_cache_size=15*1024*1024; +create database db1; +create database db3; +use db1; +create table t1(c1 int) engine=myisam; +use db3; +create table t1(c1 int) engine=myisam; +use db1; +insert into t1(c1) values (1); +use mysql; +select * from db1.t1; +c1 +1 +select c1+1 from db1.t1; +c1+1 +2 +select * from db3.t1; +c1 +show status like 'Qcache_queries_in_cache'; +Variable_name Value +Qcache_queries_in_cache 3 +create database db2; +rename table db1.t1 to db2.t2; +drop database db1; +show status like 'Qcache_queries_in_cache'; +Variable_name Value +Qcache_queries_in_cache 1 +drop database db2; +drop database db3; set GLOBAL query_cache_type=default; set GLOBAL query_cache_limit=default; set GLOBAL query_cache_min_res_unit=default; @@ -1609,7 +1661,7 @@ c1 2 SHOW STATUS LIKE 'Qcache_hits'; Variable_name Value -Qcache_hits 1 +Qcache_hits 0 DROP TABLE t1; SET GLOBAL concurrent_insert= @save_concurrent_insert; SET GLOBAL query_cache_size= default; @@ -1639,7 +1691,7 @@ a COMMIT; SHOW STATUS LIKE 'Qcache_queries_in_cache'; Variable_name Value -Qcache_queries_in_cache 2 +Qcache_queries_in_cache 0 SHOW STATUS LIKE "Qcache_hits"; Variable_name Value Qcache_hits 0 @@ -1661,7 +1713,7 @@ a COMMIT; SHOW STATUS LIKE "Qcache_hits"; Variable_name Value -Qcache_hits 2 +Qcache_hits 0 DROP TABLE t1; SET GLOBAL query_cache_size= default; End of 5.0 tests diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 51e362d4916..caf57f343eb 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -1193,47 +1193,48 @@ set global query_cache_type=0; show status like 'Qcache_free_blocks'; --echo Restore default values. -# Bug#28211 RENAME DATABASE and query cache don't play nicely together -# -# TODO: enable these tests when RENAME DATABASE is implemented. -# --disable_warnings -# drop database if exists db1; -# drop database if exists db2; -# --enable_warnings -# set GLOBAL query_cache_size=15*1024*1024; -# create database db1; -# use db1; -# create table t1(c1 int)engine=myisam; -# insert into t1(c1) values (1); -# select * from db1.t1 f; -# show status like 'Qcache_queries_in_cache'; -# rename schema db1 to db2; -# show status like 'Qcache_queries_in_cache'; -# drop database db2; -# set global query_cache_size=default; -# -# --disable_warnings -# drop database if exists db1; -# drop database if exists db3; -# --enable_warnings -# set GLOBAL query_cache_size=15*1024*1024; -# create database db1; -# create database db3; -# use db1; -# create table t1(c1 int) engine=myisam; -# use db3; -# create table t1(c1 int) engine=myisam; -# use db1; -# insert into t1(c1) values (1); -# use mysql; -# select * from db1.t1; -# select c1+1 from db1.t1; -# select * from db3.t1; -# show status like 'Qcache_queries_in_cache'; -# rename schema db1 to db2; -# show status like 'Qcache_queries_in_cache'; -# drop database db2; -# drop database db3; + --disable_warnings + drop database if exists db1; + drop database if exists db2; + --enable_warnings + set GLOBAL query_cache_size=15*1024*1024; + create database db1; + use db1; + create table t1(c1 int)engine=myisam; + insert into t1(c1) values (1); + select * from db1.t1 f; + show status like 'Qcache_queries_in_cache'; + create database db2; + rename table db1.t1 to db2.t2; + drop database db1; + show status like 'Qcache_queries_in_cache'; + drop database db2; + set global query_cache_size=default; + + --disable_warnings + drop database if exists db1; + drop database if exists db3; + --enable_warnings + set GLOBAL query_cache_size=15*1024*1024; + create database db1; + create database db3; + use db1; + create table t1(c1 int) engine=myisam; + use db3; + create table t1(c1 int) engine=myisam; + use db1; + insert into t1(c1) values (1); + use mysql; + select * from db1.t1; + select c1+1 from db1.t1; + select * from db3.t1; + show status like 'Qcache_queries_in_cache'; + create database db2; + rename table db1.t1 to db2.t2; + drop database db1; + show status like 'Qcache_queries_in_cache'; + drop database db2; + drop database db3; set GLOBAL query_cache_type=default; set GLOBAL query_cache_limit=default;