[Zodb-checkins] CVS: ZODB3/ZODB - FileStorage.py:1.105.2.13

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


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

Modified Files:
      Tag: ZODB3-3_1-branch
	FileStorage.py 
Log Message:
Backported from trunk:

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.105.2.12 => 1.105.2.13 ===
--- ZODB3/ZODB/FileStorage.py:1.105.2.12	Tue Jan  7 12:43:32 2003
+++ ZODB3/ZODB/FileStorage.py	Mon Jan 20 14:18:42 2003
@@ -2396,9 +2396,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.
@@ -2432,9 +2439,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