Re: Add Information during standby recovery conflicts
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: "Drouvot, Bertrand" <bdrouvot@amazon.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>, Fujii Masao <masao.fujii@oss.nttdata.com>, Masahiko Sawada <masahiko.sawada@2ndquadrant.com>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2020-11-28T17:36:26Z
Lists: pgsql-hackers
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.
> + 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.
Commits
-
Log long wait time on recovery conflict when it's resolved.
- 39b03690b529 14.0 landed
-
Add GUC to log long wait times on recovery conflicts.
- 0650ff23038b 14.0 landed
-
Detect the deadlocks between backends and the startup process.
- 8900b5a9d59a 14.0 cited
-
Get rid of the dedicated latch for signaling the startup process.
- ac22929a2613 14.0 cited
-
Add block information in error context of WAL REDO apply loop
- 9d0bd95fa90a 14.0 cited