Commit ab70852f authored by Vincent Pelletier's avatar Vincent Pelletier

Don't iterate over all connection when we know the UUIDs we must contact.

This should improve scalability when the number of non-client nodes grows.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1868 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 8285c2e5
...@@ -67,25 +67,24 @@ class StorageServiceHandler(BaseServiceHandler): ...@@ -67,25 +67,24 @@ class StorageServiceHandler(BaseServiceHandler):
if not t.lock(uuid): if not t.lock(uuid):
return return
# all nodes are locked # I have received all the lock answers now:
# XXX: review needed: # - send a Notify Transaction Finished to the initiated client node
# don't iterate over connections but search by uuid # - Invalidate Objects to the other client nodes
# include client's uuid in Transaction object nm = app.nm
transaction_node = t.getNode()
# I have received all the answers now. So send a Notify invalidate_objects = Packets.InvalidateObjects(t.getOIDList(), tid)
# Transaction Finished to the initiated client node, answer_transaction_finished = Packets.AnswerTransactionFinished(tid)
# Invalidate Objects to the other client nodes, and Unlock for client_node in nm.getClientList():
# Information to relevant storage nodes. c = client_node.getConnection()
for node in self.app.nm.getIdentifiedList(): if client_node is transaction_node:
if node.isClient(): c.answer(answer_transaction_finished, msg_id=t.getMessageId())
if node is t.getNode(): else:
p = Packets.AnswerTransactionFinished(tid) c.notify(invalidate_objects)
node.answer(p, msg_id=t.getMessageId())
else: # - Unlock Information to relevant storage nodes.
node.notify(Packets.InvalidateObjects(t.getOIDList(), tid)) notify_unlock = Packets.NotifyUnlockInformation(tid)
elif node.isStorage(): for storage_uuid in t.getUUIDList():
if uuid in t.getUUIDList(): nm.getByUUID(storage_uuid).getConnection().notify(notify_unlock)
node.notify(Packets.NotifyUnlockInformation(tid))
# remove transaction from manager # remove transaction from manager
tm.remove(tid) tm.remove(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