Commit fbec5109 authored by Vincent Pelletier's avatar Vincent Pelletier

Fix the meaning of txn_voted.

It was actually used to track individual answerStoreTransaction, and there
is no need to track them individually.
Instead, just set txn_voted to True before returning, so it really means
that tpc_vote ended successfully.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2518 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 3208540f
...@@ -800,15 +800,11 @@ class Application(object): ...@@ -800,15 +800,11 @@ class Application(object):
if conn is None: if conn is None:
continue continue
local_var.txn_voted = False
try: try:
self._askStorage(conn, p) self._askStorage(conn, p)
add_involved_nodes(cell.getNode()) add_involved_nodes(cell.getNode())
except ConnectionClosed: except ConnectionClosed:
continue continue
if not self.isTransactionVoted():
raise NEOStorageError('tpc_vote failed')
voted_counter += 1 voted_counter += 1
# check at least one storage node accepted # check at least one storage node accepted
...@@ -820,6 +816,7 @@ class Application(object): ...@@ -820,6 +816,7 @@ class Application(object):
# tpc_finish. # tpc_finish.
self._getMasterConnection() self._getMasterConnection()
local_var.txn_voted = True
return result return result
@profiler_decorator @profiler_decorator
...@@ -1233,12 +1230,6 @@ class Application(object): ...@@ -1233,12 +1230,6 @@ class Application(object):
def getTID(self): def getTID(self):
return self.local_var.tid return self.local_var.tid
def setTransactionVoted(self):
self.local_var.txn_voted = True
def isTransactionVoted(self):
return self.local_var.txn_voted
def pack(self, t): def pack(self, t):
tid = repr(TimeStamp(*time.gmtime(t)[:5] + (t % 60, ))) tid = repr(TimeStamp(*time.gmtime(t)[:5] + (t % 60, )))
if tid == ZERO_TID: if tid == ZERO_TID:
......
...@@ -94,7 +94,6 @@ class StorageAnswersHandler(AnswerBaseHandler): ...@@ -94,7 +94,6 @@ class StorageAnswersHandler(AnswerBaseHandler):
def answerStoreTransaction(self, conn, tid): def answerStoreTransaction(self, conn, tid):
if tid != self.app.getTID(): if tid != self.app.getTID():
raise ProtocolError('Wrong TID, transaction not started') raise ProtocolError('Wrong TID, transaction not started')
self.app.setTransactionVoted()
def answerTransactionInformation(self, conn, tid, def answerTransactionInformation(self, conn, tid,
user, desc, ext, packed, oid_list): user, desc, ext, packed, 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