Commit 66ef9bed authored by Grégory Wisniewski's avatar Grégory Wisniewski

Bug fix: Don't drop transaction information when locked.

If a client node disconnect from storage node right after send 'finishTransaction' to the primary master, then the storage clear it's related information and can not store them later in the database, when notifyUnlockInformation is received from the master.
Here the transaction object got a new attribute '_locked' set when the storage receive the 'lockInformation' from the master, meaning that the client is finish it's transaction.
If locked, the transaction is not cleared when the client disconnect from storage node.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1632 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent feea26c9
...@@ -30,6 +30,13 @@ class TransactionInformation(object): ...@@ -30,6 +30,13 @@ class TransactionInformation(object):
self._object_dict = {} self._object_dict = {}
self._transaction = None self._transaction = None
self._last_oid_changed = False self._last_oid_changed = False
self._locked = False
def isLocked(self):
return self._locked
def setLocked(self):
self._locked = True
def lastOIDLchange(self): def lastOIDLchange(self):
self._last_oid_changed = True self._last_oid_changed = True
...@@ -59,6 +66,9 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler): ...@@ -59,6 +66,9 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler):
app = self.app app = self.app
for tid, t in app.transaction_dict.items(): for tid, t in app.transaction_dict.items():
if t.getUUID() == uuid: if t.getUUID() == uuid:
if t.isLocked():
logging.warning('Node lost while finishing transaction')
break
for o in t.getObjectList(): for o in t.getObjectList():
oid = o[0] oid = o[0]
# TODO: remove try..except: pass # TODO: remove try..except: pass
......
...@@ -59,6 +59,7 @@ class MasterOperationHandler(BaseMasterHandler): ...@@ -59,6 +59,7 @@ class MasterOperationHandler(BaseMasterHandler):
def lockInformation(self, conn, tid): def lockInformation(self, conn, tid):
app = self.app app = self.app
t = app.transaction_dict[tid] t = app.transaction_dict[tid]
t.setLocked()
object_list = t.getObjectList() object_list = t.getObjectList()
for o in object_list: for o in object_list:
app.load_lock_dict[o[0]] = tid app.load_lock_dict[o[0]] = tid
......
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