Commit 59e7aafb authored by Vincent Pelletier's avatar Vincent Pelletier

Create masters as we are notified of their existence.

This increases cluster on-line flexibility, allowing new masters to be
added without needing a restart of all masters.
Downside is that more responsibility is pushed to cluster admins: they must
update node configurations so they contain enough master nodes to allow
them to join cluster after a restart.
parent a0ad2b86
......@@ -56,6 +56,8 @@ class PrimaryBootstrapHandler(AnswerBaseHandler):
# Register new master nodes.
for address, uuid in known_master_list:
n = app.nm.getByAddress(address)
if n is None:
if uuid is not None and n.getUUID() != uuid:
......@@ -531,9 +531,6 @@ class Application(object):
handler = administration.AdministrationHandler(self)'Accept an admin %s' % (dump(uuid), ))
elif node_type == NodeTypes.MASTER:
if node is None:
# unknown master, rejected
raise protocol.ProtocolError('Reject an unknown master node')
# always put other master in waiting state
node_ctor = self.nm.createMaster
handler = secondary.SecondaryMasterHandler(self)
......@@ -93,8 +93,8 @@ class ClientElectionHandler(MasterHandler):
# This is self.
n = app.nm.getByAddress(address)
# master node must be known
assert n is not None, 'Unknown master node: %s' % (address, )
if n is None:
n = app.nm.createMaster(address=address)
if uuid is not None:
# If I don't know the UUID yet, believe what the peer
# told me at the moment.
......@@ -167,8 +167,7 @@ class ServerElectionHandler(MasterHandler):
raise NotReadyError
node = app.nm.getByAddress(address)
if node is None:
neo.lib.logging.error('unknown master node: %s' % (address, ))
raise ProtocolError('unknown master node')
node = app.nm.createMaster(address=address)
# If this node is broken, reject it.
if node.getUUID() == uuid:
if node.isBroken():
......@@ -232,13 +232,6 @@ class MasterServerElectionTests(NeoUnitTestBase):
conn, NodeTypes.CLIENT, *args)
def test_requestIdentification2(self):
""" A unknown master node request identification """
node, conn = self.identifyToMasterNode()
args = (node.getUUID(), ('', 1000),
conn, NodeTypes.MASTER, *args)
def test_requestIdentification3(self):
""" A broken master node request identification """
node, conn = self.identifyToMasterNode()
......@@ -302,18 +295,6 @@ class MasterServerElectionTests(NeoUnitTestBase):
def testRequestIdentification2(self):
""" Check with an unknown master node """
conn = self.__getMaster(register=False)
def testAnnouncePrimary1(self):
""" check the wrong cases """
announce = self.election.announcePrimary
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