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: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: Ajin Cherian <itsajin(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-19 09:26:41
Message-ID: CAJpy0uDzcsnUSX+tGh-TDgAMek8+VG3XyhCVs8+FVP1y+wL65A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 19, 2026 at 4:32 AM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> Hi Shveta.
>
> Patch v3-0001 is unchanged, so it still LGTM.
>
> Below are some comments for v3-0002 (docs).
>
> ======
> src/sgml/ref/create_subscription.sgml
>
> 1.
> + <note>
> + <para>
> + If the error persists, the subscription is disabled again as soon
> + as it is re-enabled. For example, if initial table synchronization
> + fails because the table was dropped on the publisher or removed
> + from the publication,
> + <link
> linkend="sql-altersubscription-params-refresh-publication"><command>ALTER
> SUBSCRIPTION ... REFRESH PUBLICATION</command></link>
> + is needed to remove it from the subscription. However, this
> + command is not allowed while the subscription is disabled. ...
>
> IMO the "For example" doesn't seem to illustrate the preceding
> sentence. The sentence says the subscription keeps getting disabled,
> but the example jumps straight to a cause (table dropped/unpublished)
> and then to the fix (REFRESH PUBLICATION). It never says that this is
> a case where the error recurs, so the subscription keeps disabling
> itself.
>
> There're a couple of other minor nits -- e.g. "as soon as it is
> re-enabled" is not quite accurate. The subscription is only disabled
> again after the worker hits the error again, not at the moment it is
> enabled.
>
> My LLM came up with some reworded text split into example and
> workaround paragraphs, which I think is better.
>
> SUGGESTION
>
> <note>
> <para>
> If the underlying cause is not resolved, the subscription is disabled again
> shortly after it is re-enabled. For example, if initial table
> synchronization fails because the table was dropped on the publisher or
> removed from the publication, the same error recurs each time the
> synchronization is retried.
> </para>
> <para>
> In that case,
> <link linkend="sql-altersubscription-params-refresh-publication"><command>ALTER
> SUBSCRIPTION ... REFRESH PUBLICATION</command></link>
> is needed to remove the table from the subscription, but it cannot be run
> while the subscription is disabled. To work around this, either fix the
> cause on the publisher before re-enabling the subscription, or temporarily
> set <literal>disable_on_error</literal> to <literal>false</literal>,
> re-enable the subscription using
> <link linkend="sql-altersubscription-params-enable"><command>ALTER
> SUBSCRIPTION ... ENABLE</command></link>,
> run <command>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</command>, and then
> set <literal>disable_on_error</literal> back to <literal>true</literal>.
> </para>
> </note>
>
> ~~~
>
> 2.
> But is this the best place for describing the disable_on_error
> workaround? A user who hits the REFRESH PUBLICATION restriction is
> probably going to be looking at the ALTER SUBSCRIPTION docs, so maybe
> the workaround details belong there?
>

Agreed on both points, and thanks for the suggested text. I’ve used it
with a few small tweaks, split across the two pages; please have a
look.
I used “the same error recurs each time the subscription is
re-enabled” instead of “each time the synchronization is retried”,
since with disable_on_error the sync is not retried until the
subscription is re-enabled.
I also used “To resolve this” instead of “To work around this”, since
one of the two options (fixing the cause on the publisher) is an
actual fix, so “resolve” covers both. Changes are in v4 posted
earlier.

thanks
Shveta

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-11-19 09:37:35 Fire event triggers for relations created by EXPLAIN ANALYZE (CTAS, SELECT INTO, MAT VIEW)
Previous Message shveta malik 2026-11-19 09:21:52 Re: Initial table sync copies the whole table when it is no longer published