[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/ LP #142667: ensure that '_reader' uses new cache in .

Tres Seaver tseaver at palladion.com
Thu Oct 9 23:55:08 EDT 2008


Log message for revision 91964:
  LP #142667:  ensure that '_reader' uses new cache in .

Changed:
  U   ZODB/trunk/src/ZODB/Connection.py
  U   ZODB/trunk/src/ZODB/tests/testConnection.py

-=-
Modified: ZODB/trunk/src/ZODB/Connection.py
===================================================================
--- ZODB/trunk/src/ZODB/Connection.py	2008-10-10 03:09:40 UTC (rev 91963)
+++ ZODB/trunk/src/ZODB/Connection.py	2008-10-10 03:55:08 UTC (rev 91964)
@@ -1044,6 +1044,8 @@
         cache_size = self._cache.cache_size
         cache_size_bytes = self._cache.cache_size_bytes
         self._cache = cache = PickleCache(self, cache_size, cache_size_bytes)
+        if getattr(self, '_reader', None) is not None:
+            self._reader._cache = cache
 
     ##########################################################################
     # Python protocol

Modified: ZODB/trunk/src/ZODB/tests/testConnection.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testConnection.py	2008-10-10 03:09:40 UTC (rev 91963)
+++ ZODB/trunk/src/ZODB/tests/testConnection.py	2008-10-10 03:55:08 UTC (rev 91964)
@@ -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