Skip to content

Commit ba41526

Browse files
committed
Add comment to MultiWriterIdGenerator about cursed sequence semantics
1 parent 5b105f5 commit ba41526

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

synapse/storage/util/id_generators.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,12 @@ class MultiWriterIdGenerator(AbstractStreamIdGenerator):
187187
Warning: Streams using this generator start at ID 2, because ID 1 is always assumed
188188
to have been 'seen as persisted'.
189189
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`.
190+
When creating a new sequence for a new stream, it will be necessary to advance it
191+
so that position 1 is consumed.
192+
DO NOT USE `START WITH 2` FOR THIS PURPOSE:
193+
see https://github.com/element-hq/synapse/issues/18712
194+
Instead, use `SELECT nextval('sequence_name');` immediately after the
195+
`CREATE SEQUENCE` statement.
192196
193197
Args:
194198
db_conn

0 commit comments

Comments
 (0)