On 11 March 2017 at 02:49, Daniel Farina <[email protected]> wrote:
> On Fri, Mar 10, 2017 at 9:48 AM Stuart Bishop <[email protected]>
> wrote:
>>
>> Hi.
>>
>> Is there a way to recover to the latest available target_recovery_time
>> or target_recovery_xid, and automatically promote? The best I seem to
>> be able to do is watch the logs and manually promote once wal fetching
>> starts failing and I've run out of files to replay.
>>
>> I believe that to do automatic promotion after recovery I need to
>> specify a target_recovery_time or target_recovery_xid and I can't see
>> any way to determine that. Unless perhaps I download the wal files,
>> navigating timeline switches, and analyze them.
>
>
> You can turn standby_mode off, and then the first WAL-E download failure
> will cause a promotion.
>
> I am moderately cautious on this: if WAL-E, or any wrapping program exit
> with an unexpected status code, the system will leave recovery and start up.
>
> Postgres treats all exit codes greater than 125 as such a case:
>
> [....]
>
> I have modestly tried to make WAL-E safe to this purpose, but it has never
> quite sat right with me to trust this mechanism in Postgres to promote a
> database. Many programs, e.g. wrappers like envdir or whathaveyou, are not
> guaranteed to emit status codes > 125 in all non-archive-recovery-failure
> cases.
>
> That said, it will work nearly 100% of the time.

Ah, great. Thanks for all this. Its really helped clarify my design,
and will avoid automatic promotion when I can.

I believe it would also work if I could download all the WAL files
after downloading the backup, ensuring I had them all in place before
restarting. I think I would need to teach WAL-E to navigate timeline
changes to do that reliably (unless I just waste bandwidth and disk
space and download all future timelines, which is probably good enough
for real life use cases)

-- 
Stuart Bishop <[email protected]>
http://www.stuartbishop.net/

-- 
You received this message because you are subscribed to the Google Groups 
"wal-e" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to