Commit 3e17193a authored by unknown's avatar unknown
Browse files

Bug#16795 ndb_cache_multi2

 - 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.
parent 8c1c10dc
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -64,13 +64,10 @@ a
3
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	2
Qcache_queries_in_cache	3
show status like "Qcache_inserts";
Variable_name	Value
Qcache_inserts	3
show status like "Qcache_hits";
Variable_name	Value
Qcache_hits	0
Qcache_inserts	4
drop table t1, t2;
set GLOBAL query_cache_size=0;
set GLOBAL ndb_cache_check_time=0;
+19 −8
Original line number Diff line number Diff line
@@ -24,10 +24,6 @@ set GLOBAL ndb_cache_check_time=1;
reset query cache;
flush status;

# Sleep so that the query cache check thread has time to start
sleep 15;


# Create test tables in NDB and load them into cache
# on server1
connection server1;
@@ -53,19 +49,34 @@ show status like "Qcache_inserts";
show status like "Qcache_hits";
update t1 set a=3 where a=2;

# Sleep so that the query cache check thread has time to run
sleep 5;

# 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";
show status like "Qcache_hits";

drop table t1, t2;