| From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
|---|---|
| To: | vignesh C <vignesh21(at)gmail(dot)com> |
| Cc: | Dilip Kumar <dilipbalaut(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:01:24 |
| Message-ID: | CAA4eK1LX+6JW3pkGFBqfttD265aTeyGLYNAAn2Wq6cPoFuzaRw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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.
--
With Regards,
Amit Kapila.
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Ajin Cherian | 2026-12-02 03:42:09 | Re: Exported snapshot of CREATE_REPLICATION_SLOT can lose tuples to pruning |