Commit ee3ec432 authored by Vincent Pelletier's avatar Vincent Pelletier

Rename transaction_id into undone_tid to remove ambiguity.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1961 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 8b3237ef
...@@ -96,7 +96,7 @@ class Storage(BaseStorage.BaseStorage, ...@@ -96,7 +96,7 @@ class Storage(BaseStorage.BaseStorage,
# undo # undo
@check_read_only @check_read_only
def undo(self, transaction_id, txn): def undo(self, transaction_id, txn):
return self.app.undo(transaction_id=transaction_id, txn=txn, return self.app.undo(undone_tid=transaction_id, txn=txn,
tryToResolveConflict=self.tryToResolveConflict) tryToResolveConflict=self.tryToResolveConflict)
......
...@@ -771,14 +771,14 @@ class Application(object): ...@@ -771,14 +771,14 @@ class Application(object):
finally: finally:
self._load_lock_release() self._load_lock_release()
def undo(self, transaction_id, txn, tryToResolveConflict): def undo(self, undone_tid, txn, tryToResolveConflict):
if txn is not self.local_var.txn: if txn is not self.local_var.txn:
raise StorageTransactionError(self, transaction_id) raise StorageTransactionError(self, undone_tid)
# First get transaction information from a storage node. # First get transaction information from a storage node.
cell_list = self._getCellListForTID(transaction_id, readable=True) cell_list = self._getCellListForTID(undone_tid, readable=True)
assert len(cell_list), 'No cell found for transaction %s' % ( assert len(cell_list), 'No cell found for transaction %s' % (
dump(transaction_id), ) dump(undone_tid), )
shuffle(cell_list) shuffle(cell_list)
for cell in cell_list: for cell in cell_list:
conn = self.cp.getConnForCell(cell) conn = self.cp.getConnForCell(cell)
...@@ -788,14 +788,14 @@ class Application(object): ...@@ -788,14 +788,14 @@ class Application(object):
self.local_var.txn_info = 0 self.local_var.txn_info = 0
try: try:
self._askStorage(conn, Packets.AskTransactionInformation( self._askStorage(conn, Packets.AskTransactionInformation(
transaction_id)) undone_tid))
except ConnectionClosed: except ConnectionClosed:
continue continue
if self.local_var.txn_info == -1: if self.local_var.txn_info == -1:
# Tid not found, try with next node # Tid not found, try with next node
logging.warning('Transaction %s was not found on node %s', logging.warning('Transaction %s was not found on node %s',
dump(transaction_id), self.nm.getByAddress(conn.getAddress())) dump(undone_tid), self.nm.getByAddress(conn.getAddress()))
continue continue
elif isinstance(self.local_var.txn_info, dict): elif isinstance(self.local_var.txn_info, dict):
break break
...@@ -811,11 +811,11 @@ class Application(object): ...@@ -811,11 +811,11 @@ class Application(object):
# this work should rather be offloaded to it. # this work should rather be offloaded to it.
for oid in oid_list: for oid in oid_list:
current_data = self.load(oid)[0] current_data = self.load(oid)[0]
after_data = self.loadSerial(oid, transaction_id) after_data = self.loadSerial(oid, undone_tid)
if current_data != after_data: if current_data != after_data:
raise UndoError("non-undoable transaction", oid) raise UndoError("non-undoable transaction", oid)
try: try:
data = self.loadBefore(oid, transaction_id)[0] data = self.loadBefore(oid, undone_tid)[0]
except NEOStorageNotFoundError: except NEOStorageNotFoundError:
if oid == '\x00' * 8: if oid == '\x00' * 8:
# Refuse undoing root object creation. # Refuse undoing root object creation.
...@@ -827,7 +827,7 @@ class Application(object): ...@@ -827,7 +827,7 @@ class Application(object):
# Third do transaction with old data # Third do transaction with old data
for oid, data in data_dict.iteritems(): for oid, data in data_dict.iteritems():
self.store(oid, transaction_id, data, None, txn) self.store(oid, undone_tid, data, None, txn)
self.waitStoreResponses(tryToResolveConflict) self.waitStoreResponses(tryToResolveConflict)
return self.local_var.tid, oid_list return self.local_var.tid, oid_list
......
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