From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Magnus Hagander <magnus(at)hagander(dot)net> |
Cc: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: System username in pg_stat_activity |
Date: | 2024-02-16 19:55:39 |
Message-ID: | 20240216195539.jilk4djkn7x45nyz@awork3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2024-01-12 17:16:53 +0100, Magnus Hagander wrote:
> On Thu, Jan 11, 2024 at 5:55 PM Bertrand Drouvot
> <bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
> > On Thu, Jan 11, 2024 at 02:24:58PM +0100, Magnus Hagander wrote:
> > > On Wed, Jan 10, 2024 at 3:12 PM Bertrand Drouvot
> > > <bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
> > > >
> > > > If we go the 2 fields way, then what about auth_identity and auth_method then?
> > >
> > >
> > > Here is an updated patch based on this idea.
> >
> > Thanks!
> >
> > + <row>
> > + <entry role="catalog_table_entry"><para role="column_definition">
> > + <structfield>auth_method</structfield> <type>text</type>
> > + </para>
> > + <para>
> > + The authentication method used for authenticating the connection, or
> > + NULL for background processes.
> > + </para></entry>
> >
> > I'm wondering if it would make sense to populate it for parallel workers too.
> > I think it's doable thanks to d951052, but I'm not sure it's worth it (one could
> > join based on the leader_pid though). OTOH that would be consistent with
> > how the SYSTEM_USER behaves with parallel workers (it's populated).
>
> I guess one could conceptually argue that "authentication happens int
> he leader". But we do populate it with the other user records, and
> it'd be weird if this one was excluded.
>
> The tricky thing is that pgstat_bestart() is called long before we
> deserialize the data. But from what I can tell it should be safe to
> change it per the attached? That should be AFAICT an extremely short
> window of time longer before we report it, not enough to matter.
I don't like that one bit. The whole subsystem initialization dance already is
quite complicated, particularly for pgstat, we shouldn't make it more
complicated. Especially not when the initialization is moved quite a bit away
from all the other calls.
Besides just that, I also don't think delaying visibility of the worker in
pg_stat_activity until parallel worker initialization has completed is good,
that's not all cheap work.
Maybe I am missing something, but why aren't we just getting the value from
the leader's entry, instead of copying it?
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2024-02-16 19:57:59 | Re: System username in pg_stat_activity |
Previous Message | Andres Freund | 2024-02-16 19:41:55 | Re: System username in pg_stat_activity |