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

From: vignesh C <vignesh21(at)gmail(dot)com>
To: shveta malik <shveta(dot)malik(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-22 04:01:11
Message-ID: CALDaNm3=kis8uyYEUOX3_XHKeD4=m=2v8+_k+ct-6zZ33REd=Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 20 Nov 2026 at 09:02, shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
>
> 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?

Yes, that is fine with me. Added a CFentry for this at [1].
[1] - https://commitfest.postgresql.org/patch/7683/

Regards,
Vignesh

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message jian he 2026-11-22 00:40:31 Re: Rework: Enable fast default for domains with non-volatile constraints