Commit 87461c53 authored by Vincent Pelletier's avatar Vincent Pelletier

Fix undo error detection code.

Undo fails if any of the following is true:
- cell_list is empty (should never happen, add an assertion for this)
- all connections get a ConnectionClosed exception
- transaction cannot be found in any storage
- an unexpected answer was received (it did not change txn_info)

This fixes the first case, as the test might have received old values from
former executions (which could be neither -1 nor 0) in the same
transaction.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1832 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 0af7dcb7
...@@ -765,6 +765,8 @@ class Application(object): ...@@ -765,6 +765,8 @@ class Application(object):
# 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(transaction_id, readable=True)
assert len(cell_list), 'No cell found for transaction %s' % (
dump(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)
...@@ -787,8 +789,7 @@ class Application(object): ...@@ -787,8 +789,7 @@ class Application(object):
break break
else: else:
raise NEOStorageError('undo failed') raise NEOStorageError('undo failed')
else:
if self.local_var.txn_info in (-1, 0):
raise NEOStorageError('undo failed') raise NEOStorageError('undo failed')
oid_list = self.local_var.txn_info['oids'] oid_list = self.local_var.txn_info['oids']
......
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