[Zodb-checkins] SVN: ZODB/branches/jim-3.8-connection/src/ZEO/ Add
check for increasing tids, (rather than just ignoring out-of-order
Jim Fulton
jim at zope.com
Fri Jul 11 17:41:31 EDT 2008
Log message for revision 88269:
Add check for increasing tids, (rather than just ignoring out-of-order
tids. This is so we can relot on setlastTid being called as
invalidations are done.
Changed:
U ZODB/branches/jim-3.8-connection/src/ZEO/cache.py
U ZODB/branches/jim-3.8-connection/src/ZEO/tests/test_cache.py
-=-
Modified: ZODB/branches/jim-3.8-connection/src/ZEO/cache.py
===================================================================
--- ZODB/branches/jim-3.8-connection/src/ZEO/cache.py 2008-07-11 21:33:45 UTC (rev 88268)
+++ ZODB/branches/jim-3.8-connection/src/ZEO/cache.py 2008-07-11 21:41:31 UTC (rev 88269)
@@ -614,8 +614,13 @@
# revision, and non-current revisions)
@locked
def invalidate(self, oid, version, tid):
- if tid > self.tid and tid is not None:
- self.setLastTid(tid)
+ if tid is not None:
+ if tid > self.tid:
+ self.setLastTid(tid)
+ elif tid < self.tid:
+ raise ValueError("invalidation tid (%s) must not be less than "
+ "previous one (%s)" % (u64(tid),
+ u64(self.tid)))
ofs = self.current.get(oid)
if ofs is None:
Modified: ZODB/branches/jim-3.8-connection/src/ZEO/tests/test_cache.py
===================================================================
--- ZODB/branches/jim-3.8-connection/src/ZEO/tests/test_cache.py 2008-07-11 21:33:45 UTC (rev 88268)
+++ ZODB/branches/jim-3.8-connection/src/ZEO/tests/test_cache.py 2008-07-11 21:41:31 UTC (rev 88269)
@@ -44,7 +44,6 @@
self.assertEqual(self.cache.getLastTid(), None)
self.cache.setLastTid(n2)
self.assertEqual(self.cache.getLastTid(), n2)
- self.cache.invalidate(n1, "", n1)
self.assertEqual(self.cache.getLastTid(), n2)
self.cache.invalidate(n1, "", n3)
self.assertEqual(self.cache.getLastTid(), n3)
@@ -64,8 +63,8 @@
def testInvalidate(self):
data1 = "data for n1"
self.cache.store(n1, "", n3, None, data1)
- self.cache.invalidate(n1, "", n4)
self.cache.invalidate(n2, "", n2)
+ self.cache.invalidate(n1, "", n4)
self.assertEqual(self.cache.load(n1, ""), None)
self.assertEqual(self.cache.loadBefore(n1, n4),
(data1, n3, n4))
More information about the Zodb-checkins
mailing list