Commit 95f5f396 authored by Jeremy Hylton's avatar Jeremy Hylton

Fix undoLog() to process arguments correctly.

Fix edge case in pack() -- backpointer to object created in version.
parent 12472727
...@@ -79,7 +79,7 @@ method:: ...@@ -79,7 +79,7 @@ method::
and call it to monitor the storage. and call it to monitor the storage.
""" """
__version__='$Revision: 1.16 $'[11:-2] __version__='$Revision: 1.17 $'[11:-2]
import base64, time, string import base64, time, string
from ZODB import POSException, BaseStorage, utils from ZODB import POSException, BaseStorage, utils
...@@ -355,8 +355,8 @@ class DemoStorage(BaseStorage.BaseStorage): ...@@ -355,8 +355,8 @@ class DemoStorage(BaseStorage.BaseStorage):
finally: self._lock_release() finally: self._lock_release()
def undoLog(self, first, last, filter=None): def undoLog(self, first, last, filter=None):
# I think this is wrong given the handling of first and last if last < 0:
# in FileStorage. last = first - last + 1
self._lock_acquire() self._lock_acquire()
try: try:
# XXX Shouldn't this be sorted? # XXX Shouldn't this be sorted?
...@@ -505,25 +505,27 @@ class DemoStorage(BaseStorage.BaseStorage): ...@@ -505,25 +505,27 @@ class DemoStorage(BaseStorage.BaseStorage):
if o: if o:
if len(o) != len(t): if len(o) != len(t):
_data[tid]=1, u, d, e, tuple(o) # Reset data _data[tid] = 1, u, d, e, tuple(o) # Reset data
else: else:
deleted.append(tid) deleted.append(tid)
# Now delete empty transactions # Now delete empty transactions
for tid in deleted: del _data[tid] for tid in deleted:
del _data[tid]
# Now reset previous pointers for "current" records: # Now reset previous pointers for "current" records:
for r in pindex.values(): for r in pindex.values():
r[2]=None # Previous record r[2] = None # Previous record
if r[3]: # vdata if r[3] and r[3][1]: # vdata
r[3][1][2]=None # If this record contains version data and
# non-version data, then clear it out.
pindex=None r[3][1][2] = None
# Finally, rebuild indexes from transaction data: # Finally, rebuild indexes from transaction data:
self._index, self._vindex = self._build_indexes() self._index, self._vindex = self._build_indexes()
finally: self._lock_release() finally:
self._lock_release()
self.getSize() self.getSize()
def _splat(self): def _splat(self):
......
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