Re: Add comments for a postgres program in bootstrap mode

From: Youki Shiraishi <shiraishi(at)computer(dot)org>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add comments for a postgres program in bootstrap mode
Date: 2019-09-27 03:51:55
Message-ID: CALwMDXf2DuJTSbHPwyPMWPSeCgKdYKXxj_rxyBK_E18HeMtRmQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Amit,

On Fri, Sep 27, 2019 at 12:10 AM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
>
> Hi Shiraishi-san,
>
> On Thu, Sep 26, 2019 at 6:32 PM Youki Shiraishi <shiraishi(at)computer(dot)org> wrote:
> > On Thu, Sep 26, 2019 at 5:38 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> > > On Thu, Sep 26, 2019 at 3:06 PM Youki Shiraishi <shiraishi(at)computer(dot)org> wrote:
> > > > I have just started to read the PostgreSQL code and found a lack of comments for a postgres backend program in bootstrap mode.
> > > > When I saw the --boot option implemented in src/backend/main/main.c at first time, I did not understand why the --boot option 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 beginner like 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?

Sorry, I missed your suggestion.
The purpose of a comment here is to direct hackers to initdb.c because
the --boot option is used only by initdb.
initdb.c describes why it uses the --boot option (i.e., historical
reason), so I think it should not be described in main.c.

Regards,

--
Youki Shiraishi
NTT Software Innovation Center
Phone: +81-(0)3-5860-5115
Email: shiraishi(at)computer(dot)org

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-09-27 03:55:50 Re: tab complete for explain SETTINGS
Previous Message Haozhou Wang 2019-09-27 03:30:08 Re: Control your disk usage in PG: Introduction to Disk Quota Extension