[Zope-Checkins] CVS: ZODB/src/ZODB/tests - PackableStorage.py:1.36

Tim Peters tim.one at comcast.net
Tue Mar 16 18:51:07 EST 2004

Update of /cvs-repository/ZODB/src/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv30994/src/ZODB/tests

Modified Files:
Log Message:
Bugfix for pack().  Approximately forever, we've seen extremely rare
failures in the ZEO FileStorage pack-while-writing tests, where they die
    CorruptedError: ... transaction with checkpoint flag set

By coincidence, the same kind of death during pack() was reported on
zodb-dev today(!).  The new checkPackLotsWhileWriting test provokes this
on my box reliably (failed each time it was run).

The problem appears to be that pack's idea of where a FileStorage
ends was obtained merely by seeking to the end of the file.  But if
a transaction is in progress, there can be an extra "not really there
yet" transaction at the end of the file, and when either buildPackIndex()
or findReachableFromFuture() bumped into a such a thing, the CorruptedError
above got raised.  This is always rare, and was exceedingly rare before
because only one pack per test was tried.  The new test tries packing
repeatedly while a thread keeps hammering the database, so is much more
likely to provoke the problem.

The fix amounts to passing FileStorage._pos to the pack code, telling
the latter directly where the legit transactions in the file end.

=== ZODB/src/ZODB/tests/PackableStorage.py 1.35 => 1.36 ===
--- ZODB/src/ZODB/tests/PackableStorage.py:1.35	Fri Mar 12 21:49:22 2004
+++ ZODB/src/ZODB/tests/PackableStorage.py	Tue Mar 16 18:51:07 2004
@@ -260,8 +260,7 @@
     def checkPackNowWhileWriting(self):
-    # XXX Disabled because it always fails now.
-    def XXXcheckPackLotsWhileWriting(self):
+    def checkPackLotsWhileWriting(self):
         # This is like the other pack-while-writing tests, except it packs
         # repeatedly until the client thread is done.  At the time it was
         # introduced, it reliably provoked

More information about the Zope-Checkins mailing list