From: | Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com> |
---|---|
To: | Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | Re: pgsql: Implement pg_wal_replay_wait() stored procedure |
Date: | 2024-10-23 06:01:49 |
Message-ID: | CALT9ZEERNvqJ1iDk==G_B-ZZXUBZROaEptR-zUC4mHC+iUmHUQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Hi, Alexander!
On Wed, 23 Oct 2024 at 00:12, Alexander Korotkov <aekorotkov(at)gmail(dot)com>
wrote:
> Hi, Pavel!
>
> Thank you for your review.
>
> On Tue, Oct 22, 2024 at 4:30 PM Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>
> wrote:
> > On Tue, 22 Oct 2024 at 13:26, Alexander Korotkov <aekorotkov(at)gmail(dot)com>
> wrote:
> >>
> >> On Wed, Oct 16, 2024 at 11:20 PM Alexander Korotkov
> >> <aekorotkov(at)gmail(dot)com> wrote:
> >> >
> >> > On Wed, Oct 16, 2024 at 10:35 PM Peter Eisentraut <
> peter(at)eisentraut(dot)org> wrote:
> >> > > On 02.09.24 01:55, Alexander Korotkov wrote:
> >> > > > On Mon, Sep 2, 2024 at 2:28 AM Michael Paquier <
> michael(at)paquier(dot)xyz> wrote:
> >> > > >> On Sun, Sep 01, 2024 at 10:35:27PM +0300, Alexander Korotkov
> wrote:
> >> > > >>> This path hasn't changes since the patch revision when it was a
> >> > > >>> utility command. I agree that this doesn't look like proper
> path for
> >> > > >>> stored procedure. But I don't think src/backend/utils/adt is
> >> > > >>> appropriate path either, because it's not really about data
> type.
> >> > > >>> pg_wal_replay_wait() looks a good neighbor for
> >> > > >>> pg_wal_replay_pause()/pg_wal_replay_resume() and other
> WAL-related
> >> > > >>> functions. So, what about moving it to
> src/backend/access/transam?
> >> > > >>
> >> > > >> Moving the new function to xlogfuncs.c while publishing
> >> > > >> WaitForLSNReplay() makes sense to me.
> >> > > >
> >> > > > Thank you for proposal. I like this.
> >> > > >
> >> > > > Could you, please, check the attached patch?
> >> > >
> >> > > We still have stuff in src/backend/commands/waitlsn.c that is
> nothing
> >> > > like a "command". You have moved some stuff elsewhere, but what
> are you
> >> > > planning to do with the rest?
> >> >
> >> > Thank you for spotting this another time. What about moving that
> >> > somewhere like src/backend/access/transam/xlogwait.c ?
> >>
> >> Implemented this as a separate patch (0001). Also rebased other
> >> pending patches on that. 0004 now revises header comment of
> >> xlogwait.c with new procedure signature.
> >
> >
> > I've looked at v5 of a patchset.
>
> > 0002:
> >
> > As stated in latch.c
> >
> > - WL_POSTMASTER_DEATH: Wait for postmaster to die
> > - WL_EXIT_ON_PM_DEATH: Exit immediately if the postmaster dies
> >
> > * wakeEvents must include either WL_EXIT_ON_PM_DEATH for automatic exit
> > * if the postmaster dies or WL_POSTMASTER_DEATH for a flag set in the
> > * return value if the postmaster dies
> >
> > It's not completely clear to me if these comments need some
> clarification (not related to the patchset), or if we should look for
> WL_EXIT_ON_PM_DEATH for immediately FATAL. Or waiting for postmaster to die
> on WL_POSTMASTER_DEATH instead of just fatal immediately?
>
> As I get from the code, WL_EXIT_ON_PM_DEATH cause process to just
> proc_exit(1) without throwing FATAL. So, in the most of situations we
> do throw FATAL after seeing WL_POSTMASTER_DEATH event. So, it's
> reasonable to do the same here. But indeed, this is a question (not
> related to this patch) whether WL_EXIT_ON_PM_DEATH should cause
> process to throw FATAL.
>
Libpq ends up with FATAL on WL_POSTMASTER_DEATH.
In a backend code on WL_POSTMASTER_DEATH: SyncRepWaitForLSN()
sets ProcDiePending but don't FATAL. Walsender exits proc_exit(1).
I suppose WL_POSTMASTER_DEATH expected behavior is "Do whatever you want:
wait for postmaster to die or end up immediately".
I think path 0002 is good.
I looked through patches v6 and I think they're all good now.
Regards,
Pavel Borisov
Supabase.
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Langote | 2024-10-23 09:04:59 | pgsql: Remove unnecessary word in a comment |
Previous Message | Tom Lane | 2024-10-23 03:18:34 | Re: pgsql: Add functions pg_set_attribute_stats() and pg_clear_attribute_st |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2024-10-23 06:10:19 | Re: Set query_id for query contained in utility statement |
Previous Message | Peter Smith | 2024-10-23 05:00:05 | Re: Pgoutput not capturing the generated columns |