Re: archive_timeout ignored directly after promotion

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: archive_timeout ignored directly after promotion
Date: 2017-06-22 05:55:30
Message-ID: CAB7nPqR9SgsVCZyOtv5RB-u5nxVjCb2kHDJde9JRJGSAP2qcDg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 22, 2017 at 2:58 AM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> One easy way to fix that would be to just wakeup the checkpointer from
> the startup process once at the end of recovery, but it'd not be
> pretty. I think it'd be better to change the
> do_restartpoint = RecoveryInProgress();
>
> /*
> * The end-of-recovery checkpoint is a real checkpoint that's
> * performed while we're still in recovery.
> */
> if (flags & CHECKPOINT_END_OF_RECOVERY)
> do_restartpoint = false;
>
> into having a per-loop 'local_in_recovery' variable, that we turn off
> once a CHECKPOINT_END_OF_RECOVERY checkpoint is requested.
>
> Comments?

By Initializing this flag out of the for(;;) loop once, this could put
more control into the checkpointer logic so as no new restart points
can be generated after the end-of-recovery checkpoint. This way we
could replace the hack looking for DB_IN_ARCHIVE_RECOVERY in
CreateRestartPoint() by an error handling.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2017-06-22 06:03:19 Re: Get stuck when dropping a subscription during synchronizing table
Previous Message Noah Misch 2017-06-22 05:52:50 Re: Race conditions with WAL sender PID lookups