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: Ajin Cherian <itsajin(at)gmail(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, vignesh C <vignesh21(at)gmail(dot)com>, 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-18 03:39:56
Message-ID: CAJpy0uBdRvDpVkFnTsiATajw9Nrw=hYZxVUGv5hGfU931X+L2w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 18, 2026 at 9:08 AM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
>
> On Wed, Nov 18, 2026 at 6:42 AM Ajin Cherian <itsajin(at)gmail(dot)com> wrote:
> >
> > On Tue, Nov 17, 2026 at 9:03 PM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
> > >
> > > Yes, the ERROR repeats until it is resolved, but that is the same
> > > behaviour as other tablesync errors (e.g. "table \"%s.%s\" not found
> > > on publisher"). The errors are also counted in
> > > pg_stat_subscription_stats, so users can monitor them.
> > >
> > > With the ERROR, the table stays in the 'd' (data sync) state, which is
> > > the correct state IMO. With a WARNING and skip, the table would
> > > wrongly be marked 'ready' instead, so its initial data would never be
> > > copied, even after a REFRESH PUBLICATION (provided the table is added
> > > back or the publication is created).
> > >
> > Hi Shveta,
> >
> > Just curious: with disable_on_error = true, this ERROR would disable
> > the whole subscription, and REFRESH PUBLICATION isn't allowed on a
> > disabled subscription. How would the user get out of that? If the user
> > re-enables the subscription, it's a race between the tablesync worker
> > hitting the error again and the user running REFRESH PUBLICATION.
>
> Good point Ajin. I did not think of it earlier, but on analysing it
> now, I think there is a way out without the race: since
> disable_on_error can be changed on a disabled sub, the user can
> temporarily set 'disable_on_error=false' on disabled sub, then ENABLE
> the sub, then REFRESH PUBLICATION, and then set disable_on_error back
> to true. I tested this with the patch, and it works.

I missed mentioning that alternatively, the table can be published
again on the publisher before re-enabling (if necessary).

> > I understand the same is true of other tablesync errors caused by
> > publisher-side changes (e.g. "table ... not found on publisher"), so
> > this isn't really related to this patch. But maybe we should document
> > somewhere how to get out of such situations.
> >
>
> As you said, this applies to all tablesync errors caused by
> publisher-side changes, so I think documenting it would be better done
> separately,e.g. as a note in the disable_on_error description?
> Thoughts? But if others feel that we can combine it in this patch, I
> am okay to do that.
>
> thanks
> Shveta

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message solai v 2026-11-18 04:12:06 Re: Wrong varnullingrels for MERGE into a trigger-updatable view
Previous Message shveta malik 2026-11-18 03:38:47 Re: Initial table sync copies the whole table when it is no longer published