Commit 305ac133 authored by Jim Fulton's avatar Jim Fulton

Fixed a bug in ZEO client cache simulation that caused invalidations

to be misshandled, causing incorrect statistics and errors.
parent 7a078128
......@@ -25,6 +25,9 @@ Bugs Fixed
don't send invalidations. There's no reason to send them when an
external garbage collector is used.
- ZEO client cache simulation misshandled invalidations
causing incorrect statistics and errors.
3.10.0 (2010-10-08)
===================
......
......@@ -252,6 +252,8 @@ class Simulation(object):
nreports = 0
def report(self):
if not hasattr(self, 'ts1'):
return
self.nreports += 1
args = (ctime(self.ts0)[4:-8],
duration(self.ts1 - self.ts0),
......@@ -417,6 +419,9 @@ class CircularCacheSimulation(Simulation):
# about this oid.
self._remove_noncurrent_revisions(oid)
if oid in self.evicted:
del self.evicted[oid]
cur_tid = self.current.get(oid)
if cur_tid is None:
# We don't have current data, so nothing more to do.
......
......@@ -1028,6 +1028,36 @@ Cleanup:
"""
def cache_simul_properly_handles_load_miss_after_eviction_and_inval():
r"""
Set up evicted and then invalidated oid
>>> os.environ["ZEO_CACHE_TRACE"] = 'yes'
>>> cache = ZEO.cache.ClientCache('cache', 1<<21)
>>> cache.store(p64(1), p64(1), None, 'x')
>>> for i in range(10):
... cache.store(p64(2+i), p64(1), None, 'x'*(1<<19)) # Evict 1
>>> cache.store(p64(1), p64(1), None, 'x')
>>> cache.invalidate(p64(1), p64(2))
>>> cache.load(p64(1))
>>> cache.close()
Now try to do simulation:
>>> import ZEO.scripts.cache_simul
>>> ZEO.scripts.cache_simul.main('-s 1 cache.trace'.split())
... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
CircularCacheSimulation, cache size 1,048,576 bytes
START TIME DUR. LOADS HITS INVALS WRITES HITRATE EVICTS INUSE
... 0 1 0 1 12 0.0% 10 50.0
--------------------------------------------------------------------------
... 0 1 0 1 12 0.0% 10 50.0
>>> del os.environ["ZEO_CACHE_TRACE"]
"""
def invalidations_with_current_tid_dont_wreck_cache():
"""
>>> cache = ZEO.cache.ClientCache('cache', 1000)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment