Commit b4e9aeb1 authored by Aurel's avatar Aurel

make vote method not failing if a SN get disconnected

make sure vote was propagate at least to one storage node


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@584 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 150b0074
......@@ -572,6 +572,7 @@ class Application(object):
cell_list = self.pt.getCellList(partition_id, writable=True)
finally:
self._pt_release()
self.local_var.voted_counter = 0
for cell in cell_list:
logging.info("voting object %s %s" %(cell.getServer(), cell.getState()))
conn = self.cp.getConnForNode(cell)
......@@ -581,10 +582,18 @@ class Application(object):
self.local_var.txn_voted = False
p = protocol.askStoreTransaction(self.local_var.tid,
user, desc, ext, oid_list)
try:
self._askStorage(conn, p)
except NEOStorageConnectionFailure:
continue
if not self.isTransactionVoted():
raise NEOStorageError('tpc_vote failed')
self.local_var.voted_counter += 1
# check at least one storage node accepted
if self.local_var.voted_counter == 0:
raise NEOStorageError('tpc_vote failed')
def tpc_abort(self, transaction):
"""Abort current transaction."""
......
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