public inbox for [email protected]help / color / mirror / Atom feed
pgsql: pg_createsubscriber: Fix cleanup of publisher-side objects after 3+ messages / 1 participants [nested] [flat]
* pgsql: pg_createsubscriber: Fix cleanup of publisher-side objects after @ 2026-05-27 01:36 Fujii Masao <[email protected]> 0 siblings, 0 replies; 3+ messages in thread From: Fujii Masao @ 2026-05-27 01:36 UTC (permalink / raw) To: [email protected] pg_createsubscriber: Fix cleanup of publisher-side objects after errors When pg_createsubscriber fails after creating logical replication objects, it should remove the publication and replication slot that it created on the publisher. Previously, if dropping subscriber-side objects failed, pg_createsubscriber reset its internal cleanup state too early. As a result, the exit-time cleanup could skip removing the publication or replication slot on the publisher. This could leave pg_createsubscriber-created objects behind on the publisher after a failed run. That can make a retry harder, because the leftover publication or replication slot may need to be removed manually before running pg_createsubscriber again. In the case of a replication slot, leaving it behind can also retain WAL files longer than expected. The cause of this issue was that the flags made_publication and made_replslot tracking whether pg_createsubscriber created a publication or replication slot on the primary were incorrectly reset to false when failures occurred while dropping objects on the subscriber. This commit fixes the issue by preventing those cleanup flags from being reset even when failures occurred while dropping objects on the subscriber, ensuring proper cleanup of primary objects before exit on failure. Backpatch to v17, where pg_createsubscriber was added. Author: Nisha Moond <[email protected]> Reviewed-by: David G. Johnston <[email protected]> Reviewed-by: Fujii Masao <[email protected]> Reviewed-by: Peter Smith <[email protected]> Discussion: https://postgr.es/m/CABdArM5V9QKK1PkLY9dpgAcZa3kUp84-wPqPovxvdLOri4=69w@mail.gmail.com Backpatch-through: 17 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/12d0004889e56d9883fafafc95c73a802307aaa7 Modified Files -------------- src/bin/pg_basebackup/pg_createsubscriber.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: pg_createsubscriber: Fix cleanup of publisher-side objects after @ 2026-05-27 01:36 Fujii Masao <[email protected]> 0 siblings, 0 replies; 3+ messages in thread From: Fujii Masao @ 2026-05-27 01:36 UTC (permalink / raw) To: [email protected] pg_createsubscriber: Fix cleanup of publisher-side objects after errors When pg_createsubscriber fails after creating logical replication objects, it should remove the publication and replication slot that it created on the publisher. Previously, if dropping subscriber-side objects failed, pg_createsubscriber reset its internal cleanup state too early. As a result, the exit-time cleanup could skip removing the publication or replication slot on the publisher. This could leave pg_createsubscriber-created objects behind on the publisher after a failed run. That can make a retry harder, because the leftover publication or replication slot may need to be removed manually before running pg_createsubscriber again. In the case of a replication slot, leaving it behind can also retain WAL files longer than expected. The cause of this issue was that the flags made_publication and made_replslot tracking whether pg_createsubscriber created a publication or replication slot on the primary were incorrectly reset to false when failures occurred while dropping objects on the subscriber. This commit fixes the issue by preventing those cleanup flags from being reset even when failures occurred while dropping objects on the subscriber, ensuring proper cleanup of primary objects before exit on failure. Backpatch to v17, where pg_createsubscriber was added. Author: Nisha Moond <[email protected]> Reviewed-by: David G. Johnston <[email protected]> Reviewed-by: Fujii Masao <[email protected]> Reviewed-by: Peter Smith <[email protected]> Discussion: https://postgr.es/m/CABdArM5V9QKK1PkLY9dpgAcZa3kUp84-wPqPovxvdLOri4=69w@mail.gmail.com Backpatch-through: 17 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/196b4b5ae612cc45a95fabf6248b3dfe389cf770 Modified Files -------------- src/bin/pg_basebackup/pg_createsubscriber.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: pg_createsubscriber: Fix cleanup of publisher-side objects after @ 2026-05-27 01:36 Fujii Masao <[email protected]> 0 siblings, 0 replies; 3+ messages in thread From: Fujii Masao @ 2026-05-27 01:36 UTC (permalink / raw) To: [email protected] pg_createsubscriber: Fix cleanup of publisher-side objects after errors When pg_createsubscriber fails after creating logical replication objects, it should remove the publication and replication slot that it created on the publisher. Previously, if dropping subscriber-side objects failed, pg_createsubscriber reset its internal cleanup state too early. As a result, the exit-time cleanup could skip removing the publication or replication slot on the publisher. This could leave pg_createsubscriber-created objects behind on the publisher after a failed run. That can make a retry harder, because the leftover publication or replication slot may need to be removed manually before running pg_createsubscriber again. In the case of a replication slot, leaving it behind can also retain WAL files longer than expected. The cause of this issue was that the flags made_publication and made_replslot tracking whether pg_createsubscriber created a publication or replication slot on the primary were incorrectly reset to false when failures occurred while dropping objects on the subscriber. This commit fixes the issue by preventing those cleanup flags from being reset even when failures occurred while dropping objects on the subscriber, ensuring proper cleanup of primary objects before exit on failure. Backpatch to v17, where pg_createsubscriber was added. Author: Nisha Moond <[email protected]> Reviewed-by: David G. Johnston <[email protected]> Reviewed-by: Fujii Masao <[email protected]> Reviewed-by: Peter Smith <[email protected]> Discussion: https://postgr.es/m/CABdArM5V9QKK1PkLY9dpgAcZa3kUp84-wPqPovxvdLOri4=69w@mail.gmail.com Backpatch-through: 17 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c03784a2181594d150c7f486308172dee19c5321 Modified Files -------------- src/bin/pg_basebackup/pg_createsubscriber.c | 2 -- 1 file changed, 2 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-05-27 01:36 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-05-27 01:36 pgsql: pg_createsubscriber: Fix cleanup of publisher-side objects after Fujii Masao <[email protected]> 2026-05-27 01:36 pgsql: pg_createsubscriber: Fix cleanup of publisher-side objects after Fujii Masao <[email protected]> 2026-05-27 01:36 pgsql: pg_createsubscriber: Fix cleanup of publisher-side objects after Fujii Masao <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox