Re: streaming replication breaks horribly if master crashes - Mailing list pgsql-hackers

From Robert Haas
Subject Re: streaming replication breaks horribly if master crashes
Date
Msg-id AANLkTimZ-Qlql4JiftSpPzcvcqoM1qtKlaFGcRbOG7cq@mail.gmail.com
Whole thread Raw
In response to Re: streaming replication breaks horribly if master crashes  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-hackers
On Wed, Jun 16, 2010 at 4:00 PM, Kevin Grittner
<Kevin.Grittner@wicourts.gov> wrote:
> Robert Haas <robertmhaas@gmail.com> wrote:
>> So, obviously at this point my slave database is corrupted beyond
>> repair due to nothing more than an unexpected crash on the master.
>
> Certainly that's true for resuming replication.  From your
> description it sounds as though the slave would be usable for
> purposes of taking over for an unrecoverable master.  Or am I
> misunderstanding?

It depends on what you mean.  If you can prevent the slave from ever
reconnecting to the master, then it's still safe to promote it.  But
if the master comes up and starts generating WAL again, and the slave
ever sees any of that WAL (either via SR or via the archive) then
you're toast.

In my case, the slave was irrecoverably out of sync with the master as
soon as the crash happened, but it still could have been promoted at
that point if you killed the old master.  It became corrupted as soon
as it replayed the first WAL record starting beyond 1/87000000.  At
that point it's potentially got arbitrary corruption; you need a new
base backup (but this may not be immediately obvious; it may look OK
even if it isn't).

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: streaming replication breaks horribly if master crashes
Next
From: Robert Haas
Date:
Subject: Re: streaming replication breaks horribly if master crashes