Commit 6f86c773 authored by Julien Muchembled's avatar Julien Muchembled

The partition table must forget dropped nodes

parent 7ffc96fd
......@@ -451,6 +451,8 @@ class NodeManager(EventQueue):
# reconnect to the master because they cleared their
# partition table upon disconnection.
node.getConnection().close()
if app.uuid != uuid:
app.pt.dropNode(node)
self.remove(node)
continue
logging.debug('updating node %r to %s %s %s %s %s',
......@@ -465,6 +467,7 @@ class NodeManager(EventQueue):
# For the first notification, we receive a full list of nodes from
# the master. Remove all unknown nodes from a previous connection.
for node in node_set - self._node_set:
app.pt.dropNode(node)
self.remove(node)
self.log()
self.executeQueuedEvents()
......
......@@ -195,6 +195,10 @@ class PartitionTable(object):
self.count_dict[node] -= 1
break
def dropNode(self, node):
count = self.count_dict.pop(node, None)
assert not count, (node, count)
def load(self, ptid, row_list, nm):
"""
Load the partition table with the specified PTID, discard all previous
......
......@@ -163,8 +163,10 @@ class NodeManagerTests(NeoUnitTestBase):
(NodeTypes.ADMIN, self.admin.getAddress(), self.admin.getUUID(),
NodeStates.UNKNOWN, None),
)
app = Mock()
app.pt = Mock()
# update manager content
manager.update(Mock(), time(), node_list)
manager.update(app, time(), node_list)
# - the client gets down
self.checkClients([])
# - master change it's address
......
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