Commit 36fff189 authored by Julien Muchembled's avatar Julien Muchembled

master: remove dead code (pt.findLeastUsedNode)

parent 895d7801
...@@ -87,17 +87,6 @@ class PartitionTable(neo.lib.pt.PartitionTable): ...@@ -87,17 +87,6 @@ class PartitionTable(neo.lib.pt.PartitionTable):
self.num_filled_rows = self.np self.num_filled_rows = self.np
def findLeastUsedNode(self, excluded_node_list = ()):
min_count = self.np + 1
min_node = None
for node, count in self.count_dict.iteritems():
if min_count > count \
and node not in excluded_node_list \
and node.isRunning():
min_node = node
min_count = count
return min_node
def dropNodeList(self, node_list, simulate=False): def dropNodeList(self, node_list, simulate=False):
partition_list = [] partition_list = []
change_list = [] change_list = []
......
...@@ -51,34 +51,6 @@ class MasterPartitionTableTests(NeoUnitTestBase): ...@@ -51,34 +51,6 @@ class MasterPartitionTableTests(NeoUnitTestBase):
self.assertFalse(pt.operational()) self.assertFalse(pt.operational())
self.assertFalse(pt.filled()) self.assertFalse(pt.filled())
def test_11_findLeastUsedNode(self):
num_partitions = 5
num_replicas = 2
pt = PartitionTable(num_partitions, num_replicas)
# add nodes
uuid1 = self.getStorageUUID()
server1 = ("127.0.0.1", 19001)
sn1 = StorageNode(Mock(), server1, uuid1, NodeStates.RUNNING)
pt.setCell(0, sn1, CellStates.UP_TO_DATE)
pt.setCell(1, sn1, CellStates.UP_TO_DATE)
pt.setCell(2, sn1, CellStates.UP_TO_DATE)
uuid2 = self.getStorageUUID()
server2 = ("127.0.0.2", 19001)
sn2 = StorageNode(Mock(), server2, uuid2, NodeStates.RUNNING)
pt.setCell(0, sn2, CellStates.UP_TO_DATE)
pt.setCell(1, sn2, CellStates.UP_TO_DATE)
uuid3 = self.getStorageUUID()
server3 = ("127.0.0.3", 19001)
sn3 = StorageNode(Mock(), server3, uuid3, NodeStates.RUNNING)
pt.setCell(0, sn3, CellStates.UP_TO_DATE)
# test
node = pt.findLeastUsedNode()
self.assertEqual(node, sn3)
node = pt.findLeastUsedNode((sn3, ))
self.assertEqual(node, sn2)
node = pt.findLeastUsedNode((sn3, sn2))
self.assertEqual(node, sn1)
def test_13_outdate(self): def test_13_outdate(self):
# create nodes # create nodes
uuid1 = self.getStorageUUID() uuid1 = self.getStorageUUID()
......
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