Re: pause recovery if pitr target not reached

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Leif Gunnar Erlandsen <leif(at)lako(dot)no>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pause recovery if pitr target not reached
Date: 2019-11-21 12:34:31
Message-ID: 234a0c50-1160-86c2-4e4b-35e9684f1799@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

After studying this a bit more, I think the current behavior is totally
bogus and needs a serious rethink.

If you specify a recovery target and it is reached, recovery pauses
(depending on recovery_target_action).

If you specify a recovery target and it is not reached when the end of
the archive is reached (i.e., restore_command fails), then recovery ends
and the server is promoted, without any further information. This is
clearly wrong in multiple ways.

I think what we should do is if we specify a recovery target and we
don't reach it, we should ereport(FATAL). Somewhere around

/*
* end of main redo apply loop
*/

in StartupXLOG(), where we already check for other conditions that are
undesirable at the end of recovery. Then a user can make fixes either
by getting more WAL files to restore and adjusting the recovery target
and starting again. I don't think pausing is the right behavior, but
perhaps an argument could be made to offer it as a nondefault behavior.

There is an interesting overlap with the other thread that wants to make
"end of archive" and explicitly settable recovery target. The current
behavior, however, is more like "recovery time (say) or end of archive,
whichever happens first", which is not a behavior that is currently
selectable or intended with other methods of recovery target
specification. Also, if you want the end of the archive as your
recovery target, that currently does not respect the
recovery_target_action setting, but perhaps it should.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Leif Gunnar Erlandsen 2019-11-21 12:50:18 Re: pause recovery if pitr target not reached
Previous Message Fujii Masao 2019-11-21 12:12:56 Re: Recovery performance of DROP DATABASE with many tablespaces