Merge "Sanify handoff search depth with non-integer replica counts"
This commit is contained in:
commit
57603b7c58
@ -411,7 +411,7 @@ class ObjectController(Controller):
|
||||
"""
|
||||
|
||||
primary_nodes = ring.get_part_nodes(partition)
|
||||
num_locals = self.app.write_affinity_node_count(ring)
|
||||
num_locals = self.app.write_affinity_node_count(len(primary_nodes))
|
||||
is_local = self.app.write_affinity_is_local_fn
|
||||
|
||||
if is_local is None:
|
||||
|
@ -140,10 +140,10 @@ class Application(object):
|
||||
value = conf.get('request_node_count', '2 * replicas').lower().split()
|
||||
if len(value) == 1:
|
||||
value = int(value[0])
|
||||
self.request_node_count = lambda r: value
|
||||
self.request_node_count = lambda replicas: value
|
||||
elif len(value) == 3 and value[1] == '*' and value[2] == 'replicas':
|
||||
value = int(value[0])
|
||||
self.request_node_count = lambda r: value * r.replica_count
|
||||
self.request_node_count = lambda replicas: value * replicas
|
||||
else:
|
||||
raise ValueError(
|
||||
'Invalid request_node_count value: %r' % ''.join(value))
|
||||
@ -166,10 +166,10 @@ class Application(object):
|
||||
'2 * replicas').lower().split()
|
||||
if len(value) == 1:
|
||||
value = int(value[0])
|
||||
self.write_affinity_node_count = lambda r: value
|
||||
self.write_affinity_node_count = lambda replicas: value
|
||||
elif len(value) == 3 and value[1] == '*' and value[2] == 'replicas':
|
||||
value = int(value[0])
|
||||
self.write_affinity_node_count = lambda r: value * r.replica_count
|
||||
self.write_affinity_node_count = lambda replicas: value * replicas
|
||||
else:
|
||||
raise ValueError(
|
||||
'Invalid write_affinity_node_count value: %r' % ''.join(value))
|
||||
@ -478,7 +478,7 @@ class Application(object):
|
||||
primary_nodes = self.sort_nodes(
|
||||
list(itertools.islice(node_iter, num_primary_nodes)))
|
||||
handoff_nodes = node_iter
|
||||
nodes_left = self.request_node_count(ring)
|
||||
nodes_left = self.request_node_count(len(primary_nodes))
|
||||
|
||||
for node in primary_nodes:
|
||||
if not self.error_limited(node):
|
||||
|
@ -45,7 +45,7 @@ class TestObjControllerWriteAffinity(unittest.TestCase):
|
||||
self.app = proxy_server.Application(
|
||||
None, FakeMemcache(), account_ring=FakeRing(),
|
||||
container_ring=FakeRing(), object_ring=FakeRing(max_more_nodes=9))
|
||||
self.app.request_node_count = lambda ring: 10000000
|
||||
self.app.request_node_count = lambda replicas: 10000000
|
||||
self.app.sort_nodes = lambda l: l # stop shuffling the primary nodes
|
||||
|
||||
def test_iter_nodes_local_first_noops_when_no_affinity(self):
|
||||
|
Loading…
Reference in New Issue
Block a user