public inbox for [email protected]  
help / color / mirror / Atom feed
From: Álvaro Herrera <[email protected]>
To: Xuneng Zhou <[email protected]>
Cc: Chao Li <[email protected]>
Cc: Alexander Korotkov <[email protected]>
Cc: pgsql-hackers <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: Michael Paquier <[email protected]>
Cc: jian he <[email protected]>
Cc: Tomas Vondra <[email protected]>
Cc: Yura Sokolov <[email protected]>
Subject: Re: Implement waiting for wal lsn replay: reloaded
Date: Thu, 1 Jan 2026 14:16:05 -0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <CABPTF7Xs-64GQNjmbimZNhj2YSKbBny+evz6=cp3X2fkJS+vMQ@mail.gmail.com>


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/






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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Implement waiting for wal lsn replay: reloaded
  In-Reply-To: <[email protected]>

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

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