Re: Add comments for a postgres program in bootstrap mode

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Youki Shiraishi <shiraishi(at)computer(dot)org>
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-26 08:37:43
Message-ID: CA+HiwqGKOCnj=F-OV+4Mb9oUuxZFQ5SOdfuamEULfugzzS5YoQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Shiraishi-san,

On Thu, Sep 26, 2019 at 3:06 PM Youki Shiraishi <shiraishi(at)computer(dot)org> wrote:
>
> Hi,
>
> 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.
*/

@@ -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.

Thanks,
Amit

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Khandekar 2019-09-26 09:14:11 Re: Minimal logical decoding on standbys
Previous Message Masahiko Sawada 2019-09-26 08:14:44 pg_wal/RECOVERYHISTORY file remains after archive recovery