[Checkins] SVN: ZODB/trunk/ Fixed bug 98275: Made ZEO cache more tolerant when invalidating current object

Christian Theune ct at gocept.com
Mon Dec 3 08:26:58 EST 2007


Log message for revision 82095:
  Fixed bug 98275: Made ZEO cache more tolerant when invalidating current object
  versions.
  

Changed:
  U   ZODB/trunk/NEWS.txt
  U   ZODB/trunk/src/ZEO/cache.py
  U   ZODB/trunk/src/ZEO/tests/testZEO.py

-=-
Modified: ZODB/trunk/NEWS.txt
===================================================================
--- ZODB/trunk/NEWS.txt	2007-12-03 12:27:13 UTC (rev 82094)
+++ ZODB/trunk/NEWS.txt	2007-12-03 13:26:58 UTC (rev 82095)
@@ -40,6 +40,9 @@
 ZEO
 ---
 
+- (3.9.0a1) Bug #98275: Made ZEO cache more tolerant when invalidating current
+  versions of objects.
+
 - (3.9.0a1) Fixed a serious bug that could cause client I/O to stop
   (hang). This was accomonied by a critical log message along the
   lines of: "RuntimeError: dictionary changed size during iteration".

Modified: ZODB/trunk/src/ZEO/cache.py
===================================================================
--- ZODB/trunk/src/ZEO/cache.py	2007-12-03 12:27:13 UTC (rev 82094)
+++ ZODB/trunk/src/ZEO/cache.py	2007-12-03 13:26:58 UTC (rev 82095)
@@ -364,7 +364,7 @@
             return
 
         # Add the data we have to the list of non-current data for oid.
-        assert tid is not None and cur_tid < tid
+        assert tid is not None and cur_tid <= tid
         # 0x1C = invalidate (hit, saving non-current)
         self._trace(0x1C, oid, version, tid)
         del self.current[oid]   # because we no longer have current data

Modified: ZODB/trunk/src/ZEO/tests/testZEO.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/testZEO.py	2007-12-03 12:27:13 UTC (rev 82094)
+++ ZODB/trunk/src/ZEO/tests/testZEO.py	2007-12-03 13:26:58 UTC (rev 82095)
@@ -34,6 +34,8 @@
 import ZODB.tests.util
 from ZODB.tests.MinPO import MinPO
 from ZODB.tests.StorageTestBase import zodb_unpickle
+import persistent
+import transaction
 
 # ZODB test mixin classes
 from ZODB.tests import StorageTestBase, BasicStorage, VersionStorage, \
@@ -67,9 +69,34 @@
         # be identical.
         self.assertEqual(ZODB.__version__, ZEO.version)
 
+
+class CreativeGetState(persistent.Persistent):
+    def __getstate__(self):
+        self.name = 'me'
+        return super(CreativeGetState, self).__getstate__()
+
+
 class MiscZEOTests:
     """ZEO tests that don't fit in elsewhere."""
 
+    def checkCreativeGetState(self):
+        # This test covers persistent objects that provide their own 
+        # __getstate__ which modifies the state of the object.
+        # For details see bug #98275
+
+        db = ZODB.DB(self._storage)
+        cn = db.open()
+        rt = cn.root()
+        m = CreativeGetState()
+        m.attr = 'hi'
+        rt['a'] = m
+
+        # This commit used to fail because of the `Mine` object being put back
+        # into `changed` state although it was already stored causing the ZEO
+        # cache to bail out.
+        transaction.commit()
+        cn.close()
+
     def checkLargeUpdate(self):
         obj = MinPO("X" * (10 * 128 * 1024))
         self._dostore(data=obj)



More information about the Checkins mailing list