Re: pause recovery if pitr target not reached

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Leif Gunnar Erlandsen <leif(at)lako(dot)no>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pause recovery if pitr target not reached
Date: 2019-10-20 21:06:32
Message-ID: 89fdfec8edb303319a224e48920964b088ec6e65.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 2019-10-19 at 21:45 +0200, Peter Eisentraut wrote:
> On 2019-09-17 13:23, Leif Gunnar Erlandsen wrote:
> > This patch allows PostgreSQL to pause recovery before PITR target is reached
> > if recovery_target_time is specified.
> >
> > Missing WAL's could then be restored from backup and applied on next restart.
> >
> > Today PostgreSQL opens the database in read/write on a new timeline even when
> > PITR tareg is not reached.
>
> I think this idea is worth thinking about. I don't think this should be
> specific to a time-based recovery target. This could apply for example
> to a target xid as well. Also, there should be a way to get the old
> behavior. Perhaps this whole thing should be a new
> recovery_target_action, say, 'pause_unless_reached'.

+1 for pausing if end-of-logs is reached before the recovery target.

I don't think that we need to add a new "recovery_target_action" to
retain the old behavior, because I think that nobody ever wants that.
I'd say that this typically happens in two cases:

1. Someone forgot to archive the WAL segment that contains the target.
In this case the proposed change will solve the problem.

2. Someone specified the recovery target wrong, e.g. used CET rather
than CEST in the recovery target time, so that the recovery target
was later than intended.
In that case the only solution is to start recovery from scratch.

But perhaps there are use cases I didn't think of.

Yours,
Laurenz Albe

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John W Higgins 2019-10-20 21:09:36 Re: jsonb_set() strictness considered harmful to data
Previous Message Laurenz Albe 2019-10-20 20:53:13 Re: jsonb_set() strictness considered harmful to data