Re: Pause at end of recovery

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Pause at end of recovery
Date: 2012-01-26 15:50:48
Message-ID: CABUevExJX7bkBBgN6ed=p_sm--zU0HRNZMRf+M0weq5gMYfQ3g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 26, 2012 at 08:42, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> On Wed, Dec 28, 2011 at 7:27 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>> On Thu, Dec 22, 2011 at 6:16 AM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>>
>>> I can see a reason to do this now. I've written patch and will commit
>>> on Friday. Nudge me if I don't.
>>
>> It's hard to write this so it works in all cases and doesn't work in
>> the right cases also.
>>
>> Basically, we can't get in the way of crash recovery, so the only way
>> we can currently tell a crash recovery from an archive recovery is the
>> presence of restore_command.
>>
>> If you don't have that and you haven't set a recovery target, it won't
>> pause and there's nothing I can do, AFAICS.
>>
>> Please test this and review before commit.
>
> What if wrong recovery target is specified and an archive recovery reaches
> end of WAL files unexpectedly? Even in this case, we want to pause
> recovery at the end? Otherwise, we'll lose chance to correct the recovery
> target and retry archive recovery.

Yes, we definitely want to pause then.

> One idea; starting archive recovery with standby_mode=on meets your needs?

I haven't tested, but probably, yes. But in that case, why do we need
the pause_at_recovery_target *at all*? It's basically overloaded
functionality already, but I figured it was set up that way to keep
replication and recovery a bit separated?

> When archive recovery reaches end of WAL files, regardless of whether recovery
> target is specified or not, recovery pauses at the end. If hot_standby
> is enabled,
> you can check the contents and if it's OK you can finish recovery by
> pg_ctl promote.

That is pretty much the usecase, yes. Or readjust the recovery target
(or, heck, add more files to the wal archive because you set it up
wrong somehow) and continue the recovery further along the line.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Abhijit Menon-Sen 2012-01-26 15:57:02 Re: [PATCH] Fix float8 parsing of denormal values (on some platforms?)
Previous Message Abhijit Menon-Sen 2012-01-26 15:47:17 Re: PL/Python result metadata