Re: how to check that recovery is complete - Mailing list pgsql-general

From Laurenz Albe
Subject Re: how to check that recovery is complete
Date
Msg-id ad6185ce53bfb674c061237092a1421ecf245e79.camel@cybertec.at
Whole thread Raw
In response to how to check that recovery is complete  (Dmitry O Litvintsev <litvinse@fnal.gov>)
List pgsql-general
On Thu, 2020-11-05 at 19:03 +0000, Dmitry O Litvintsev wrote:
> I have a workflow where I recover from PITR backup and run a query on it. The program that runs query 
> checks that it can connect to database in a loop, until it can, and then runs the query. 
> This has worked fine far. Recently I upgraded to 11 and I see that I can connect to DB while recovery is 
> not complete yet.

That's because "hot_standby = on" by default from v10 on.

You could change the configuration and set it to "off",
then PostgreSQL will continue to work as before.

The alternative way is running this after you connect:

  SELECT pg_is_in_recovery();

If that returns TRUE, recovery is not done yet.
Back out, wait a while, then try again.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




pgsql-general by date:

Previous
From: Tony Shelver
Date:
Subject: Re: JSONB order?
Next
From: Java Developer
Date:
Subject: Query a column with the same name as an operator