Re: Add comments for a postgres program in bootstrap mode - Mailing list pgsql-hackers

From Amit Langote
Subject Re: Add comments for a postgres program in bootstrap mode
Date
Msg-id CA+HiwqFimOFEPAeZ=u49=ZawVGdOM0Hw52wUcMxOCibidXB67A@mail.gmail.com
Whole thread Raw
In response to Re: Add comments for a postgres program in bootstrap mode  (Youki Shiraishi <shiraishi@computer.org>)
Responses Re: Add comments for a postgres program in bootstrap mode
List pgsql-hackers
Hi Shiraishi-san,

On Thu, Sep 26, 2019 at 6:32 PM Youki Shiraishi <shiraishi@computer.org> wrote:
> On Thu, Sep 26, 2019 at 5:38 PM Amit Langote <amitlangote09@gmail.com> wrote:
> > On Thu, Sep 26, 2019 at 3:06 PM Youki Shiraishi <shiraishi@computer.org> wrote:
> > > I have just started to read the PostgreSQL code and found a lack of comments for a postgres backend program in
bootstrapmode.
 
> > > When I saw the --boot option implemented in src/backend/main/main.c at first time, I did not understand why the
--bootoption is not documented and what it is used for.
 
> > > The only way to know these things is to type `grep -r '\--boot' .` on a project root.
> > > It is easy to see that the --boot option is used in initdb for some historical reasons, but it is painful for a
beginnerlike me.
 
> > > I believe the attached patch which adds a few comments might help a beginner.
> >
> > Thanks for the patch.  It might be a good idea to demystify this
> > secret --boot option.
> >
> > + /* Bootstrap mode for initdb */
> >   if (argc > 1 && strcmp(argv[1], "--boot") == 0)
> >   AuxiliaryProcessMain(argc, argv); /* does not return */
> >   else if (argc > 1 && strcmp(argv[1], "--describe-config") == 0)
> >
> > How about expanding that comment just a little bit, say:
> >
> >     /*
> >      * Bootstrapping is handled by AuxiliaryProcessMain() for historic
> >      * reasons.
> >      */

Do you any thoughts on this suggestion?

> > @@ -190,7 +190,8 @@ static IndexList *ILHead = NULL;
> >   * AuxiliaryProcessMain
> >   *
> >   * The main entry point for auxiliary processes, such as the bgwriter,
> > - * walwriter, walreceiver, bootstrapper and the shared memory checker code.
> > + * walwriter, walreceiver, postgres program in bootstrap mode and the
> > + * shared memory checker code.
> >
> > This change may not be necessary, because, bootstrapper is a good
> > short name for 'postgres program in bootstrap mode'.  Also, this name
> > is similar in style to the names of other auxiliary processes.
>
> Thank you for reviewing my patch.
> My concern is that the word 'bootstrapper' is ambiguous.

I was saying that 'bootstrapper' sounds like 'bgwriter', 'walwriter',
etc., so fits well in that sentence.  It would've been OK if those
things were also written as 'postgres program that does background
buffer writing', etc.

Thanks,
Amit



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Auxiliary Processes and MyAuxProc
Next
From: Tom Lane
Date:
Subject: Re: Unstable select_parallel regression output in 12rc1