Re: make pg_ctl more friendly

From: Andres Freund <andres(at)anarazel(dot)de>
To: Crisp Lee <litianxiang01(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Bruce Momjian <bruce(at)momjian(dot)us>
Subject: Re: make pg_ctl more friendly
Date: 2023-11-04 01:56:07
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


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_ctl start -D $standby_datadir'. I think 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.

I think we can detect this without any additional state - pg_ctl already
accesses pg_control (via get_control_dbstate()). We should be able to detect
your case by issuing a different warning if

a) get_control_dbstate() at the start was *not* DB_SHUTDOWNED
b) get_control_dbstate() at the end is DB_SHUTDOWNED


Andres Freund

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-11-04 02:15:50 Re: Something seems weird inside tts_virtual_copyslot()
Previous Message Andres Freund 2023-11-04 01:49:05 Re: Add new option 'all' to pg_stat_reset_shared()