Re: Implement waiting for wal lsn replay: reloaded

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Alexander Korotkov <aekorotkov(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-01 17:16:05
Message-ID: 202601011659.ikh4ku4p3ovb@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


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.

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"... In accounting terms this makes perfect sense. To rational humans, it
is insane. Welcome to IBM." (Robert X. Cringely)
https://www.cringely.com/2015/06/03/autodesks-john-walker-explained-hp-and-ibm-in-1991/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2026-01-01 17:19:35 Re: Include extension path on pg_available_extensions
Previous Message Álvaro Herrera 2026-01-01 16:51:20 Re: REASSIGN OWNED BY alters objects in other database.