agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Fix sequence synchronization failure on a concurrent refresh.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix sequence synchronization failure on a concurrent refresh.
@ 2026-09-23 06:09  Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Amit Kapila @ 2026-09-23 06:09 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/dca73f7dd03ddfc89a88019659fc0161e0427a8c

Modified Files
--------------
src/backend/commands/subscriptioncmds.c        |  6 ++++
src/backend/replication/logical/sequencesync.c | 50 ++++++++++++++++++++++++--
2 files changed, 53 insertions(+), 3 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix sequence synchronization failure on a concurrent refresh.
@ 2026-09-23 06:09  Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Amit Kapila @ 2026-09-23 06:09 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-09-23 06:09 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-23 06:09 pgsql: Fix sequence synchronization failure on a concurrent refresh. Amit Kapila <akapila@postgresql.org>
2026-09-23 06:09 pgsql: Fix sequence synchronization failure on a concurrent refresh. Amit Kapila <akapila@postgresql.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox