Re: how to check that recovery is complete

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Dmitry O Litvintsev <litvinse(at)fnal(dot)gov>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: how to check that recovery is complete
Date: 2020-11-06 08:37:09
Message-ID: ad6185ce53bfb674c061237092a1421ecf245e79.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Java Developer 2020-11-06 08:59:31 Query a column with the same name as an operator
Previous Message Tony Shelver 2020-11-06 07:33:51 Re: JSONB order?