Commit fcd9fabc authored by Grégory Wisniewski's avatar Grégory Wisniewski

A client node must notify the master only about storage node failures, so assert

this in handleNotifyNodeInformation. 


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@940 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 1919687f
......@@ -75,56 +75,17 @@ class ClientServiceHandler(BaseServiceHandler):
del app.finishing_transaction_dict[tid]
def handleNotifyNodeInformation(self, conn, packet, node_list):
app = self.app
for node_type, addr, uuid, state in node_list:
if node_type in (protocol.CLIENT_NODE_TYPE, protocol.ADMIN_NODE_TYPE):
# No interest.
continue
if uuid is None:
# No interest.
continue
if app.uuid == uuid:
# This looks like me...
if state == protocol.RUNNING_STATE:
# Yes, I know it.
continue
else:
# What?! What happened to me?
raise RuntimeError, 'I was told that I am bad'
node = app.nm.getNodeByUUID(uuid)
if node is None:
node = app.nm.getNodeByServer(addr)
if node is None:
# I really don't know such a node. What is this?
continue
else:
if node.getServer() != addr:
# This is different from what I know.
continue
if node.getState() == state:
# No change. Don't care.
continue
node.setState(state)
# Something wrong happened possibly. Cut the connection to
# this node, if any, and notify the information to others.
# XXX this can be very slow.
# XXX does this need to be closed in all cases ?
c = app.em.getConnectionByUUID(uuid)
if c is not None:
c.close()
app.broadcastNodeInformation(node)
if node.getNodeType() == protocol.STORAGE_NODE_TYPE:
if state == protocol.TEMPORARILY_DOWN_STATE:
cell_list = app.pt.outdate()
if len(cell_list) != 0:
ptid = app.pt.setNextID()
app.broadcastPartitionChanges(ptid, cell_list)
# XXX: client must notify only about storage failures, so remove
# this assertion when done
assert node_type == protocol.STORAGE_NODE_TYPE
assert state in (protocol.TEMPORARILY_DOWN_STATE, protocol.BROKEN_STATE)
if self.app.em.getConnectionByUUID(uuid) is None:
# trust this notification only if I don't have a connexion to
# this node
node.setState(state)
self.app.broadcastNodeInformation(node)
def handleAbortTransaction(self, conn, packet, tid):
try:
......
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