Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 8327c7d

Browse files
author
Mathieu Velten
committed
Make sequence cache_invalidation_stream_seq begins at 2
Signed-off-by: Mathieu Velten <mathieuv@matrix.org>
1 parent 3d9f82e commit 8327c7d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

changelog.d/13766.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make sequence cache_invalidation_stream_seq begins at 2.

synapse/storage/schema/main/delta/58/05cache_instance.sql.postgres

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ CREATE TABLE cache_invalidation_stream_by_instance (
2727

2828
CREATE UNIQUE INDEX cache_invalidation_stream_by_instance_id ON cache_invalidation_stream_by_instance(stream_id);
2929

30-
CREATE SEQUENCE cache_invalidation_stream_seq;
30+
# The sequence needs to begin at 2 because a bunch of code assume that
31+
# get_next_id_txn will return values >= 2, cf this comment:
32+
# https://github.com/matrix-org/synapse/blob/b93bd95e8ab64d27ae26841020f62ee61272a5f2/synapse/storage/util/id_generators.py#L344
33+
CREATE SEQUENCE cache_invalidation_stream_seq MINVALUE 2;

0 commit comments

Comments
 (0)