Re: Why does logical replication launcher set application_name?

From: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>, Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why does logical replication launcher set application_name?
Date: 2017-04-18 18:31:57
Message-ID: ed8994ef-941f-2802-980b-e51a11d126c5@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 18/04/17 19:18, Tom Lane wrote:
> Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com> writes:
>> On 18/04/17 18:24, Peter Eisentraut wrote:
>>> I don't see why we need to do that. It is showing the correct
>>> information, isn't it?
>
>> It does, but it's also one of the things Tom complained about and I
>> think he is right in that at least values for launcher should be
>> filtered out there as there is not much meaning in what is shown for
>> launcher. The ugly part is that we can't tell it's launcher in any other
>> way than comparing bgw_library_name and bgw_function_name to specific
>> values.
>
> I think you're thinking about it wrong. To my mind the issue is that
> there should be some generic way to determine that a bgworker process
> is or is not laboring on behalf of an identifiable user. It's great
> that we can tell which user it is when there is one, but clearly some
> bgworkers will be providing general services that aren't associated with
> a single user. So it should be possible to set the userID to zero or
> some such when the bgworker is one that isn't associated with a
> particular user. Maybe the owning user needs to become an additional
> parameter passed in struct BackgroundWorker.
>

We can already do that. In fact after I wrote the above I thought we
could add some kind of boolean in the style of am_bootstrap_superuser as
BOOTSTRAP_SUPERUSER is what those bgworkers get assigned. I don't like
the name much though (am_bootstrap_superuser) as this should not be
associated with bootstrap IMHO.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2017-04-18 19:54:19 Re: Quals not pushed down into lateral
Previous Message Maksim Milyutin 2017-04-18 18:31:03 Re: [PATCH] New command to monitor progression of long running queries