From: | Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com> |
---|---|
To: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, "Drouvot, Bertrand" <bdrouvot(at)amazon(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Add Information during standby recovery conflicts |
Date: | 2020-10-15 07:15:51 |
Message-ID: | CA+fd4k5JjcphpPw8oorRGAC5v4z-Bn-6dJ9=vRtX3O7gp+5YYg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, 15 Oct 2020 at 14:52, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> wrote:
>
> At Thu, 15 Oct 2020 14:28:57 +0900, Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com> wrote in
> > > ereport(..(errmsg("%s", _("hogehoge")))) results in
> > > fprintf((translated("%s")), translate("hogehoge")).
> > >
> > > So your change (errmsg("%s", gettext_noop("hogehoge")) results in
> > >
> > > fprintf((translated("%s")), DONT_translate("hogehoge")).
> > >
> > > which leads to a translation problem.
> > >
> > > (errmsg(gettext_noop("hogehoge"))
> >
> > This seems equivalent to (errmsg("hogehoge")), right?
>
> Yes and no. However eventually the two works the same way,
> "(errmsg(gettext_noop("hogehoge"))" is a shorthand of
>
> 1: char *msg = gettext_noop("hogehoge");
> ...
> 2: .. (errmsg(msg));
>
> That is, the line 1 only registers a message id "hogehoge" and doesn't
> translate. The line 2 tries to translate the content of msg and it
> finds the translation for the message id "hogehoge".
Understood.
>
> > I think I could understand translation stuff. Given we only report the
> > const string returned from get_recovery_conflict_desc() without
> > placeholders, the patch needs to use errmsg_internal() instead while
> > not changing _() part. (errmsg(get_recovery_conflict_desc())) is not
> > good (warned by -Wformat-security).
>
> Ah, right. we get a complain if no value parameters added. We can
> silence it by adding a dummy parameter to errmsg, but I'm not sure
> which is preferable.
Okay, I'm going to use errmsg_internal() for now until a better idea comes.
I've attached the updated patch that fixed the translation part.
Regards,
--
Masahiko Sawada http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachment | Content-Type | Size |
---|---|---|
v7-0001-Log-the-standby-recovery-conflict-waits.patch | application/octet-stream | 14.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2020-10-15 07:22:12 | Possible memory leak in pgcrypto with EVP_MD_CTX |
Previous Message | Amit Kapila | 2020-10-15 07:08:49 | Re: Logical replication CPU-bound with TRUNCATE/DROP/CREATE many tables |