Re: streaming replication breaks horribly if master crashes

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: streaming replication breaks horribly if master crashes
Date: 2010-06-16 20:15:11
Message-ID: AANLkTimZ-Qlql4JiftSpPzcvcqoM1qtKlaFGcRbOG7cq@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 16, 2010 at 4:00 PM, Kevin Grittner
<Kevin(dot)Grittner(at)wicourts(dot)gov> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-06-16 20:26:16 Re: streaming replication breaks horribly if master crashes
Previous Message Josh Berkus 2010-06-16 20:14:20 Re: streaming replication breaks horribly if master crashes