Re: make pg_ctl more friendly

2024-07-19 Thread Fujii Masao
On 2024/07/19 2:58, Tom Lane wrote: Fujii Masao writes: "because of recovery target settings" isn't always accurate. For example, if the DBA shuts down the server during recovery, POSTMASTER_SHUTDOWN_IN_RECOVERY can be returned regardless of the recovery target settings. Should we change the

Re: make pg_ctl more friendly

2024-07-18 Thread Tom Lane
Fujii Masao writes: > "because of recovery target settings" isn't always accurate. > For example, if the DBA shuts down the server during recovery, > POSTMASTER_SHUTDOWN_IN_RECOVERY can be returned regardless of > the recovery target settings. Should we change the message to > something like "serv

Re: make pg_ctl more friendly

2024-07-18 Thread Tom Lane
Junwang Zhao writes: > On Wed, Jul 10, 2024 at 3:59 AM Laurenz Albe wrote: >> Attached is my suggestion. > The patch LGTM. >> 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". > I've set it to "ready for committer"

Re: make pg_ctl more friendly

2024-07-18 Thread Fujii Masao
On 2024/07/10 11:45, Junwang Zhao wrote: Attached is my suggestion. The patch LGTM. + case POSTMASTER_SHUTDOWN_IN_RECOVERY: + print_msg(_(" done\n")); + print_msg(_("server shut down because of recovery targ

Re: make pg_ctl more friendly

2024-07-09 Thread Junwang Zhao
Hi, Laurenz On Wed, Jul 10, 2024 at 3:59 AM Laurenz Albe wrote: > > On Wed, 2024-01-17 at 17:33 +0800, Junwang Zhao wrote: > > On Wed, Jan 17, 2024 at 4:54 PM Alvaro Herrera > > wrote: > > > I think this needs more comments. First, in the WaitPMResult enum, we > > > currently have three values

Re: make pg_ctl more friendly

2024-07-09 Thread Laurenz Albe
On Wed, 2024-01-17 at 17:33 +0800, Junwang Zhao wrote: > On Wed, Jan 17, 2024 at 4:54 PM Alvaro Herrera > 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.

Re: make pg_ctl more friendly

2024-01-17 Thread Junwang Zhao
Hi Alvaro, On Wed, Jan 17, 2024 at 4:54 PM Alvaro Herrera 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 th

Re: make pg_ctl more friendly

2024-01-17 Thread Alvaro Herrera
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 valu

Re: make pg_ctl more friendly

2024-01-15 Thread Junwang Zhao
Hi Nathan, On Tue, Jan 16, 2024 at 5:39 AM Nathan Bossart wrote: > > + POSTMASTER_RECOVERY_SHUTDOWN, > > Perhaps this should be POSTMASTER_SHUTDOWN_IN_RECOVERY to match the state > in the control file? Agreed > > + case POSTMASTER_RECOVERY_SHUTDOWN: > +

Re: make pg_ctl more friendly

2024-01-15 Thread Nathan Bossart
+ POSTMASTER_RECOVERY_SHUTDOWN, Perhaps this should be POSTMASTER_SHUTDOWN_IN_RECOVERY to match the state in the control file? + case POSTMASTER_RECOVERY_SHUTDOWN: + print_msg(_("PITR shutdown\n")); + print_ms

Re: make pg_ctl more friendly

2024-01-11 Thread Nazir Bilal Yavuz
Hi, On Wed, 10 Jan 2024 at 06:33, Junwang Zhao wrote: > > Hi Nazir, > > On Tue, Jan 9, 2024 at 9:23 PM Nazir Bilal Yavuz wrote: > > > > v2-0001-PITR-shutdown-should-not-report-error-by-pg_ctl.patch: > > > > - "Examine the log output.\n"), > > +

Re: make pg_ctl more friendly

2024-01-09 Thread Junwang Zhao
Hi Nazir, On Tue, Jan 9, 2024 at 9:23 PM Nazir Bilal Yavuz wrote: > > Hi, > > Thank you for working on this! I agree that the current message is not > friendly. > > On Thu, 9 Nov 2023 at 10:19, Junwang Zhao wrote: > > > > On Thu, Nov 9, 2023 at 3:08 PM Junwang Zhao wrote: > > > > > > After a P

Re: make pg_ctl more friendly

2024-01-09 Thread Nazir Bilal Yavuz
Hi, Thank you for working on this! I agree that the current message is not friendly. On Thu, 9 Nov 2023 at 10:19, Junwang Zhao wrote: > > On Thu, Nov 9, 2023 at 3:08 PM Junwang Zhao wrote: > > > > After a PITR shutdown, the db state should be *shut down in recovery*, try > > the > > patch atta

Re: make pg_ctl more friendly

2023-11-08 Thread Crisp Lee
Hi, I thought the PITR shutdown was DB_SHUTDOWN. I made a mistake. The v2 attach looks good. On Thu, Nov 9, 2023 at 3:19 PM Junwang Zhao wrote: > On Thu, Nov 9, 2023 at 3:08 PM Junwang Zhao wrote: > > > > On Thu, Nov 9, 2023 at 9:57 AM Crisp Lee > wrote: > > > > > > Hi, > > > > > > I know it.

Re: make pg_ctl more friendly

2023-11-08 Thread Junwang Zhao
On Thu, Nov 9, 2023 at 3:08 PM Junwang Zhao wrote: > > On Thu, Nov 9, 2023 at 9:57 AM Crisp Lee wrote: > > > > Hi, > > > > I know it. But my question is not that. I did a PITR operation with > > recovery_target_name and recovery_target_action('shutdown'). The PITR > > process was very short and

Re: make pg_ctl more friendly

2023-11-08 Thread Junwang Zhao
On Thu, Nov 9, 2023 at 9:57 AM Crisp Lee wrote: > > Hi, > > I know it. But my question is not that. I did a PITR operation with > recovery_target_name and recovery_target_action('shutdown'). The PITR process > was very short and the PITR was done before pg_ctl check. The postmaster > shutdown d

Re: make pg_ctl more friendly

2023-11-08 Thread Crisp Lee
Hi, I know it. But my question is not that. I did a PITR operation with recovery_target_name and recovery_target_action('shutdown'). The PITR process was very short and the PITR was done before pg_ctl check. The postmaster shutdown due to recovery_target_action, and there was no crash. But pg_ctl

Re: make pg_ctl more friendly

2023-11-08 Thread Andres Freund
Hi, On 2023-11-09 09:29:32 +0800, Crisp Lee wrote: > How to judge from 'DB_SHUTDOWNED' that PITR ends normally? 'DB_SHUTDOWNED' > is just a state, it could not give more meaning, so I reuse the > recovery.done. DB_SHUTDOWNED cannot be encountered while recovery is ongoing. If there was a hard cra

Re: make pg_ctl more friendly

2023-11-08 Thread Crisp Lee
How to judge from 'DB_SHUTDOWNED' that PITR ends normally? 'DB_SHUTDOWNED' is just a state, it could not give more meaning, so I reuse the recovery.done. On Sat, Nov 4, 2023 at 9:56 AM Andres Freund wrote: > Hi, > > On 2023-11-02 14:50:14 +0800, Crisp Lee wrote: > > I got a basebackup using pg_b

Re: make pg_ctl more friendly

2023-11-03 Thread Andres Freund
Hi, On 2023-11-02 14:50:14 +0800, Crisp Lee wrote: > I got a basebackup using pg_basebackup -R. After that, I created a restore > point named test on primary, and set recovery_target_name to test, > recovery_target_action to shutdown in standby datadir. I got a failure > startup message after 'pg

make pg_ctl more friendly

2023-11-01 Thread Crisp Lee
hink it is not a failure, and makes users nervous, especially for newbies. My thought is to generate a recovery.done file if the postmaster receives exit code 3 from the startup process. When postmaster exits, pg_ctl will give a more friendly message to users. 0001-Make-pg_ctl-more-fr