Commit 4f1ede3d authored by Barry Warsaw's avatar Barry Warsaw

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.
parent 06ff4612
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
# may have a back pointer to a version record or to a non-version # may have a back pointer to a version record or to a non-version
# record. # record.
# #
__version__='$Revision: 1.124 $'[11:-2] __version__='$Revision: 1.125 $'[11:-2]
import base64 import base64
from cPickle import Pickler, Unpickler, loads from cPickle import Pickler, Unpickler, loads
...@@ -2359,9 +2359,16 @@ class FileIterator(Iterator): ...@@ -2359,9 +2359,16 @@ class FileIterator(Iterator):
warn("%s time-stamp reduction at %s", self._file.name, pos) warn("%s time-stamp reduction at %s", self._file.name, pos)
self._ltid=tid 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) 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 # Hm, the data were truncated or the checkpoint flag wasn't
# cleared. They may also be corrupted, # cleared. They may also be corrupted,
# in which case, we don't want to totally lose the data. # in which case, we don't want to totally lose the data.
...@@ -2396,9 +2403,6 @@ class FileIterator(Iterator): ...@@ -2396,9 +2403,6 @@ class FileIterator(Iterator):
self._file.name, pos) self._file.name, pos)
break break
if self._stop is not None and tid > self._stop:
raise IndexError, index
tpos=pos tpos=pos
tend=tpos+tl tend=tpos+tl
......
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