Re: Preserve conflict log table during upgrade

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, shveta malik <shveta(dot)malik(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 04:50:16
Message-ID: CAFiTN-upFSmg8D4sVzf1LH8wj2xYfkgh2NtMb7_gOVYsQpDWOg@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.

Fair point. Since pg_upgrade never passes --no-subscriptions and
_tocEntryRequired() already filters the conflict log table TOC entries
for pg_dump. I'm fine leaving selectDumpableNamespace() as is.

--
Regards,
Dilip Kumar
Google

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Sabino Mullane 2026-12-02 05:14:25 Re: [PROPOSAL] Extension: searchable encrypted column type with externally supplied crypto
Previous Message Tristan Su 2026-12-02 04:47:36 Re: [PATCH] Reuse slot helpers in pg_get_replication_slots and slot copy