Re: Implement waiting for wal lsn replay: reloaded

Xuneng Zhou <xunengzhou@gmail.com>

From: Xuneng Zhou <xunengzhou@gmail.com>
To: Alexander Korotkov <aekorotkov@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@lists.postgresql.org>, Andres Freund <andres@anarazel.de>, Álvaro Herrera <alvherre@kurilemu.de>, Michael Paquier <michael@paquier.xyz>, jian he <jian.universality@gmail.com>, Tomas Vondra <tomas@vondra.me>, Yura Sokolov <y.sokolov@postgrespro.ru>
Date: 2025-12-19T02:49:46Z
Lists: pgsql-hackers

Attachments

Hi,

On Thu, Dec 18, 2025 at 8:25 PM Alexander Korotkov <aekorotkov@gmail.com> wrote:
>
> On Thu, Dec 18, 2025 at 2:24 PM Xuneng Zhou <xunengzhou@gmail.com> wrote:
> > On Thu, Dec 18, 2025 at 6:38 PM Alexander Korotkov <aekorotkov@gmail.com> wrote:
> > >
> > > Hi, Xuneng!
> > >
> > > On Tue, Dec 16, 2025 at 6:46 AM Xuneng Zhou <xunengzhou@gmail.com> wrote:
> > > > Remove the erroneous WAIT_LSN_TYPE_COUNT case from the switch
> > > > statement in v5 patch 1.
> > >
> > > Thank you for your work on this patchset.  Generally, it looks like
> > > good and quite straightforward extension of the current functionality.
> > > But this patch adds 4 new unreserved keywords to our grammar.  Do you
> > > think we can put mode into with options clause?
> > >
> >
> > Thanks for pointing this out. Yeah, 4 unreserved keywords add
> > complexity to the parser and it may not be worthwhile since replay is
> > expected to be the common use scenario. Maybe we can do something like
> > this:
> >
> > -- Default (REPLAY mode)
> > WAIT FOR LSN '0/306EE20' WITH (TIMEOUT '1s');
> >
> > -- Explicit REPLAY mode
> > WAIT FOR LSN '0/306EE20' WITH (MODE 'replay', TIMEOUT '1s');
> >
> > -- WRITE mode
> > WAIT FOR LSN '0/306EE20' WITH (MODE 'write', TIMEOUT '1s');
> >
> > If no mode is set explicitly in the options clause, it defaults to
> > replay. I'll update the patch per your suggestion.
>
> This is exactly what I meant.  Please, go ahead.
>

Here is the updated patch set (v7). Please check.

-- 
Best,
Xuneng