Commit 7796bd39 authored by Jim Fulton's avatar Jim Fulton

Fixed a bug that had been made in the 2.1 branch and not merged into

the trunk. :(

The bug caused pack to missadjust backward file pointers
in some cases involving versions and undo.
parent 0ddb4ae2
...@@ -184,7 +184,7 @@ ...@@ -184,7 +184,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.46 $'[11:-2] __version__='$Revision: 1.47 $'[11:-2]
import struct, time, os, bpthread, string, base64, sys import struct, time, os, bpthread, string, base64, sys
from struct import pack, unpack from struct import pack, unpack
...@@ -1117,6 +1117,16 @@ class FileStorage(BaseStorage.BaseStorage): ...@@ -1117,6 +1117,16 @@ class FileStorage(BaseStorage.BaseStorage):
tend=tpos+tl tend=tpos+tl
if status=='u': if status=='u':
if not packing:
# We rely below on a constant offset for unpacked
# records. This assumption holds only if we copy
# undone unpacked data. This is lame, but necessary
# for now to squash a bug.
write(h)
tl=tl+8
write(read(tl-23))
opos=opos+tl
# Undone transaction, skip it # Undone transaction, skip it
pos=tend+8 pos=tend+8
continue continue
...@@ -1224,12 +1234,20 @@ class FileStorage(BaseStorage.BaseStorage): ...@@ -1224,12 +1234,20 @@ class FileStorage(BaseStorage.BaseStorage):
# current record, then we should still # current record, then we should still
# point at one, otherwise, we should # point at one, otherwise, we should
# point at the last non-version record. # point at the last non-version record.
if pindex[oid]==p: ppos=pindex_get(oid,0)
# we were pointing to the if ppos:
# current record if ppos==p:
p=index[oid] # we were pointing to the
# current record
p=index[oid]
else:
p=nvindex[oid]
else: else:
p=nvindex[oid] # Oops, this object was modified
# in a version in which it was deleted.
# Hee hee. It doesn't matter what we
# use cause it's not reachable any more.
p=0
else: else:
# This points back to a non-packed record. # This points back to a non-packed record.
# Just adjust for the offset # Just adjust for the offset
......
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