Re: Preserve conflict log table during upgrade

From: shveta malik <shveta(dot)malik(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, shveta malik <shvetamalik(at)gmail(dot)com>
Subject: Re: Preserve conflict log table during upgrade
Date: 2026-12-02 05:32:24
Message-ID: CAJpy0uCteC514XeyYG5fEitgcyLmWCXwu6pVVzJHaYH+s0ySzQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 2, 2026 at 9:31 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Wed, Dec 2, 2026 at 7:57 AM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> >
> > On Tue, 1 Dec 2026 at 17:38, Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
> > >
> > > I reviewed v4, the core design looks fine, and I only have some
> > > comments in below code
> > >
> > > > @@ -1999,6 +2010,24 @@ selectDumpableNamespace(NamespaceInfo *nsinfo, Archive *fout)
> > > > + else if (strcmp(nsinfo->dobj.name, "pg_conflict") == 0)
> > > > + {
> > > > + if (fout->dopt->binary_upgrade)
> > > > + {
> > > > + nsinfo->dobj.dump = DUMP_COMPONENT_ACL;
> > > > + nsinfo->dobj.dump_contains = DUMP_COMPONENT_ALL;
> > > > + }
> > > > + else
> > > > + nsinfo->dobj.dump_contains = nsinfo->dobj.dump = DUMP_COMPONENT_NONE;
> > > > + }
> > >
> > > When pg_dump is invoked with --binary-upgrade --no-subscriptions,
> > > getSubscriptions() bail out early, but selectDumpableNamespace() still
> > > marks pg_conflict's contents as DUMP_COMPONENT_ALL. As a result,
> > > pg_dump still issues LOCK TABLE pg_conflict.pg_conflict_log_<oid> IN
> > > ACCESS SHARE MODE and fetches their metadata/ACLs/comments/stats, only
> > > for _tocEntryRequired() to discard those TOC entries afterward. Shall
> > > we change that?
> >
> > Yes, no need to do the additional processing for the entries that will
> > never be dumped, here is a v5 version patch including the changes for
> > the same.
> >
>
> + * Also dump nothing with --no-subscriptions, as the subscriptions are
> + * not dumped.
> + */
> + if (fout->dopt->binary_upgrade && !fout->dopt->no_subscriptions)
> + {
> + nsinfo->dobj.dump = DUMP_COMPONENT_ACL;
> + nsinfo->dobj.dump_contains = DUMP_COMPONENT_ALL;
> + }
>
> I don't think the above extra '--no-subscriptions' check is needed.
> pg_upgrade never passes --no-subscriptions, and --binary-upgrade is
> documented as only for upgrade utilities, so the combination is not a
> practical use case. The additional cost is not that much and even
> after this we can't remove the change in _tocEntryRequired as that is
> required for pg_restore. Additionally, this new change will avoid even
> dumping ACL on pg_conflict which is not directly related to
> --no-subscriptions option.

I agree.

v4 LGTM, only a minor thing:

In doc we have:
The
+ table is managed by the system together with the subscription, and its name
+ is derived from the subscription's OID, which is different after a restore.

I think, "which is different after a restore" should be "which can be
different", since a fresh cluster can assign the same OID.

But this can be handled during commit, not expecting a new
patch-version for this.

thanks
Shveta

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message solai v 2026-12-02 05:34:45 Re: Support named (destination) portals in extended proto for psql meta commands.
Previous Message Fujii Masao 2026-12-02 05:22:30 Re: EXPLAIN ANALYZE CREATE TABLE AS EXECUTE runs non-SELECT prepared statements