Skip to content

Commit 695240d

Browse files
authored
Fix DB query on startup for negative streams. (#8447)
For negative streams we have to negate the internal stream ID before querying the DB. The effect of this bug was to query far too many rows, slowing start up time, but we would correctly filter the results afterwards so there was no ill effect.
1 parent 34ff8da commit 695240d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

changelog.d/8447.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix DB query on startup for negative streams which caused long start up times. Introduced in #8374.

synapse/storage/util/id_generators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def _load_current_ids(
341341
"cmp": "<=" if self._positive else ">=",
342342
}
343343
sql = self._db.engine.convert_param_style(sql)
344-
cur.execute(sql, (min_stream_id,))
344+
cur.execute(sql, (min_stream_id * self._return_factor,))
345345

346346
self._persisted_upto_position = min_stream_id
347347

0 commit comments

Comments
 (0)