Re: log_min_messages per backend type
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Euler Taveira <euler@eulerto.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, pgsql-hackers@lists.postgresql.org
Date: 2025-03-06T13:33:22Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Allow log_min_messages to be set per process type
- 38e0190ced71 19 (unreleased) landed
-
Assign "backend" type earlier during process start-up
- 0c8e082fba8d 19 (unreleased) landed
-
Use integer backend type when exec'ing a postmaster child
- f1cd34f95272 19 (unreleased) landed
-
Sort guc_parameters.dat alphabetically by name
- fce7c73fba4e 19 (unreleased) cited
-
Create a separate file listing backend types
- dbf8cfb4f02e 19 (unreleased) cited
Hi,
On 2025-03-04 21:33:39 -0300, Euler Taveira wrote:
> +/*
> + * This must match enum BackendType! It should be static, but
> + * commands/variable.c needs to get at this.
> + */
> +int log_min_messages[] = {
> + [B_INVALID] = WARNING,
> + [B_BACKEND] = WARNING,
> + [B_DEAD_END_BACKEND] = WARNING,
> + [B_AUTOVAC_LAUNCHER] = WARNING,
> + [B_AUTOVAC_WORKER] = WARNING,
> + [B_BG_WORKER] = WARNING,
> + [B_WAL_SENDER] = WARNING,
> + [B_SLOTSYNC_WORKER] = WARNING,
> + [B_STANDALONE_BACKEND] = WARNING,
> + [B_ARCHIVER] = WARNING,
> + [B_BG_WRITER] = WARNING,
> + [B_CHECKPOINTER] = WARNING,
> + [B_STARTUP] = WARNING,
> + [B_WAL_RECEIVER] = WARNING,
> + [B_WAL_SUMMARIZER] = WARNING,
> + [B_WAL_WRITER] = WARNING,
> + [B_LOGGER] = WARNING,
> +};
> +StaticAssertDecl(lengthof(log_min_messages) == BACKEND_NUM_TYPES,
> + "array length mismatch");
> +
> +/*
> + * This must match enum BackendType! It might be in commands/variable.c but for
> + * convenience it is near log_min_messages.
> + */
> +const char *const log_min_messages_backend_types[] = {
> + [B_INVALID] = "backend", /* XXX same as backend? */
> + [B_BACKEND] = "backend",
> + [B_DEAD_END_BACKEND] = "backend", /* XXX same as backend? */
> + [B_AUTOVAC_LAUNCHER] = "autovacuum",
> + [B_AUTOVAC_WORKER] = "autovacuum",
> + [B_BG_WORKER] = "bgworker",
> + [B_WAL_SENDER] = "walsender",
> + [B_SLOTSYNC_WORKER] = "slotsyncworker",
> + [B_STANDALONE_BACKEND] = "backend", /* XXX same as backend? */
> + [B_ARCHIVER] = "archiver",
> + [B_BG_WRITER] = "bgwriter",
> + [B_CHECKPOINTER] = "checkpointer",
> + [B_STARTUP] = "backend", /* XXX same as backend? */
Huh, the startup process is among the most crucial things to monitor?
> + [B_WAL_RECEIVER] = "walreceiver",
> + [B_WAL_SUMMARIZER] = "walsummarizer",
> + [B_WAL_WRITER] = "walwriter",
> + [B_LOGGER] = "logger",
> +};
> +
> +StaticAssertDecl(lengthof(log_min_messages_backend_types) == BACKEND_NUM_TYPES,
> + "array length mismatch");
> +
I don't know what I think about the whole patch, but I do want to voice
*strong* opposition to duplicating a list of all backend types into multiple
places. It's already painfull enough to add a new backend type, without having
to pointlessly go around and manually add a new backend type to mulltiple
arrays that have completely predictable content.
Greetings,
Andres Freund