Re: Hooks for session start and end, take two - Mailing list pgsql-hackers

From Mike Palmiotto
Subject Re: Hooks for session start and end, take two
Date
Msg-id CAMN686GTk7AUAmjsioedN6xOOYtbHXcxawUA7a9YL+kXP+trAQ@mail.gmail.com
Whole thread Raw
In response to Re: Hooks for session start and end, take two  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Fri, Sep 27, 2019 at 12:54 AM Michael Paquier <michael@paquier.xyz> wrote:
>
> On Thu, Sep 26, 2019 at 09:57:57AM -0700, legrand legrand wrote:
> > Does that mean that all processes seen in pg_stat_activity like
> > - autovacuum launcher
> > - logical replication launcher
> > - background writer
> > - checkpointer
> > - walwriter
> > ...
> > - Parallel worker
> > are available with that hook (it seems not) ?
>
> All processes using PostgresMain() for their startup take this code
> path like WAL senders and normal backend sessions, but not things
> going through StartChildProcess() (WAL receiver, bgwriter, etc.) or
> other processes like autovacuum processes which use a different start
> code path.

There is another patchset submitted to this CF
(https://commitfest.postgresql.org/24/2259/) that attempts to
centralize all process startup to make use of the StartChildProcess
entrypoint. The patchset then introduces a fork_process hook that
would be hit by every backend type immediately after forking. Looking
at your patch, it seems like there won't be too much conflict between
the two, but I wonder if we can collaborate on the hook portion to
achieve both of our goals?

As noted in the related thread, I'm currently breaking out the
centralization patch into separate pieces: one for the infrastructure
change (including MyAuxProc adoption of the centralized startup), one
for each process type, and one for the fork_process hook. The
substance of the patchset will remain mostly the same if you want to
take a look.

I look forward to hearing your thoughts on the matter.

Thanks,
-- 
Mike Palmiotto
https://crunchydata.com



pgsql-hackers by date:

Previous
From: David Steele
Date:
Subject: Skip recovery/standby signal files in pg_basebackup
Next
From: Alvaro Herrera
Date:
Subject: Re: Attempt to consolidate reading of XLOG page