| From: | Amit Kapila <akapila(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix sequence synchronization failure on a concurrent refresh. |
| Date: | 2026-09-23 06:09:13 |
| Message-ID: | E1x9GAL-00000000sAM-1uel@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(at)postgres(dot)ai>
Author: vignesh C <vignesh21(at)gmail(dot)com>
Reviewed-by: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Reviewed-by: Zhijie Hou <houzj(dot)fnst(at)fujitsu(dot)com>
Reviewed-by: Andrey Borodin <x4mmm(at)yandex-team(dot)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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2026-09-23 07:32:22 | pgsql: pgindent: Fix indentation of alignas() in struct members |
| Previous Message | Melanie Plageman | 2026-09-22 22:33:26 | pgsql: Avoid replay cleanup locks for freeze-only and VM-only records |