diff options
author | unknown <jimw@mysql.com> | 2005-03-31 19:17:45 -0800 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-03-31 19:17:45 -0800 |
commit | e7332e64ca5ef7208846488935a2249285212f91 (patch) | |
tree | 046d9ad3bbf129292636ad08e19e842f8417d8a0 /mysql-test/t/query_cache.test | |
parent | ab77d7d7633a2cff057b17ec43233d4f0d0b0822 (diff) | |
download | mariadb-git-e7332e64ca5ef7208846488935a2249285212f91.tar.gz |
Fix crash in embedded server due to incorrect storage of results
in the query cache. (Bug #9549)
libmysqld/emb_qcache.h:
Fix Querycache_stream::use_next_block() to actually use the next
block and mark blocks as used when it writes to them.
mysql-test/r/query_cache.result:
Update results.
mysql-test/t/query_cache.test:
Add new regression test.
libmysqld/emb_qcache.cc:
Fix calls to use_next_block() to indicate whether we are writing
to the next block or not.
sql/sql_cache.cc:
Initialize the first block properly when storing a result in
the embedded server.
Diffstat (limited to 'mysql-test/t/query_cache.test')
-rw-r--r-- | mysql-test/t/query_cache.test | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index b0148a689af..b287e71d6ae 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -684,4 +684,49 @@ repair table t1; show status like 'qcache_queries_in_cache'; drop table t1; +# Bug #9549: Make sure cached queries that span more than one cache block +# are handled properly in the embedded server. + +# We just want a small query cache, so we can fragment it easily +set GLOBAL query_cache_size=64*1024; +# This actually gives us a usable cache size of about 48K + +# Each table is about 14K +create table t1 (a text); +insert into t1 values (repeat('abcdefghijklmnopqrstuvwxyz', 550)); +create table t2 (a text); +insert into t2 values (repeat('ijklmnopqrstuvwxyzabcdefgh', 550)); + +# Load a query from each table into the query cache +--disable_result_log +select a from t1; # Q1 +select a from t2; # Q2 +--enable_result_log +show status like 'Qcache_%_blocks'; + +# Now the cache looks like (14K for Q1)(14K for Q2)(20K free) + +# Flush Q1 from the cache by adding an out-of-order chunk to t1 +insert into t1 select reverse(a) from t1; +show status like 'Qcache_%_blocks'; + +# Now the cache looks like (14K free)(14K for Q2)(20K free) + +# Load our new data into the query cache +--disable_result_log +select a from t1; # Q3 +--enable_result_log +show status like 'Qcache_%_blocks'; + +# Now the cache should be like (14K for Q3)(14K for Q2)(14K for Q3)(6K free) + +# Note that Q3 is split across two chunks! + +# Load Q3 from the cache, and actually pay attention to the results +select a from t1; + +flush query cache; + +drop table t1, t2; + set GLOBAL query_cache_size=0; |