I'm so sorry for my careless, you're right.
But I still think there should add a tip to our user when there's check ok, because when I use the check mode, it didn't give me any message (If there's no error happend) and just exit, like this:
[beginnerc@bogon devel]$ postgres --check -D /home/beginnerc/pgsql/data
[beginnerc@bogon devel]$
[beginnerc@bogon devel]$ echo $?
0
That's confused me, until I print the return value.
So I think we should add this tip.
I fix and recommit the patch, thanks very much for your reply.
Yours,
Wen Yi
------------------ Original ------------------
From: "Matthias van de Meent" <boekewurm+postgres@gmail.com>;
Date: Tue, Jul 11, 2023 09:44 PM
To: "Wen Yi"<wen-yi@qq.com>;
Cc: "pgsql-hackers"<pgsql-hackers@lists.postgresql.org>;
Subject: Re: [PATCH]Add a tip to the check mode
On Tue, 11 Jul 2023 at 15:11, Wen Yi <wen-yi@qq.com> wrote:
>
> Hi community,
> when I learn the source of PostgreSQL, I think it's better to add a tip to the postgres "check mode", this can help the postgres's user when they check the postgres's data directory.
>
> src/backend/bootstrap/bootstrap.c
>
> if (check_only)
> {
> SetProcessingMode(NormalProcessing);
> CheckerModeMain();
> abort();
> }
>
> Instead of
>
> if (check_only)
> {
> SetProcessingMode(NormalProcessing);
> CheckerModeMain();
> printf("PostgreSQL check success, there's no problem\n");
> abort();
> }
I'm afraid I don't understand the point of your suggestion.
CheckerModeMain doesn't return (it unconditionally calls proc_exit(),
which doesn't return) - it shouldn't hit the abort() clause. If it did
hit the abort() clause, that'd probably be a problem on its own,
right?
--
Kind regards,
Matthias van de Meent
Neon (https://neon.tech)