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): ...@@ -75,56 +75,17 @@ class ClientServiceHandler(BaseServiceHandler):
del app.finishing_transaction_dict[tid] del app.finishing_transaction_dict[tid]
def handleNotifyNodeInformation(self, conn, packet, node_list): def handleNotifyNodeInformation(self, conn, packet, node_list):
app = self.app
for node_type, addr, uuid, state in node_list: for node_type, addr, uuid, state in node_list:
if node_type in (protocol.CLIENT_NODE_TYPE, protocol.ADMIN_NODE_TYPE): # XXX: client must notify only about storage failures, so remove
# No interest. # this assertion when done
continue assert node_type == protocol.STORAGE_NODE_TYPE
assert state in (protocol.TEMPORARILY_DOWN_STATE, protocol.BROKEN_STATE)
if uuid is None:
# No interest. if self.app.em.getConnectionByUUID(uuid) is None:
continue # trust this notification only if I don't have a connexion to
# this node
if app.uuid == uuid: node.setState(state)
# This looks like me... self.app.broadcastNodeInformation(node)
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)
def handleAbortTransaction(self, conn, packet, tid): def handleAbortTransaction(self, conn, packet, tid):
try: 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