Re: [BUG] Archive recovery failure on 9.3+. - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: [BUG] Archive recovery failure on 9.3+.
Date
Msg-id 52FCD37C.3070806@vmware.com
Whole thread Raw
In response to Re: [BUG] Archive recovery failure on 9.3+.  (Christoph Berg <christoph.berg@credativ.de>)
List pgsql-hackers
On 02/13/2014 04:07 PM, Christoph Berg wrote:
> Re: Heikki Linnakangas 2014-02-13 <52FCD02C.3060201@vmware.com>
>>> Is removing the "test ! -f" part and hence overwriting files in the
>>> archive safe, i.e. are the files the same?
>>
>> No. Not in general, anyway. If the old master keeps running, even
>> for a moment, after the partial file was copied, it will have
>> created more WAL records which are present in the old master's copy
>> of the segment, but not in the standby's.
>
> So why does PostgreSQL then ever try to archive something from the old
> timeline? Isn't overwriting files on the old timeline just a very bad
> idea in general?

Yes.

> If so, it shouldn't be the responsibility of
> archive_command to prevent this, but the server shouldn't be trying
> that in the first place.

Totally agreed. That's why I'm proposing that we stop doing that :-).

It's been a bad idea from day one, but I'm a bit hesitent to back-patch 
until someone actually complains. There has been subtle changes to 
archive recovery behavior in each release, so I'm worried that the old 
behavior was in fact useful to someone in some corner case that we're 
missing.

- Heikki



pgsql-hackers by date:

Previous
From: Christoph Berg
Date:
Subject: Re: [BUG] Archive recovery failure on 9.3+.
Next
From: Peter Eisentraut
Date:
Subject: Re: Terminating pg_basebackup background streamer