Commit 941a99b8 authored by Vincent Pelletier's avatar Vincent Pelletier

Master nodes are not supposed to receive notifyNodeInformation packets.

Remove hanlder methods for that packet in order to reveal if it happens in
reality, so ti could be fixed.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1694 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent d92aaeee
...@@ -23,46 +23,7 @@ from neo.master.handlers import MasterHandler ...@@ -23,46 +23,7 @@ from neo.master.handlers import MasterHandler
from neo.exception import ElectionFailure from neo.exception import ElectionFailure
from neo.util import dump from neo.util import dump
class ElectionHandler(MasterHandler): class ClientElectionHandler(MasterHandler):
"""This class deals with events for a primary master election."""
def notifyNodeInformation(self, conn, node_list):
if conn.getUUID() is None:
raise protocol.ProtocolError('Not identified')
app = self.app
for node_type, addr, uuid, state in node_list:
if node_type != NodeTypes.MASTER:
# No interest.
continue
# Register new master nodes.
if app.server == addr:
# This is self.
continue
else:
node = app.nm.getByAddress(addr)
# The master must be known
assert node is not None
if uuid is not None:
# If I don't know the UUID yet, believe what the peer
# told me at the moment.
if node.getUUID() is None:
node.setUUID(uuid)
if state in (node.getState(), NodeStates.RUNNING):
# No change. Don't care.
continue
# Something wrong happened possibly. Cut the connection to
# this node, if any, and notify the information to others.
# XXX this can be very slow.
for c in app.em.getConnectionList():
if c.getUUID() == uuid:
c.close()
node.setState(state)
class ClientElectionHandler(ElectionHandler):
# FIXME: this packet is not allowed here, but handled in MasterHandler # FIXME: this packet is not allowed here, but handled in MasterHandler
# a global handler review is required. # a global handler review is required.
...@@ -205,7 +166,7 @@ class ClientElectionHandler(ElectionHandler): ...@@ -205,7 +166,7 @@ class ClientElectionHandler(ElectionHandler):
)) ))
class ServerElectionHandler(ElectionHandler): class ServerElectionHandler(MasterHandler):
def reelectPrimary(self, conn): def reelectPrimary(self, conn):
raise ElectionFailure, 'reelection requested' raise ElectionFailure, 'reelection requested'
......
...@@ -40,10 +40,6 @@ class SecondaryMasterHandler(MasterHandler): ...@@ -40,10 +40,6 @@ class SecondaryMasterHandler(MasterHandler):
def reelectPrimary(self, conn): def reelectPrimary(self, conn):
raise ElectionFailure, 'reelection requested' raise ElectionFailure, 'reelection requested'
def notifyNodeInformation(self, conn, node_list):
logging.error('/!\ NotifyNodeInformation packet from secondary master')
class PrimaryHandler(MasterHandler): class PrimaryHandler(MasterHandler):
""" Handler used by secondaries to handle primary master""" """ Handler used by secondaries to handle primary master"""
......
...@@ -36,6 +36,3 @@ class ShutdownHandler(BaseServiceHandler): ...@@ -36,6 +36,3 @@ class ShutdownHandler(BaseServiceHandler):
logging.error('reject any new demand for new tid') logging.error('reject any new demand for new tid')
raise protocol.ProtocolError('cluster is shutting down') raise protocol.ProtocolError('cluster is shutting down')
def notifyNodeInformation(self, conn, node_list):
# don't care about notifications since we are shutdowning
pass
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