[Zope-Checkins] CVS: ZODB3/ZODB - FileStorage.py:1.125

Barry Warsaw barry@wooz.org
Mon, 20 Jan 2003 14:11:25 -0500


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv1556

Modified Files:
	FileStorage.py 
Log Message:
FileIterator.next(): Break out of the while-loop by raising IndexError
earlier in the loop.  Basically, once we've got a tid from the
transaction record, we check it against our stop tid, and we check the
status looking for a 'c' flag.


=== ZODB3/ZODB/FileStorage.py 1.124 => 1.125 ===
--- ZODB3/ZODB/FileStorage.py:1.124	Fri Jan  3 17:07:43 2003
+++ ZODB3/ZODB/FileStorage.py	Mon Jan 20 14:11:22 2003
@@ -2359,9 +2359,16 @@
                 warn("%s time-stamp reduction at %s", self._file.name, pos)
             self._ltid=tid
 
+            if self._stop is not None and tid > self._stop:
+                raise IndexError, index
+
+            if status == 'c':
+                # Assume we've hit the last, in-progress transaction
+                raise IndexError, index
+
             tl=u64(stl)
 
-            if pos+(tl+8) > self._file_size or status=='c':
+            if pos+(tl+8) > self._file_size:
                 # Hm, the data were truncated or the checkpoint flag wasn't
                 # cleared.  They may also be corrupted,
                 # in which case, we don't want to totally lose the data.
@@ -2395,9 +2402,6 @@
                     warn('%s has invalid transaction header at %s',
                          self._file.name, pos)
                     break
-
-            if self._stop is not None and tid > self._stop:
-                raise IndexError, index
 
             tpos=pos
             tend=tpos+tl