Re: Implement waiting for wal lsn replay: reloaded

From: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(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: 2026-01-02 09:17:34
Message-ID: CABPTF7UkwQZGx5ub731Q+=+rU8yx4ruqMdDt__L_dm9_32LsMw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Alvaro, Alexander,

On Fri, Jan 2, 2026 at 7:42 AM Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
>
> On Thu, Jan 1, 2026 at 7:16 PM Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:
> > In 0002 you have this kind of thing:
> >
> > > ereport(ERROR,
> > > errcode(ERRCODE_QUERY_CANCELED),
> > > - errmsg("timed out while waiting for target LSN %X/%08X to be replayed; current replay LSN %X/%08X",
> > > + errmsg("timed out while waiting for target LSN %X/%08X to be %s; current %s LSN %X/%08X",
> > > LSN_FORMAT_ARGS(lsn),
> > > - LSN_FORMAT_ARGS(GetXLogReplayRecPtr(NULL))));
> > > + desc->verb,
> > > + desc->noun,
> > > + LSN_FORMAT_ARGS(currentLSN)));
> > > + }
> >
> >
> > I'm afraid this technique doesn't work, for translatability reasons.
> > Your whole design of having a struct with ->verb and ->noun is not
> > workable (which is a pity, but you can't really fight this.) You need to
> > spell out the whole messages for each case, something like
> >
> > if (lsntype == replay)
> > ereport(ERROR,
> > errcode(ERRCODE_QUERY_CANCELED),
> > errmsg("timed out while waiting for target LSN %X/%08X to be replayed; current standby_replay LSN %X/%08X",
> > else if (lsntype == flush)
> > ereport( ... )
> >
> > and so on. This means four separate messages for translation for each
> > message your patch is adding, which is IMO the correct approach.
>
> +1
> Thank you for catching this, Alvaro. Yes, I think we need to get rid
> of WaitLSNTypeDesc. It's nice idea, but we support too many languages
> to have something like this.
>

Thanks for pointing this out. This approach doesn’t scale to multiple
languages. While switch statements are more verbose, the extra clarity
is justified to preserve proper internationalization. Please check the
updated v12.

--
Best,
Xuneng

Attachment Content-Type Size
v12-0003-Add-tab-completion-for-WAIT-FOR-LSN-MODE-option.patch application/octet-stream 2.7 KB
v12-0001-Extend-xlogwait-infrastructure-with-write-and-fl.patch application/octet-stream 11.5 KB
v12-0004-Use-WAIT-FOR-LSN-in-PostgreSQL-Test-Cluster-wait.patch application/octet-stream 4.6 KB
v12-0002-Add-MODE-option-to-WAIT-FOR-LSN-command.patch application/octet-stream 44.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nicolas Adenis-Lamarre 2026-01-02 09:19:01 Re: Planner : anti-join on left joins
Previous Message Ashutosh Bapat 2026-01-02 08:48:03 Re: SQL Property Graph Queries (SQL/PGQ)