pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pavel Borisov <pashkin.elfe@gmail.com>
To: Alexander Korotkov <aekorotkov@gmail.com>
Cc: Peter Eisentraut <peter@eisentraut.org>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Implement pg_wal_replay_wait() stored procedure
Date: Tue, 22 Oct 2024 17:30:20 +0400
Message-ID: <CALT9ZEFX_9CF1y5NFMDBVM2uACWUCgsKDfCS0dNMTQ=G+iFD5g@mail.gmail.com> (raw)
In-Reply-To: <CAPpHfdut8AvtU9PhXBOd0r5LPYkLyPeiWS+sfZ0FRoUBrS3_TQ@mail.gmail.com>
References: <E1sZwuz-002NPQ-Lc@gemulon.postgresql.org>
	<18c0fa64-0475-415e-a1bd-665d922c5201@eisentraut.org>
	<CAPpHfduQPYWATA2rfbYXsXM+Yspn1nQVwrEs=p303O428J57Yg@mail.gmail.com>
	<ZtT4dhlxuxdPPI8t@paquier.xyz>
	<CAPpHfdubNR746cbxRvs8C0MmNvUTtrjWwZ=RzcB5i_4kUz+RuQ@mail.gmail.com>
	<1f5b399a-76b1-48e1-87b0-f511e61818f3@eisentraut.org>
	<CAPpHfdvbcTBk_yuvvg=HvWJeLOWBtdmh1_K4j4btZ70ES_HWuw@mail.gmail.com>
	<CAPpHfdut8AvtU9PhXBOd0r5LPYkLyPeiWS+sfZ0FRoUBrS3_TQ@mail.gmail.com>

Hi, Alexander!

On Tue, 22 Oct 2024 at 13:26, Alexander Korotkov <aekorotkov@gmail.com>
wrote:

> On Wed, Oct 16, 2024 at 11:20 PM Alexander Korotkov
> <aekorotkov@gmail.com> wrote:
> >
> > On Wed, Oct 16, 2024 at 10:35 PM Peter Eisentraut <peter@eisentraut.org>
> wrote:
> > > On 02.09.24 01:55, Alexander Korotkov wrote:
> > > > On Mon, Sep 2, 2024 at 2:28 AM Michael Paquier <michael@paquier.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.

0001:
Looks completely ok.

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?

0003:
Besides refactor it looks that deleteLSNWaiter() is added
in WaitForLSNReplay. Maybe it's worth mentioning in the commit message.
Maybe refactoring for loop for assigning result variable and breaking a
loop instead of immediate return would look better and lead to natural call
of after the loop before returning.

0004:

Comment:
+ * Waits until recovery replays the target LSN with optional timeout.
Throw
+ * an error on failure.
may need mentioning "Unless no_error provided throws an error on failure"

Otherwise the patch looks good.

Regards,
Pavel Borisov
Supabase

view thread (50+ messages)  latest in thread

Message-ID: <CALT9ZEFX_9CF1y5NFMDBVM2uACWUCgsKDfCS0dNMTQ=G+iFD5g@mail.gmail.com>
Permalink:  ../CALT9ZEFX_9CF1y5NFMDBVM2uACWUCgsKDfCS0dNMTQ=G+iFD5g@mail.gmail.com/
Also on:    postgresql.org/message-id/CALT9ZEFX_9CF1y5NFMDBVM2uACWUCgsKDfCS0dNMTQ=G+iFD5g@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: pashkin.elfe@gmail.com, aekorotkov@gmail.com, peter@eisentraut.org, michael@paquier.xyz
  Subject: Re: pgsql: Implement pg_wal_replay_wait() stored procedure
  In-Reply-To: <CALT9ZEFX_9CF1y5NFMDBVM2uACWUCgsKDfCS0dNMTQ=G+iFD5g@mail.gmail.com>
  References: <E1sZwuz-002NPQ-Lc@gemulon.postgresql.org> <18c0fa64-0475-415e-a1bd-665d922c5201@eisentraut.org> <CAPpHfduQPYWATA2rfbYXsXM+Yspn1nQVwrEs=p303O428J57Yg@mail.gmail.com> <ZtT4dhlxuxdPPI8t@paquier.xyz> <CAPpHfdubNR746cbxRvs8C0MmNvUTtrjWwZ=RzcB5i_4kUz+RuQ@mail.gmail.com> <1f5b399a-76b1-48e1-87b0-f511e61818f3@eisentraut.org> <CAPpHfdvbcTBk_yuvvg=HvWJeLOWBtdmh1_K4j4btZ70ES_HWuw@mail.gmail.com> <CAPpHfdut8AvtU9PhXBOd0r5LPYkLyPeiWS+sfZ0FRoUBrS3_TQ@mail.gmail.com> <CALT9ZEFX_9CF1y5NFMDBVM2uACWUCgsKDfCS0dNMTQ=G+iFD5g@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox