Commit 485ddf33 authored by Aurel's avatar Aurel

fix some bug in undoLog, remove transaction call in undo as this is

done by ZODB


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@196 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 0fa3183f
......@@ -609,7 +609,7 @@ class Application(object):
def undo(self, transaction_id, txn, wrapper):
if transaction_id is not self.txn:
if txn is not self.txn:
raise StorageTransactionError(self, transaction_id)
# First get transaction information from a storage node.
......@@ -660,9 +660,8 @@ class Application(object):
if end != transaction_id:
raise UndoError("non-undoable transaction")
data_dict[oid] = data
# Third do transaction with old data
self.tpc_begin(txn)
# Third do transaction with old data
for oid in data_dict.keys():
data = data_dict[oid]
try:
......@@ -677,11 +676,8 @@ class Application(object):
raise ConflictError(oid = oid, serials = (self.tid, serial),
data = data)
self.tpc_vote(txn)
self.tpc_finish(txn)
def undoLog(self, first, last, filter=None):
def undoLog(self, first, last, filter=None, block=0):
if last < 0:
# See FileStorage.py for explanation
last = first - last
......@@ -754,7 +750,7 @@ class Application(object):
# Filter result if needed
if filter is not None:
# Filter method return True if match
if not filter(self.local_var.txn_info['description']):
if not filter(self.local_var.txn_info):
continue
# Append to returned list
......@@ -762,7 +758,10 @@ class Application(object):
undo_info.append(self.local_var.txn_info)
if len(undo_info) >= last - first:
break
# Check we return at least one element, otherwise call
# again but extend offset
if len(undo_info) == 0 and not block:
undo_info = self.undoLog(first=first, last=last*5, filter=filter, block=1)
return undo_info
......
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