[Zodb-checkins] SVN: ZODB/trunk/src/ Allow any last tid to be set for empty zeo cache files.

Jim Fulton jim at zope.com
Wed Dec 3 19:56:27 EST 2008


Log message for revision 93596:
  Allow any last tid to be set for empty zeo cache files.
  

Changed:
  U   ZODB/trunk/src/CHANGES.txt
  U   ZODB/trunk/src/ZEO/cache.py
  U   ZODB/trunk/src/ZEO/tests/test_cache.py

-=-
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt	2008-12-04 00:23:06 UTC (rev 93595)
+++ ZODB/trunk/src/CHANGES.txt	2008-12-04 00:56:26 UTC (rev 93596)
@@ -22,7 +22,7 @@
   XXX There are known issues with this implementation that need to be
   sorted out before it is "released".
 
-3.9.0a6 (2008-12-??)
+3.9.0a7 (2008-12-??)
 ====================
 
 New Features
@@ -33,6 +33,12 @@
   The ordinary file may be used outside the current transaction and
   even after the blob's database connection has been closed.
 
+Bugs Fixed
+----------
+
+- Starting ClientStorages sometimes failed with non-new but empty
+  cache files.
+
 3.9.0a6 (2008-11-30)
 ====================
 

Modified: ZODB/trunk/src/ZEO/cache.py
===================================================================
--- ZODB/trunk/src/ZEO/cache.py	2008-12-04 00:23:06 UTC (rev 93595)
+++ ZODB/trunk/src/ZEO/cache.py	2008-12-04 00:56:26 UTC (rev 93596)
@@ -436,7 +436,7 @@
     # recent tid.
     @locked
     def setLastTid(self, tid):
-        if self.tid is not None and tid <= self.tid:
+        if (self.tid is not None) and (tid <= self.tid) and self:
             raise ValueError("new last tid (%s) must be greater than "
                              "previous one (%s)" % (u64(tid),
                                                     u64(self.tid)))

Modified: ZODB/trunk/src/ZEO/tests/test_cache.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/test_cache.py	2008-12-04 00:23:06 UTC (rev 93595)
+++ ZODB/trunk/src/ZEO/tests/test_cache.py	2008-12-04 00:56:26 UTC (rev 93596)
@@ -85,6 +85,9 @@
         self.assertEqual(self.cache.getLastTid(), n2)
         self.cache.invalidate(n1, n3)
         self.assertEqual(self.cache.getLastTid(), n3)
+
+        # the cache complains only when it's non-empty
+        self.cache.store(n1, n3, None, 'x')
         self.assertRaises(ValueError, self.cache.setLastTid, n2)
 
     def testLoad(self):
@@ -325,8 +328,13 @@
             # Cleanup
             cache.close()
             os.remove('cache')
-        
 
+    def testSetAnyLastTidOnEmptyCache(self):
+        self.cache.setLastTid(p64(5))
+        self.cache.setLastTid(p64(5))
+        self.cache.setLastTid(p64(3))
+        self.cache.setLastTid(p64(4))
+
 __test__ = dict(
     kill_does_not_cause_cache_corruption =
     r"""



More information about the Zodb-checkins mailing list