public inbox for [email protected]  
help / color / mirror / Atom feed
From: Heikki Linnakangas <[email protected]>
To: Robert Haas <[email protected]>
Cc: Michael Paquier <[email protected]>
Cc: Venkata Balaji N <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: Fujii Masao <[email protected]>
Cc: Borodin Vladimir <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: Streaming replication and WAL archive interactions
Date: Wed, 22 Apr 2015 09:17:59 +0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+TgmoZhcbyDBr8UdGu=y5kmnVcSwcnaBqqV=UnP+oCGiNQGeQ@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<CAHGQGwGJzp-QS7BODiv1uc291gAKtjzzCPb_nzUTxYKJhLsUCA@mail.gmail.com>
	<[email protected]>
	<CAEyp7J9Hy8Q__FbGeR5skjk7d0dvLC+KLXB3JUuWrXXdJ5O+Wg@mail.gmail.com>
	<[email protected]>
	<CAB7nPqQE179yogtg+nKvdwt9KROxTyt-EjumKOMbuXQtea5r3w@mail.gmail.com>
	<[email protected]>
	<CAB7nPqS=V=LF-JZsv9eGF84joQ3jxugt4gkOK6kD1CiB98_vWg@mail.gmail.com>
	<[email protected]>
	<CA+TgmoZhcbyDBr8UdGu=y5kmnVcSwcnaBqqV=UnP+oCGiNQGeQ@mail.gmail.com>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-hackers>

On 04/22/2015 12:42 AM, Robert Haas wrote:
> On Tue, Apr 21, 2015 at 6:55 AM, Heikki Linnakangas <[email protected]> wrote:
>> On 04/21/2015 12:04 PM, Michael Paquier wrote:
>>> On Tue, Apr 21, 2015 at 4:38 PM, Heikki Linnakangas <[email protected]>
>>> wrote:
>>>> Note that even though we don't archive the partial last segment on the
>>>> previous timeline, the same WAL is copied to the first segment on the new
>>>> timeline. So the WAL isn't lost.
>>>
>>> But if the failed master has archived those segments safely, we may need
>>> them, no? I am not sure we can ignore a user who would want to do a PITR
>>> with recovery_target_timeline pointing to the one of the failed master.
>>
>> I think it would be acceptable. If you want to maintain an up-to-the-second
>> archive, you can use pg_receivexlog. Mind you, if the standby wasn't
>> promoted, the partial segment would not be present in the archive anyway.
>> And you can copy the WAL segment manually from 0000000200000000000000XX to
>> pg_xlog/0000000100000000000000XX before starting PITR.
>>
>> Another thought is that we could archive the partial file, but with a
>> different name to avoid confusing it with the full segment. For example, we
>> could archive a partial 000000010000000000000012 segment as
>> "000000020000000000000012.00000128.partial", where 00000128 indicates how
>> far that file is valid (this naming is similar to how the backup history
>> files are named). Recovery wouldn't automatically pick up those files, but
>> the DBA could easily copy the partial file into pg_xlog with the full
>> segment's name, if he wants to do PITR to that piece of WAL.
>
> So, suppose you A replicating to B (via an archive) replicating to C
> (via a separate archive); A dies, B is promoted.  It sounds to me like
> today this will work and with your proposed change it will require
> manual intervention.

No. If there is no streaming replication involved, no partial files will 
be archived, with or without this patch. There is no change to that 
scenario.

Note that it's a bit complicated to set up that scenario today. 
Archiving is never enabled in recovery mode, so you'll need to use a 
custom cron job or something to maintain the archive that C uses. The 
files will not automatically flow from B to the second archive. With the 
patch we're discussing, however, it would be easy: just set 
archive_mode='always' in B.

- Heikki


-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (31+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Streaming replication and WAL archive interactions
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox