Re: [PoC] pg_upgrade: allow to upgrade publisher node

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>
Subject: Re: [PoC] pg_upgrade: allow to upgrade publisher node
Date: 2023-08-14 02:27:20
Message-ID: CAD21AoCLhEsPGH0LaVcqqE_F8VV8XaYsOcW2TQh=bnk0XijUZw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 12, 2023, 15:20 Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:

> On Fri, Aug 11, 2023 at 11:38 PM Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> >
> > On Fri, Aug 11, 2023 at 10:46:31AM +0530, Amit Kapila wrote:
> > > On Thu, Aug 10, 2023 at 7:07 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
> wrote:
> > > > What I imagined is that we do this check before
> > > > check_and_dump_old_cluster() while the server is 'off'. Reading the
> > > > slot state file would be simple and I guess we would not need a tool
> > > > or cli program for that. We need to expose RepliactionSlotOnDisk,
> > > > though.
> > >
> > > Won't that require a lot of version-specific checks as across versions
> > > the file format could be different? For the case of the control file,
> > > we use version-specific pg_controldata (for the old cluster, the
> > > corresponding version's pg_controldata) utility to read the old
> > > version control file. I thought we need something similar here if we
> > > want to do what you are suggesting.
> >
> > You mean the slot file format?
>
> Yes.
>
> >
> > We will need that complexity somewhere,
> > so why not in pg_upgrade?
> >
>
> I don't think we need the complexity of version-specific checks if we
> do what we do in get_control_data(). Basically, invoke
> version-specific pg_replslotdata to get version-specific slot
> information. There has been a proposal for a tool like that [1]. Do
> you have something better in mind? If so, can you please explain the
> same a bit more?
>

Yeah, we need something like pg_replslotdata. If there are other useful
usecases for this tool, it would be good to have it. But I'm not sure other
than pg_upgrade usecase.

Another idea is (which might have already discussed thoguh) that we check
if the latest shutdown checkpoint LSN in the control file matches the
confirmed_flush_lsn in pg_replication_slots view. That way, we can ensure
that the slot has consumed all WAL records before the last shutdown. We
don't need to worry about WAL records generated after starting the old
cluster during the upgrade, at least for logical replication slots.

Regards,

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2023-08-14 02:41:56 Extending SMgrRelation lifetimes
Previous Message Michael Paquier 2023-08-14 01:37:37 Re: pg_waldump vs. all-zeros WAL files; server creation of such files