Re: Initial table sync copies the whole table when it is no longer published

From: shveta malik <shveta(dot)malik(at)gmail(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: Ajin Cherian <itsajin(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, shveta malik <shvetamalik(at)gmail(dot)com>
Subject: Re: Initial table sync copies the whole table when it is no longer published
Date: 2026-11-20 03:32:22
Message-ID: CAJpy0uA71A7MXDQc90kV8x9USX2xx11Dm2xeHpoXCVrRwG9pPg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 19, 2026 at 4:03 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
>
> On Thu, 19 Nov 2026 at 14:52, shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
> >
> > > 2. The REFRESH PUBLICATION block can be removed:
> > > +# REFRESH PUBLICATION removes the tables from the subscription.
> > > +$node_subscriber->safe_psql('postgres',
> > > + "ALTER SUBSCRIPTION tap_sub_2 REFRESH PUBLICATION");
> > > +
> > > +$result = $node_subscriber->safe_psql('postgres',
> > > + "SELECT count(*) FROM pg_subscription_rel WHERE srrelid IN
> > > ('tab_4'::regclass, 'tab_5'::regclass)"
> > > +);
> > > +is($result, qq(0),
> > > + 'check that REFRESH PUBLICATION removes the tables from the
> > > subscription');
> > >
> > > 025_rep_changes_for_schema.pl already checks that tables are removed
> > > from pg_subscription_rel after REFRESH
> > > PUBLICATION.
> >
> > I gave it some thought; I think we should keep it. Both the errhint
> > and the doc patch suggest REFRESH PUBLICATION as the way to recover,
> > so it seems good to test that it works in exactly the state this fix
> > leaves behind, i.e. tables whose initial sync failed and are still in
> > DATASYNC. 025 only removes tables that are already READY. What do you
> > say?
>
> I'm fine with it.
>
> This issue is applicable to back branches also, can you share back
> branch patches too.

Sure, I can share the back-branch patches once a committer approves
the proposed approach. I wanted to check whether anyone has any
objections to the approach itself.

Also, I am not very sure if we really need to backpatch this? I
noticed that a similar fix targeting the apply worker (commit 7c99dc5)
was not backpatched, with the following rationale: "We decided not to
backpatch this as this is a behaviour change, and we don't see field
reports."

So shall we wait little longer for further feedback?

thanks
Shveta

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2026-11-20 03:33:28 Re: Hash aggregate collisions cause excessive spilling
Previous Message Chao Li 2026-11-20 03:28:53 Re: EXPLAIN ANALYZE CREATE TABLE AS EXECUTE runs non-SELECT prepared statements