Commit b8efc6d2 authored by Jim Fulton's avatar Jim Fulton

Changed the way status flags are set when packing. All transactions

before the pack time *should* be and now are marked.  I was trying to
be cute about letting transactions before the pack time be packed.
This was bent and led to database corruption when these transactions
were undone.
parent b23ca816
...@@ -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.23 $'[11:-2] __version__='$Revision: 1.24 $'[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
...@@ -813,7 +813,7 @@ class FileStorage(BaseStorage.BaseStorage): ...@@ -813,7 +813,7 @@ class FileStorage(BaseStorage.BaseStorage):
# Initialize, # Initialize,
pv=z64 pv=z64
offset=0 # the abound of spaec freed by packing offset=0 # the amount of spaec freed by packing
pos=opos=4 pos=opos=4
oseek(0) oseek(0)
write(packed_version) write(packed_version)
...@@ -868,7 +868,8 @@ class FileStorage(BaseStorage.BaseStorage): ...@@ -868,7 +868,8 @@ class FileStorage(BaseStorage.BaseStorage):
otpos=opos # start pos of output trans otpos=opos # start pos of output trans
# write out the transaction record # write out the transaction record
write(h) status=packing and 'p' or ' '
write(h[:16]+status+h[17:])
thl=ul+dl+el thl=ul+dl+el
h=read(thl) h=read(thl)
if len(h) != thl: if len(h) != thl:
...@@ -877,7 +878,6 @@ class FileStorage(BaseStorage.BaseStorage): ...@@ -877,7 +878,6 @@ class FileStorage(BaseStorage.BaseStorage):
thl=23+thl thl=23+thl
pos=tpos+thl pos=tpos+thl
opos=otpos+thl opos=otpos+thl
status=' '
while pos < tend: while pos < tend:
# Read the data records for this transaction # Read the data records for this transaction
...@@ -897,7 +897,6 @@ class FileStorage(BaseStorage.BaseStorage): ...@@ -897,7 +897,6 @@ class FileStorage(BaseStorage.BaseStorage):
# This is not the most current record, or # This is not the most current record, or
# the oid is no longer referenced so skip it. # the oid is no longer referenced so skip it.
pos=pos+dlen pos=pos+dlen
status='p'
continue continue
pnv=u64(read(8)) pnv=u64(read(8))
...@@ -915,7 +914,6 @@ class FileStorage(BaseStorage.BaseStorage): ...@@ -915,7 +914,6 @@ class FileStorage(BaseStorage.BaseStorage):
# This object is no longer referenced # This object is no longer referenced
# so skip it. # so skip it.
pos=pos+dlen pos=pos+dlen
status='p'
continue continue
# This is not the most current record # This is not the most current record
...@@ -929,7 +927,6 @@ class FileStorage(BaseStorage.BaseStorage): ...@@ -929,7 +927,6 @@ class FileStorage(BaseStorage.BaseStorage):
# The most current record is committed, so # The most current record is committed, so
# we can toss this one # we can toss this one
pos=pos+dlen pos=pos+dlen
status='p'
continue continue
pnv=read(8) pnv=read(8)
pnv=_loadBackPOS(file, oid, pnv) pnv=_loadBackPOS(file, oid, pnv)
...@@ -937,7 +934,6 @@ class FileStorage(BaseStorage.BaseStorage): ...@@ -937,7 +934,6 @@ class FileStorage(BaseStorage.BaseStorage):
# The current non version data is later, # The current non version data is later,
# so this isn't the current record # so this isn't the current record
pos=pos+dlen pos=pos+dlen
status='p'
continue continue
nvindex[oid]=opos nvindex[oid]=opos
......
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