Skip to content

Commit 79ecd7c

Browse files
committed
aside: add warnings about MultiWriterIdGenerator starting at 2
1 parent 515941d commit 79ecd7c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

synapse/storage/util/id_generators.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ class MultiWriterIdGenerator(AbstractStreamIdGenerator):
184184
185185
Note: Only works with Postgres.
186186
187+
Warning: Streams using this generator start at ID 2, because ID 1 is always assumed
188+
to have been 'seen as persisted'.
189+
Unclear if this extant behaviour is desirable for some reason.
190+
When creating a new sequence for a new stream,
191+
it will be necessary to use `START WITH 2`.
192+
187193
Args:
188194
db_conn
189195
db
@@ -269,6 +275,9 @@ def __init__(
269275
self._known_persisted_positions: List[int] = []
270276

271277
# The maximum stream ID that we have seen been allocated across any writer.
278+
# Since this defaults to 1, this means that ID 1 is assumed to have already
279+
# been 'seen'. In other words, multi-writer streams start at 2.
280+
# Unclear if this is desirable behaviour.
272281
self._max_seen_allocated_stream_id = 1
273282

274283
# The maximum position of the local instance. This can be higher than

0 commit comments

Comments
 (0)