Commit 17692b76 authored by Grégory Wisniewski's avatar Grégory Wisniewski

A node must must never be down or broken when used in the partition table.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2429 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent ddb23fcf
......@@ -159,7 +159,7 @@ class PartitionTable(object):
if state == CellStates.DISCARDED:
return self.removeCell(offset, node)
if node.isBroken() or node.isDown():
return
raise PartitionTableException('Invalid node state')
self.count_dict.setdefault(node, 0)
row = self.partition_list[offset]
......
......@@ -18,7 +18,7 @@
import unittest
from mock import Mock
from neo.protocol import NodeStates, CellStates
from neo.pt import Cell, PartitionTable
from neo.pt import Cell, PartitionTable, PartitionTableException
from neo.node import StorageNode
from neo.tests import NeoUnitTestBase
......@@ -113,12 +113,14 @@ class PartitionTableTests(NeoUnitTestBase):
self.assertEqual(len(pt.partition_list[x]), 0)
self.assertEqual(pt.count_dict[sn1], 0)
sn1.setState(NodeStates.BROKEN)
pt.setCell(0, sn1, CellStates.UP_TO_DATE)
self.assertRaises(PartitionTableException, pt.setCell,
0, sn1, CellStates.UP_TO_DATE)
for x in xrange(num_partitions):
self.assertEqual(len(pt.partition_list[x]), 0)
self.assertEqual(pt.count_dict[sn1], 0)
sn1.setState(NodeStates.DOWN)
pt.setCell(0, sn1, CellStates.UP_TO_DATE)
self.assertRaises(PartitionTableException, pt.setCell,
0, sn1, CellStates.UP_TO_DATE)
for x in xrange(num_partitions):
self.assertEqual(len(pt.partition_list[x]), 0)
self.assertEqual(pt.count_dict[sn1], 0)
......
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