Re: [PATCH]Add a tip to the check mode

From: Wen Yi <wen-yi(at)qq(dot)com>
To: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH]Add a tip to the check mode
Date: 2023-07-12 07:02:21
Message-ID: tencent_4FAEC88D485AC085AE6E7235D3B405F23305@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)bogon devel]$ postgres --check -D /home/beginnerc/pgsql/data
[beginnerc(at)bogon devel]$

[beginnerc(at)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

------------------&nbsp;Original&nbsp;------------------
From: "Matthias van de Meent" <boekewurm+postgres(at)gmail(dot)com&gt;;
Date:&nbsp;Tue, Jul 11, 2023 09:44 PM
To:&nbsp;"Wen Yi"<wen-yi(at)qq(dot)com&gt;;
Cc:&nbsp;"pgsql-hackers"<pgsql-hackers(at)lists(dot)postgresql(dot)org&gt;;
Subject:&nbsp;Re: [PATCH]Add a tip to the check mode

On Tue, 11 Jul 2023 at 15:11, Wen Yi <wen-yi(at)qq(dot)com&gt; wrote:
&gt;
&gt; Hi community,
&gt; 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.
&gt;
&gt; src/backend/bootstrap/bootstrap.c
&gt;
&gt; if (check_only)
&gt;&nbsp;&nbsp;&nbsp;&nbsp; {
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SetProcessingMode(NormalProcessing);
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CheckerModeMain();
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; abort();
&gt;&nbsp;&nbsp;&nbsp;&nbsp; }
&gt;
&gt; Instead of
&gt;
&gt; if (check_only)
&gt;&nbsp;&nbsp;&nbsp;&nbsp; {
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SetProcessingMode(NormalProcessing);
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CheckerModeMain();
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("PostgreSQL check success, there's no problem\n");
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; abort();
&gt;&nbsp;&nbsp;&nbsp;&nbsp; }

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)

Attachment Content-Type Size
Add-a-tip-to-the-check-mode[fix].patch application/octet-stream 410 bytes

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-07-12 07:05:17 Re: Support to define custom wait events for extensions
Previous Message Masahiko Sawada 2023-07-12 07:00:25 Re: doc: improve the restriction description of using indexes on REPLICA IDENTITY FULL table.