Commit c2225847 authored by Jim Fulton's avatar Jim Fulton

Allow any last tid to be set for empty zeo cache files.

parent 62d662d3
......@@ -22,7 +22,7 @@ New Features
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 @@ New Features
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)
====================
......
......@@ -436,7 +436,7 @@ class ClientCache(object):
# 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)))
......
......@@ -85,6 +85,9 @@ class CacheTests(ZODB.tests.util.TestCase):
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):
......@@ -326,6 +329,11 @@ class CacheTests(ZODB.tests.util.TestCase):
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 =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment