From 0ce5dce42b32b8eadc94ea5a87b6ce983e0e82c1 Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Mon, 21 Jul 2025 18:30:21 +0100 Subject: [PATCH] Fix thread_subscriptions stream sequence Works around https://github.com/element-hq/synapse/issues/18712 --- ...hread_subscriptions_seq_fixup.sql.postgres | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 synapse/storage/schema/main/delta/92/08_thread_subscriptions_seq_fixup.sql.postgres diff --git a/synapse/storage/schema/main/delta/92/08_thread_subscriptions_seq_fixup.sql.postgres b/synapse/storage/schema/main/delta/92/08_thread_subscriptions_seq_fixup.sql.postgres new file mode 100644 index 0000000000..d327d1e165 --- /dev/null +++ b/synapse/storage/schema/main/delta/92/08_thread_subscriptions_seq_fixup.sql.postgres @@ -0,0 +1,19 @@ +-- +-- This file is licensed under the Affero General Public License (AGPL) version 3. +-- +-- Copyright (C) 2025 New Vector, Ltd +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU Affero General Public License as +-- published by the Free Software Foundation, either version 3 of the +-- License, or (at your option) any later version. +-- +-- See the GNU Affero General Public License for more details: +-- . + +-- Work around https://github.com/element-hq/synapse/issues/18712 by advancing the +-- stream sequence. +-- This makes last_value of the sequence point to a position that will not get later +-- returned by nextval. +-- (For blank thread subscription streams, this means last_value = 2, nextval() = 3 after this line.) +SELECT nextval('thread_subscriptions_sequence');