Re: make pg_ctl more friendly

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Junwang Zhao <zhjwpku(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, Crisp Lee <litianxiang01(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Bruce Momjian <bruce(at)momjian(dot)us>
Subject: Re: make pg_ctl more friendly
Date: 2024-07-09 19:59:32
Message-ID: 734df366242ad1e62519a81c21fdd47e0fbd2a91.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2024-01-17 at 17:33 +0800, Junwang Zhao wrote:
> On Wed, Jan 17, 2024 at 4:54 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> > I think this needs more comments. First, in the WaitPMResult enum, we
> > currently have three values -- READY, STILL_STARTING, FAILED. These are
> > all pretty self-explanatory. But this patch adds SHUTDOWN_IN_RECOVERY,
> > and that's not at all self-explanatory. Did postmaster start or not?
> > The enum value's name doesn't make that clear. So I'd do something like
> >
> > typedef enum
> > {
> > POSTMASTER_READY,
> > POSTMASTER_STILL_STARTING,
> > /*
> > * postmaster no longer running, because it stopped after recovery
> > * completed.
> > */
> > POSTMASTER_SHUTDOWN_IN_RECOVERY,
> > POSTMASTER_FAILED,
> > } WaitPMResult;
> >
> > Maybe put the comments in wait_for_postmaster_start instead.
>
> I put the comments in WaitPMResult since we need to add two
> of those if in wait_for_postmaster_start.

I don't think that any comment is needed; the name says it all.

> > Secondly, the patch proposes to add new text to be returned by
> > do_start() when this happens, which would look like this:
> >
> > waiting for server to start... shut down while in recovery
> > update recovery target settings for startup again if needed
> >
> > Is this crystal clear? I'm not sure. How about something like this?
> >
> > waiting for server to start... done, but not running
> > server shut down because of recovery target settings
> >
> > variations on the first phrase:
> >
> > "done, no longer running"
> > "done, but no longer running"
> > "done, automatically shut down"
> > "done, automatically shut down after recovery"
>
> I chose the last one because it gives information to users.
> See V5, thanks for the wording ;)

Why not just leave it at plain "done"?
After all, the server was started successfully.
The second message should make sufficiently clear that the server has stopped.

I didn't like the code duplication introduced by the patch, so I rewrote
that part a bit.

Attached is my suggestion.

I'll set the status to "waiting for author"; if you are fine with my version,
I think that the patch is "ready for committer".

Yours,
Laurenz Albe

Attachment Content-Type Size
v6-0001-Improve-pg_ctl-message-for-shutdown-after-recover.patch text/x-patch 2.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2024-07-09 20:28:36 Re: Optimize numeric multiplication for one and two base-NBASE digit multiplicands.
Previous Message Tom Lane 2024-07-09 19:53:17 Re: XML test error on Arch Linux