Re: straightening out backend process startup

From: Andres Freund <andres(at)anarazel(dot)de>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: straightening out backend process startup
Date: 2021-08-05 19:39:17
Message-ID: 20210805193917.fq3ijcf4wg7dpewe@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thanks Robert, Horiguchi-san for looking.

On 2021-08-04 16:34:52 -0400, Robert Haas wrote:
> On Mon, Aug 2, 2021 at 12:41 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> > - AuxiliaryProcessMain() is used for two independent tasks: Start bootstrap /
> > checker mode and starting auxiliary processes. In HEAD there's maybe 5 lines
> > out 250 that are actually common to both uses.
> >
> > A related oddity is that we reserve shared memory resources for bootstrap &
> > checker aux processes, despite those never existing.
> >
> > This is addressed in patches 1-7
>
> This all looks pretty mechanical and, I would guess, not very controversial.

Pushed these patches.

> > - The order of invocation of InitProcess()/InitAuxiliaryProcess() and
> > BaseInit() depends on EXEC_BACKEND. Due to that there often is no single
> > place initialization code can be put if it needs any locks.
> >
> > This is addressed in patches 8-9
> >
> > - PostgresMain() has code for single user and multi user interleaved, making
> > it unnecessarily hard to understand what's going on.
> >
> > This is addressed in patches 10
>
> This stuff I'd need to study more in order to have an intelligent opinion.

Unless somebody protests soon I plan to push at least the
"process startup: Always call Init[Auxiliary]Process() before BaseInit()."
portion, as the inconsistent order between EXEC_BACKEND/!EB is making life
hard for me in other patches.

I don't have a dependency on
"process startup: Split single user code out of PostgresMain()."
but it does make the code a good bit more readable imo...

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Verite 2021-08-05 19:40:01 Re: very long record lines in expanded psql output
Previous Message Pavel Stehule 2021-08-05 19:08:56 Re: very long record lines in expanded psql output