Re: Failback to old master - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Failback to old master
Date
Msg-id CA+TgmobFOwO8qp1X3n_gRqcGw1593y-ij3ybCO+U9FbPgyeuRQ@mail.gmail.com
Whole thread Raw
In response to Re: Failback to old master  ("Maeldron T." <maeldron@gmail.com>)
Responses Re: Failback to old master
List pgsql-hackers
On Wed, Oct 29, 2014 at 12:43 PM, Maeldron T. <maeldron@gmail.com> wrote:
> Thank you, Robert.
>
> I thought that removing the recovery.conf file makes the slave master only
> after the slave was restarted. (Unlike creating the a trigger_file). Isn't
> this true?

Yes, but after the restart, the slave will also rewind to the most
recent restart-point to begin replay, and some of the sanity checks
that recovery.conf enforces will be lost during that replay.  A safe
way to do this might be to shut down the master, make a note of the
ending WAL position on the master, and then promote the slave (without
shutting it down) once it's reached that point in replay.

> I also thought that if there was a crash on the original master and it
> applied WAL entries on itself that are not presented on the slave then it
> will throw an error when I try to connect it to the new master (to the old
> slave).

I don't think you're going to be that lucky.

> It would be nice to know as creating a base_backup takes much time.

rsync can speed things up by copying only changed data, but yes, it's a problem.

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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Directory/File Access Permissions for COPY and Generic File Access Functions
Next
From: Robert Haas
Date:
Subject: Re: foreign data wrapper option manipulation during Create foreign table time?