Re: Auxiliary Processes and MyAuxProc

From: Yuli Khodorkovskiy <yuli(dot)khodorkovskiy(at)crunchydata(dot)com>
To: Mike Palmiotto <mike(dot)palmiotto(at)crunchydata(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Auxiliary Processes and MyAuxProc
Date: 2019-08-14 15:01:14
Message-ID: CAFL5wJf9daqdLKSB-EJPo4PmZS2W2V8f97O1fwToKy5qKPUAAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 25, 2019 at 5:25 PM Mike Palmiotto
<mike(dot)palmiotto(at)crunchydata(dot)com> wrote:
>
> On Mon, Feb 25, 2019 at 1:41 PM Mike Palmiotto
> <mike(dot)palmiotto(at)crunchydata(dot)com> wrote:
> >
> > <snip>
> > >
> > > If memory serves, StartChildProcess already was an attempt to unify
> > > the treatment of postmaster children. It's possible that another
> > > round of unification would be productive, but I think you'll find
> > > that there are random small differences in requirements that'd
> > > make it messy.
> >
> > It kind of seemed like it, but I noticed the small differences in
> > requirements, which made me a bit hesitant. I'll go ahead and see what
> > I can do and submit the patch for consideration.
>
> I'm considering changing StartChildProcess to take a struct with data
> for forking/execing each different process. Each different backend
> type would build up the struct and then pass it on to
> StartChildProcess, which would handle each separately. This would
> ensure that the fork type is set prior to InitPostmasterChild and
> would provide us with the information necessary to do what we need in
> the InitPostmasterChild_hook.
>
> Attached is a patch to fork_process.h which shows roughly what I'm
> thinking. Does this seem somewhat sane as a first step?
>

All,

Mike and I have written two patches to solve the issues
discussed in this thread.

The first patch centralizes the startup of workers and extends
worker identification that was introduced by AuxProcType. The worker
id can then be leveraged by extensions for identification of each
process.

The second patch adds a new hook that allows extensions to modify a worker
process' metadata in backends.

These patches should make future worker implementation more
straightforward as there is now one function to call that sets up
each worker. There is also code cleanup and removal of startup
redundancies.

Please let me know your thoughts. I look forward to your feedback.

Thanks,

Yuli

Attachment Content-Type Size
Add-a-hook-to-allow-extensions-to-set-worker-metadat.patch application/octet-stream 2.0 KB
Refactor-child-process-startup.patch application/octet-stream 70.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-08-14 16:06:12 Re: POC: Cleaning up orphaned files using undo logs
Previous Message Tom Lane 2019-08-14 14:50:09 Re: use valgrind --leak-check=yes to detect memory leak