[Zodb-checkins] SVN: ZODB/branches/3.8/ Reset ``_cache`` on a connection's ``_reader`` object when resetting the cache
Tres Seaver
tseaver at palladion.com
Fri Oct 10 11:20:33 EDT 2008
Log message for revision 91987:
Reset ``_cache`` on a connection's ``_reader`` object when resetting the cache
- This change prevent reads from the old cache object, e.g. during Zope2's
auto-refresh of products. (https://bugs.launchpad.net/zodb/+bug/142667).
Changed:
U ZODB/branches/3.8/NEWS.txt
U ZODB/branches/3.8/src/ZODB/Connection.py
U ZODB/branches/3.8/src/ZODB/tests/testConnection.py
-=-
Modified: ZODB/branches/3.8/NEWS.txt
===================================================================
--- ZODB/branches/3.8/NEWS.txt 2008-10-10 15:08:47 UTC (rev 91986)
+++ ZODB/branches/3.8/NEWS.txt 2008-10-10 15:20:32 UTC (rev 91987)
@@ -4,6 +4,11 @@
Bugs Fixed:
+- (3.8.1) 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).
+
- (beta 9) An exception would be raised when an error occured attempting to
lock a file and logging of said error was enabled.
Modified: ZODB/branches/3.8/src/ZODB/Connection.py
===================================================================
--- ZODB/branches/3.8/src/ZODB/Connection.py 2008-10-10 15:08:47 UTC (rev 91986)
+++ ZODB/branches/3.8/src/ZODB/Connection.py 2008-10-10 15:20:32 UTC (rev 91987)
@@ -1027,7 +1027,7 @@
self._invalidated.clear()
self._invalidatedCache = False
cache_size = self._cache.cache_size
- self._cache = cache = PickleCache(self, cache_size)
+ self._reader._cache = self._cache = PickleCache(self, cache_size)
##########################################################################
# Python protocol
Modified: ZODB/branches/3.8/src/ZODB/tests/testConnection.py
===================================================================
--- ZODB/branches/3.8/src/ZODB/tests/testConnection.py 2008-10-10 15:08:47 UTC (rev 91986)
+++ ZODB/branches/3.8/src/ZODB/tests/testConnection.py 2008-10-10 15:20:32 UTC (rev 91987)
@@ -140,6 +140,14 @@
self.datamgr.tpc_finish(self.transaction)
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):
# add isn't tested here, because there are a bunch of traditional
More information about the Zodb-checkins
mailing list