Re: Dropping publication breaks logical replication

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: Re: Dropping publication breaks logical replication
Date: 2025-08-04 12:32:13
Message-ID: CALDaNm17ANGVbw+ta1s764kv-k-s=Rt=anpxbE=fit32BHigmw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 4 Aug 2025 at 16:08, vignesh C <vignesh21(at)gmail(dot)com> wrote:
>
> On Mon, 4 Aug 2025 at 09:47, Ashutosh Bapat
> <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:
> >
> > Hi Vignesh,
> > Thanks for the patches.
> >
> > On Sat, Aug 2, 2025 at 7:10 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> >
> > > >
> > > > The backport seems to be straight forward. Please let me know if you
> > > > need my help in doing so, if we decide to backport the fix.
> > >
> > > Now that this has been reported on the back branches, we should
> > > consider whether it's appropriate to backport the fix. Here are the
> > > patches prepared for the back branches.
> >
> > PG14 and + patches do not test that DROP PUBLICATION does not disrupt
> > the publication. I think we need to test that as well.
>
> Currently, the test across all branches except PG13 is the same test
> used in the master branch. For PG13, since there was no existing
> subscription, I modified the test slightly to accommodate that. If I
> handle the comment you suggest, the test in master and the backbranch
> will be different. Should we keep the test similar to the master or is
> it ok to address your above comment and keep it different?
>
> > PG13 tests DROP PUBLICATION OTOH. That's good. I think it has a race
> > condition because +my $offset = -s $node_publisher->logfile; is
> > executed after dropping the publication. If some background change
> > triggers publication validation before capturing the file offset, we
> > might miss the WARNING and the test will fail. Instead capturing
> > offset before dropping publication may be safer - the publication
> > exists till it dropped, so the log file cannot have WARNING in there
> > when offset is captured.
>
> I will handle this in the next version.

This is addressed in the attached patch. Only the PG13 branch patch is
updated, there is no change in other branch patches.

Regards,
Vignesh

Attachment Content-Type Size
v1_PG17-0001-Fix-ALTER-SUBSCRIPTION-.-SET-PUBLICATION-.-c.patch text/x-patch 5.5 KB
v1_PG15-0001-Fix-ALTER-SUBSCRIPTION-.-SET-PUBLICATION-.-c.patch text/x-patch 5.5 KB
v1_PG14-0001-Fix-ALTER-SUBSCRIPTION-.-SET-PUBLICATION-.-c.patch text/x-patch 5.6 KB
v1_PG16-0001-Fix-ALTER-SUBSCRIPTION-.-SET-PUBLICATION-.-c.patch text/x-patch 5.5 KB
v2_PG13-0001-Fix-ALTER-SUBSCRIPTION-.-SET-PUBLICATION.patch text/x-patch 5.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2025-08-04 12:33:00 Re: GB18030-2022 Support in PostgreSQL
Previous Message Álvaro Herrera 2025-08-04 12:31:05 Re: More protocol.h replacements this time into walsender.c