Re: how to distinguish between using the server as a standby or for executing a targeted recovery in PG 11?

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: "Bharath Rupireddy" <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, "PostgreSQL Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: how to distinguish between using the server as a standby or for executing a targeted recovery in PG 11?
Date: 2021-09-27 20:49:08
Message-ID: 5b9509fb-e07b-4e99-97fe-8d1a5f24e4f6@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 24, 2021, at 1:46 PM, Bharath Rupireddy wrote:
> I'm trying to set up a postgres server with version 11 in targeted
> recovery mode (for the first time after my journey started with
> postgres) and I came across the explanation at [1] in PG 12 and newer
> versions that we have a clear differentiation as to what is the
> "standby" mode or "targeted recovery" mode. How do we differentiate
> these two modes in PG 11? Can anyone please help me with it?
It seems you have to rely on parsing recovery.conf. However, someone can modify
it after starting Postgres. In this case, you have to use a debugger such as

gdb /path/to/postgres -p $(pgrep -f 'postgres: startup recovering') -quiet -batch -ex 'p StandbyMode' -ex 'quit'

Unfortunately, there is no simple way such as checking if a .signal file exists.

--
Euler Taveira
EDB https://www.enterprisedb.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2021-09-27 21:04:02 Re: typos (and more)
Previous Message Bruce Momjian 2021-09-27 20:34:48 Re: storing an explicit nonce