[Zodb-checkins] CVS: StandaloneZODB/ZODB - FileStorage.py:1.75

Jeremy Hylton jeremy@zope.com
Mon, 29 Oct 2001 15:37:32 -0500


Update of /cvs-repository/StandaloneZODB/ZODB
In directory cvs.zope.org:/tmp/cvs-serv10264

Modified Files:
	FileStorage.py 
Log Message:
Small change to pack to make it more robust.

If the packpos returned by the read_index() call is 4, return immediately.
In this case, the very first transaction, which contains the root object,
is after the pack time.  This is a degenerate case, but it seems clearest
to do nothing.

This change eliminates an unexpected traceback in pack() that occurred
frequently, but not every time, when testing on Windows.  When
read_index() returned 4, a seek() call in _redundant_pack() would fail
with a bad argument.

Add an assertion to _redundant_pack() because it should never be called
with bogus arguments as a result of the other change.


=== StandaloneZODB/ZODB/FileStorage.py 1.74 => 1.75 ===
 
     def _redundant_pack(self, file, pos):
+        assert pos > 8, pos
         file.seek(pos-8)
         p=U64(file.read(8))
         file.seek(pos-p+8)
@@ -1280,6 +1281,8 @@
                 read_only=1,
                 )
 
+            if packpos == 4:
+                return
             if self._redundant_pack(file, packpos):
                 raise FileStorageError, (
                     'The database has already been packed to a later time\n'