Re: pause recovery if pitr target not reached

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: peter(dot)eisentraut(at)2ndquadrant(dot)com
Cc: leif(at)lako(dot)no, michael(at)paquier(dot)xyz, masao(dot)fujii(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pause recovery if pitr target not reached
Date: 2020-01-15 02:02:24
Message-ID: 20200115.110224.1823671701020745254.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Tue, 14 Jan 2020 21:13:51 +0100, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote in
> On 2019-12-11 12:40, Leif Gunnar Erlandsen wrote:
> > Adding patch written for 13dev from git
> > "Michael Paquier" <michael(at)paquier(dot)xyz> skrev 1. desember 2019
> > kl. 03:08:
> >
> >> On Fri, Nov 22, 2019 at 11:26:59AM +0000, Leif Gunnar Erlandsen wrote:
> >>
> >>> No it does not. It works well to demonstrate its purpose though.
> >>> And it might be to stop with FATAL would be more correct.
> >>
> >> This is still under active discussion. Please note that the latest
> >> patch does not apply, so a rebase would be nice to have. I have moved
> >> the patch to next CF, waiting on author.
>
> I reworked your patch a bit. I changed the outcome to be an error, as
> was discussed. I also added tests and documentation. Please take a
> look.

It doesn't show how far the last recovery actually reached. I don't
think activating resource managers harms. Don't we check the
not-reached condition *only* after the else block of the "if (record
!= NULL)" statement?

> /* just have to read next record after CheckPoint */
> record = ReadRecord(xlogreader, InvalidXLogRecPtr, LOG, false);
> }
>
> if (record != NULL)
> {
> ...
> }
> else
> {
> /* there are no WAL records following the checkpoint */
> ereport(LOG,
> (errmsg("redo is not required")));
> }
>
+ if (recoveryTarget != RECOVERY_TARGET_UNSET && !reachedStopPoint)
..

recvoery_target_* is not cleared after startup. If a server crashed
just after the last shutdown checkpoint, any recovery_target_* setting
prevents the server from starting regardless of its value.

> LOG: database system was not properly shut down; automatic recovery in progress
> LOG: invalid record length at 0/9000420: wanted 24, got 0
(recovery is skipped)
> FATAL: recovery ended before configured recovery target was reached

I think we should ignore the setting while crash recovery. Targeted
recovery mode is documented as a feature of archive recovery. Perhaps
ArchiveRecoveryRequested is needed in the condition.

> if (ArchiveRecoveryRequested &&
> recoveryTarget != RECOVERY_TARGET_UNSET && !reachedStopPoint)

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2020-01-15 02:08:57 Re: [HACKERS] [WIP] Effective storage of duplicates in B-tree index.
Previous Message Amit Kapila 2020-01-15 01:40:28 Re: logical decoding : exceeded maxAllocatedDescs for .spill files