Re: backend type in log_line_prefix?

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: Julien Rouhaud <rjuju123(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: backend type in log_line_prefix?
Date: 2020-03-13 21:22:52
Message-ID: c14e8db8-3c31-1463-dd49-cbf45643d8e7@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-03-11 19:53, Justin Pryzby wrote:
> Can I suggest:
>
> $ git diff
> diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
> index 3a6f7f9456..56e0a1437e 100644
> --- a/src/backend/utils/error/elog.c
> +++ b/src/backend/utils/error/elog.c
> @@ -2945,7 +2945,7 @@ write_csvlog(ErrorData *edata)
> if (MyProcPid == PostmasterPid)
> appendCSVLiteral(&buf, "postmaster");
> else if (MyBackendType == B_BG_WORKER)
> - appendCSVLiteral(&buf, MyBgworkerEntry->bgw_type);
> + appendCSVLiteral(&buf, MyBgworkerEntry->bgw_name);
> else
> appendCSVLiteral(&buf, pgstat_get_backend_desc(MyBackendType));

The difference is intentional. bgw_type is so that you can filter and
group by type. The bgw_name could be totally different for each instance.

Having the bgw name available somehow would perhaps also be useful, but
then we should also do this in a consistent way for processes that are
not background workers, such as regular client backends or wal senders
or autovacuum workers. Doing it just for background workers would
create inconsistencies that the introduction of bgw_type some time ago
sought to eliminate.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2020-03-13 21:24:02 Re: backend type in log_line_prefix?
Previous Message Alvaro Herrera 2020-03-13 21:15:09 Re: WIP: WAL prefetch (another approach)