Re: Add Information during standby recovery conflicts

From: "Drouvot, Bertrand" <bdrouvot(at)amazon(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add Information during standby recovery conflicts
Date: 2020-11-29 06:47:30
Message-ID: f2f12403-8fd0-e7a7-42f9-26ea74ab31c4@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Alvaro,

On 11/28/20 6:36 PM, Alvaro Herrera wrote:
> Hi Bertrand,
>
> On 2020-Nov-28, Drouvot, Bertrand wrote:
>
>> + if (nprocs > 0)
>> + {
>> + ereport(LOG,
>> + (errmsg("recovery still waiting after %ld.%03d ms: %s",
>> + msecs, usecs, _(get_recovery_conflict_desc(reason))),
>> + (errdetail_log_plural("Conflicting process: %s.",
>> + "Conflicting processes: %s.",
>> + nprocs, buf.data))));
>> + }
>> + else
>> + {
>> + ereport(LOG,
>> + (errmsg("recovery still waiting after %ld.%03d ms: %s",
>> + msecs, usecs, _(get_recovery_conflict_desc(reason)))));
>> + }
>> +
>> + pfree(buf.data);
>> + }
>> + else
>> + ereport(LOG,
>> + (errmsg("recovery still waiting after %ld.%03d ms: %s",
>> + msecs, usecs, _(get_recovery_conflict_desc(reason)))));
>> +}
> Another trivial stylistic point is that you can collapse all these
> ereport calls into one, with something like
>
> ereport(LOG,
> errmsg("recovery still waiting after ...", opts),
> waitlist != NULL ? errdetail_log_plural("foo bar baz", opts) : 0);
>
> where the "waitlist" has been constructed beforehand, or is set to NULL
> if there's no process list.

Nice!

>
>> + switch (reason)
>> + {
>> + case PROCSIG_RECOVERY_CONFLICT_BUFFERPIN:
>> + reasonDesc = gettext_noop("for recovery conflict on buffer pin");
>> + break;
> Pure bikeshedding after discussing this with my pillow: I think I'd get
> rid of the initial "for" in these messages.

both comments implemented in the new attached version.

Thanks!

Bertrand

Attachment Content-Type Size
v9-0006-Log-the-standby-recovery-conflict-waits.patch text/plain 17.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-11-29 07:14:39 Re: configure and DocBook XML
Previous Message Dilip Kumar 2020-11-29 06:23:18 Re: parallel distinct union and aggregate support patch