Re: System username in pg_stat_activity - Mailing list pgsql-hackers
From | Bertrand Drouvot |
---|---|
Subject | Re: System username in pg_stat_activity |
Date | |
Msg-id | ZdMbY01L5atuwQHE@ip-10-97-1-34.eu-west-3.compute.internal Whole thread Raw |
In response to | Re: System username in pg_stat_activity (Magnus Hagander <magnus@hagander.net>) |
List | pgsql-hackers |
Hi, On Fri, Feb 16, 2024 at 09:41:41PM +0100, Magnus Hagander wrote: > On Fri, Feb 16, 2024 at 8:55 PM Andres Freund <andres@anarazel.de> wrote: > > > > Hi, > > > > On 2024-01-12 17:16:53 +0100, Magnus Hagander wrote: > > > On Thu, Jan 11, 2024 at 5:55 PM Bertrand Drouvot > > > <bertranddrouvot.pg@gmail.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.pg@gmail.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? Good point! > The answer to that would be "because I didn't think of it" :) I'm in the same boat ;-) > Were you thinking of something like the attached? Doing it that way looks good to me. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
pgsql-hackers by date: