mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 21:12:26 +01:00
3e17193aa3
- remove timing dependent part of test, wait until condition occurs or sleep max 10 seconds mysql-test/r/ndb_cache_multi2.result: Update test results mysql-test/t/ndb_cache_multi2.test: Convert long sleeps to a while leep whith small sleeps and a check if condition has occured. This allows slower machines to sleep longer if needed.
93 lines
2.4 KiB
Text
93 lines
2.4 KiB
Text
-- source include/have_query_cache.inc
|
|
-- source include/have_ndb.inc
|
|
-- source include/have_multi_ndb.inc
|
|
-- source include/not_embedded.inc
|
|
|
|
--disable_warnings
|
|
drop table if exists t1, t2;
|
|
--enable_warnings
|
|
|
|
|
|
# Turn on and reset query cache on server1
|
|
connection server1;
|
|
set GLOBAL query_cache_type=on;
|
|
set GLOBAL query_cache_size=1355776;
|
|
set GLOBAL ndb_cache_check_time=1;
|
|
reset query cache;
|
|
flush status;
|
|
|
|
# Turn on and reset query cache on server2
|
|
connection server2;
|
|
set GLOBAL query_cache_type=on;
|
|
set GLOBAL query_cache_size=1355776;
|
|
set GLOBAL ndb_cache_check_time=1;
|
|
reset query cache;
|
|
flush status;
|
|
|
|
# Create test tables in NDB and load them into cache
|
|
# on server1
|
|
connection server1;
|
|
create table t1 (a int) engine=ndbcluster;
|
|
create table t2 (a int) engine=ndbcluster;
|
|
insert into t1 value (2);
|
|
insert into t2 value (3);
|
|
select * from t1;
|
|
select * from t2;
|
|
show status like "Qcache_queries_in_cache";
|
|
show status like "Qcache_inserts";
|
|
show status like "Qcache_hits";
|
|
|
|
|
|
# Connect server2, load table in to cache, then update the table
|
|
connection server2;
|
|
show status like "Qcache_queries_in_cache";
|
|
show status like "Qcache_inserts";
|
|
show status like "Qcache_hits";
|
|
select * from t1;
|
|
show status like "Qcache_queries_in_cache";
|
|
show status like "Qcache_inserts";
|
|
show status like "Qcache_hits";
|
|
update t1 set a=3 where a=2;
|
|
|
|
# Connect to server1 and check that cache is invalidated
|
|
# and correct data is returned
|
|
connection server1;
|
|
show status like "Qcache_queries_in_cache";
|
|
show status like "Qcache_inserts";
|
|
show status like "Qcache_hits";
|
|
|
|
# Loop and wait for max 10 seconds until query cache thread
|
|
# has invalidated the cache and the column a in t1 is equal to 3
|
|
let $retries=20;
|
|
while (`select a != 3 from t1`)
|
|
{
|
|
dec $retries;
|
|
if (!$retries)
|
|
{
|
|
The query_cache thread failed to invalidate query_cache in 10 seconds;
|
|
}
|
|
sleep 0.5;
|
|
}
|
|
|
|
# Select from t1 one last time for the result file
|
|
# Column a should be 3
|
|
select * from t1;
|
|
|
|
# There should now be three queries in the cache
|
|
show status like "Qcache_queries_in_cache";
|
|
# And inserts should be four
|
|
show status like "Qcache_inserts";
|
|
|
|
drop table t1, t2;
|
|
|
|
# Turn off and reset query cache on server1 and server2
|
|
connection server1;
|
|
set GLOBAL query_cache_size=0;
|
|
set GLOBAL ndb_cache_check_time=0;
|
|
reset query cache;
|
|
flush status;
|
|
connection server2;
|
|
set GLOBAL query_cache_size=0;
|
|
set GLOBAL ndb_cache_check_time=0;
|
|
reset query cache;
|
|
flush status;
|