agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix sequence synchronization failure on a concurrent refresh.
Date: Wed, 23 Sep 2026 06:09:13 +0000
Message-ID: <E1x9GAL-00000000sAM-1uel@gemulon.postgresql.org> (raw)
Fix sequence synchronization failure on a concurrent refresh.
A sequencesync worker builds its list of sequences and then processes them
in batches. If ALTER SUBSCRIPTION ... REFRESH PUBLICATION removes one of
those sequences in the meantime, the worker updated the local sequence and
then failed while marking it READY, because its catalog row was gone. That
rolled back the batch, and with disable_on_error the entire subscription
was disabled.
The worker now checks that the sequence is still part of the subscription
before updating it, and skips it if not. The check is done under the lock
on the subscription that the refresh also takes, so the row cannot go away
in between.
Reported-by: Nikolay Samokhvalov <nik@postgres.ai>
Author: vignesh C <vignesh21@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/CAM527d9mL-bOofX-G7Sp441vA3Y_fa_7JBh03m-ZPduikn_XUg@mail.gmail.com
Backpatch-through: 19, where it was introduced
Branch
------
REL_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/883da6d2c28aadbe07044386511e0d900c020cd8
Modified Files
--------------
src/backend/commands/subscriptioncmds.c | 6 ++++
src/backend/replication/logical/sequencesync.c | 50 ++++++++++++++++++++++++--
2 files changed, 53 insertions(+), 3 deletions(-)
view thread (2+ messages)
Message-ID: <E1x9GAL-00000000sAM-1uel@gemulon.postgresql.org>
Permalink: ../E1x9GAL-00000000sAM-1uel@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1x9GAL-00000000sAM-1uel@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: akapila@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix sequence synchronization failure on a concurrent refresh.
In-Reply-To: <E1x9GAL-00000000sAM-1uel@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox