Re: Implement waiting for wal lsn replay: reloaded

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Michael Paquier <michael(at)paquier(dot)xyz>, jian he <jian(dot)universality(at)gmail(dot)com>, Tomas Vondra <tomas(at)vondra(dot)me>, Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>
Subject: Re: Implement waiting for wal lsn replay: reloaded
Date: 2025-12-20 21:09:43
Message-ID: CAPpHfdtiEe3ZniM9-UVn6mUdnZU0R+Pbfe=-=NydwZvotcKubg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 19, 2025 at 4:50 AM Xuneng Zhou <xunengzhou(at)gmail(dot)com> wrote:
> On Thu, Dec 18, 2025 at 8:25 PM Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
> >
> > On Thu, Dec 18, 2025 at 2:24 PM Xuneng Zhou <xunengzhou(at)gmail(dot)com> wrote:
> > > On Thu, Dec 18, 2025 at 6:38 PM Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
> > > >
> > > > Hi, Xuneng!
> > > >
> > > > On Tue, Dec 16, 2025 at 6:46 AM Xuneng Zhou <xunengzhou(at)gmail(dot)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.

I see that we can't specify WAIT_LSN_TYPE_PRIMARY_FLUSH by setting
mode parameter. Should we allow this?

If we allow specifying WAIT_LSN_TYPE_PRIMARY_FLUSH, should it be
separate mode value or the same with WAIT_LSN_TYPE_STANDBY_FLUSH? In
principle, we could encode both as just 'flush' mode, and detect which
WaitLSNType to pick by checking if recovery is in progress. However,
how should we then react to unreached flush location after standby
promotion (technically it could be still reached but on the different
timeline)?

------
Regards,
Alexander Korotkov
Supabase

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-12-20 21:31:13 Re: Fix typo 586/686 in atomics/arch-x86.h
Previous Message Jonathan Gonzalez V. 2025-12-20 17:48:54 Re: Make PGOAUTHCAFILE in libpq-oauth work out of debug mode