| From: | Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> | 
|---|---|
| To: | MauMau <maumau307(at)gmail(dot)com> | 
| Cc: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: Recovery to backup point | 
| Date: | 2014-01-09 13:46:38 | 
| Message-ID: | 52CEA83E.4080602@vmware.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On 12/09/2013 03:05 PM, MauMau wrote:
> From: "Heikki Linnakangas" <hlinnakangas(at)vmware(dot)com>
>> Thanks. Looks sane, although I don't much like the proposed interface
>> to trigger this, setting recovery_target_time='backup_point'. What the
>> code actually does is to stop recovery as soon as you reach
>> consistency, which might not have anything to do with a backup. If you
>> set it on a warm standby server, for example, it will end recovery as
>> soon as it reaches consistency, but there was probably no backup taken
>> at that point.
>
> Thank you for reviewing so rapidly.  I thought I would check the end of
> backup in recoveryStopsHere(), by matching XLOG_BACKUP_END and
> ControlFile->backupStartPoint for backups taken on the primary, and
> comparing the current redo location with ControlFile->backupEndPoint for
> backups taken on the standby.  However, that would duplicate much code
> in XLOG_BACKUP_END redo processing and checkRecoveryConsistency().
> Besides, the code works only when the user explicitly requests recovery
> to backup point, not when he starts the warm standby server.  (I wonder
> I'm answering correctly.)
I was thinking that you have a warm standby server, and you decide to 
stop using it as a warm standby, and promote it. You'd do that by 
stopping it, modifying recovery.conf to remove standby_mode, and set a 
recovery target, and then restart.
After some refactoring and fixing bugs in the existing code, I came up 
with the attached patch. I called the option simply "recovery_target", 
with the only allowed value of "immediate". IOW, if you want to stop 
recovery as early as possible, you add recovery_target='immediate' to 
recovery.conf. Now that we have four different options to set the 
recovery target with, I rearranged the docs slightly. How does this look 
to you?
- Heikki
| Attachment | Content-Type | Size | 
|---|---|---|
| backup_target_immediate-1.patch | text/x-diff | 9.3 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Stephen Frost | 2014-01-09 13:50:18 | Re: Planning time in explain/explain analyze | 
| Previous Message | Michael Meskes | 2014-01-09 13:45:47 | Re: preproc.c compilation error |