On 12/09/2013 03:05 PM, MauMau wrote:
> From: "Heikki Linnakangas" <hlinnakangas@vmware.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