Commit 05761243 authored by Tres Seaver's avatar Tres Seaver

LP #142667: update _reader to use new cache in _resetCache.

parent eeedb332
What's new in ZODB3 3.4.5?
==========================
Release date: 09-Oct-2008 (internal release for Zope 2.8.10)
Connection
----------
- (3.4.5) Reset ``_cache`` on a connection's ``_reader`` object when
resetting the cache, to prevent reads from the old cache object, e.g.
during Zope2's auto-refresh of products.
(https://bugs.launchpad.net/zodb/+bug/142667).
What's new in ZODB3 3.4.4? What's new in ZODB3 3.4.4?
========================== ==========================
Release date: 14-Jul-2006 (internal release for Zope 2.8.8) Release date: 14-Jul-2006 (internal release for Zope 2.8.8)
......
...@@ -928,6 +928,8 @@ class Connection(ExportImport, object): ...@@ -928,6 +928,8 @@ class Connection(ExportImport, object):
self._invalidated.clear() self._invalidated.clear()
cache_size = self._cache.cache_size cache_size = self._cache.cache_size
self._cache = cache = PickleCache(self, cache_size) self._cache = cache = PickleCache(self, cache_size)
if getattr(self, '_reader', None) is not None:
self._reader._cache = cache
########################################################################## ##########################################################################
# Python protocol # Python protocol
......
...@@ -140,6 +140,14 @@ class ConnectionDotAdd(unittest.TestCase): ...@@ -140,6 +140,14 @@ class ConnectionDotAdd(unittest.TestCase):
self.datamgr.tpc_finish(self.transaction) self.datamgr.tpc_finish(self.transaction)
self.assert_(obj._p_oid not in self.datamgr._storage._stored) self.assert_(obj._p_oid not in self.datamgr._storage._stored)
def check__resetCacheResetsReader(self):
# https://bugs.launchpad.net/zodb/+bug/142667
old_cache = self.datamgr._cache
self.datamgr._resetCache()
new_cache = self.datamgr._cache
self.failIf(new_cache is old_cache)
self.failUnless(self.datamgr._reader._cache is new_cache)
class UserMethodTests(unittest.TestCase): class UserMethodTests(unittest.TestCase):
# add isn't tested here, because there are a bunch of traditional # add isn't tested here, because there are a bunch of traditional
......
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