Commit 05b74940 authored by Jeremy Hylton's avatar Jeremy Hylton

Don't attempt to load back-pointer if it's 0.

This will allow an iterator to handle aborted versions and undone
object creations.  XXX Still need a test for the latter.
parent ddcac845
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,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.77 $'[11:-2] __version__='$Revision: 1.78 $'[11:-2]
import struct, time, os, string, base64, sys import struct, time, os, string, base64, sys
from struct import pack, unpack from struct import pack, unpack
...@@ -2205,10 +2205,20 @@ class RecordIterator(Iterator, BaseStorage.TransactionRecord): ...@@ -2205,10 +2205,20 @@ class RecordIterator(Iterator, BaseStorage.TransactionRecord):
break break
self._pos=pos+dlen self._pos=pos+dlen
if plen: p=read(plen) if plen:
p = read(plen)
else: else:
p=read(8) p = read(8)
p=_loadBack(file, oid, p)[0] if p == z64:
# If the backpointer is 0 (encoded as z64), then
# this transaction undoes the object creation. It
# either aborts the version that created the
# object or undid the transaction that created it.
# Return None instead of a pickle to indicate
# this.
p = None
else:
p = _loadBack(file, oid, p)[0]
r=Record(oid, serial, version, p) r=Record(oid, serial, version, p)
......
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