From d4e4a7344f2d530a3cc41b12e05ca9bb494035fd Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 17 May 2018 15:09:31 +0100 Subject: Increase range of rebalance interval This both simplifies the code, and ensures that the target node is roughly in the center of the range rather than at an end. --- synapse/storage/chunk_ordered_table.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/synapse/storage/chunk_ordered_table.py b/synapse/storage/chunk_ordered_table.py index 442d82cbb2..d112b320a9 100644 --- a/synapse/storage/chunk_ordered_table.py +++ b/synapse/storage/chunk_ordered_table.py @@ -264,15 +264,11 @@ class ChunkDBOrderedListStore(OrderedListStore): with Measure(self.clock, "chunk_rebalance"): # We pick the interval to try and minimise the number of decimal # places, i.e. we round to nearest float with `rebalance_digits` and - # use that as the middle of the interval + # use that as one side of the interval order = self._get_order(node_id) a = round(order, self.rebalance_digits) - if order > a: - min_order = a - max_order = a + 10 ** -self.rebalance_digits - else: - min_order = a - 10 ** -self.rebalance_digits - max_order = a + min_order = a - 10 ** -self.rebalance_digits + max_order = a + 10 ** -self.rebalance_digits # Now we get all the nodes in the range. We add the minimum difference # to the bounds to ensure that we don't accidentally move a node to be -- cgit 1.4.1