summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-05-17 15:09:31 +0100
committerErik Johnston <erik@matrix.org>2018-05-17 15:09:31 +0100
commitd4e4a7344f2d530a3cc41b12e05ca9bb494035fd (patch)
treecd080d2bfdc7a110fe0496e86d076674d12831d1
parentImprove documentation and comments (diff)
downloadsynapse-d4e4a7344f2d530a3cc41b12e05ca9bb494035fd.tar.xz
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.
-rw-r--r--synapse/storage/chunk_ordered_table.py10
1 files 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