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():
p = Packets.AnswerTransactionFinished(tid)
node.answer(p, msg_id=t.getMessageId())
else: else:
node.notify(Packets.InvalidateObjects(t.getOIDList(), tid)) c.notify(invalidate_objects)
elif node.isStorage():
if uuid in t.getUUIDList(): # - Unlock Information to relevant storage nodes.
node.notify(Packets.NotifyUnlockInformation(tid)) notify_unlock = Packets.NotifyUnlockInformation(tid)
for storage_uuid in t.getUUIDList():
nm.getByUUID(storage_uuid).getConnection().notify(notify_unlock)
# 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