diff options
author | unknown <thek@adventure.(none)> | 2007-06-18 17:46:29 +0200 |
---|---|---|
committer | unknown <thek@adventure.(none)> | 2007-06-18 17:46:29 +0200 |
commit | b9dc6ad7abb8daaf57ff009d3e11fbd96e0d95ea (patch) | |
tree | 427d3838911bfff0059a0a7616998356f48b4a93 /mysql-test/r/query_cache.result | |
parent | ad4da53510fe17b7b20912753232719fd8d3e033 (diff) | |
download | mariadb-git-b9dc6ad7abb8daaf57ff009d3e11fbd96e0d95ea.tar.gz |
Bug#28211 RENAME DATABASE and query cache don't play nicely together
When all table blocks were removed from the query cache the client session
hung in a tight loop waiting on an impossible condition while consuming a lot
of CPU.
This patch also corrects an error which caused valid tables to sometimes be
removed from the query cache.
mysql-test/r/query_cache.result:
Added test case to make sure server doesn't hang in a tight loop if last
table block is removed from the cache.
mysql-test/t/query_cache.test:
Added test case to make sure server doesn't hang in a tight loop if last
table block is removed from the cache.
sql/sql_cache.cc:
- Refactored loop over table blocks. The invalidate_table() function effects
the elements over which we iterate. The previous stop condition was broken
due to a compiler optimization error probably caused by the goto-statement
pointing out of the loop. The effect being that tables_blocks was never
checked for null values and thus the loop never terminated.
- The new implementation uses two while loops instead of a goto-statement.
The tables_blocks is a circular list which becomes null if the last table
block is removed from the list.
Diffstat (limited to 'mysql-test/r/query_cache.result')
-rw-r--r-- | mysql-test/r/query_cache.result | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 64d32ba334c..287ccd3e048 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -1437,3 +1437,51 @@ set GLOBAL query_cache_type=default; set GLOBAL query_cache_limit=default; set GLOBAL query_cache_min_res_unit=default; set GLOBAL query_cache_size= default; +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 +rename schema db1 to db2; +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 +rename schema db1 to db2; +show status like 'Qcache_queries_in_cache'; +Variable_name Value +Qcache_queries_in_cache 1 +drop database db2; +drop database db3; |