pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Justin Pryzby <pryzby@telsasoft.com>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Julien Rouhaud <rjuju123@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: backend type in log_line_prefix?
Date: Fri, 13 Mar 2020 22:22:52 +0100
Message-ID: <c14e8db8-3c31-1463-dd49-cbf45643d8e7@2ndquadrant.com> (raw)
In-Reply-To: <20200311185354.GW29065@telsasoft.com>
References: <c65e5196-4f04-4ead-9353-6088c19615a3@2ndquadrant.com>
	<20200213091428.GA15600@nol>
	<d7dd4aad-c0f3-ecc3-e0f9-def491951e2f@oss.nttdata.com>
	<20200310190142.GB29065@telsasoft.com>
	<20200311185354.GW29065@telsasoft.com>

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





view thread (26+ messages)  latest in thread

Message-ID: <c14e8db8-3c31-1463-dd49-cbf45643d8e7@2ndquadrant.com>
Permalink:  ../c14e8db8-3c31-1463-dd49-cbf45643d8e7@2ndquadrant.com/
Also on:    postgresql.org/message-id/c14e8db8-3c31-1463-dd49-cbf45643d8e7@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, pryzby@telsasoft.com, masao.fujii@oss.nttdata.com, rjuju123@gmail.com
  Subject: Re: backend type in log_line_prefix?
  In-Reply-To: <c14e8db8-3c31-1463-dd49-cbf45643d8e7@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox