Re: run pg_rewind on an uncleanly shut down cluster. - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: run pg_rewind on an uncleanly shut down cluster.
Date
Msg-id 20151006134638.GE9634@momjian.us
Whole thread Raw
In response to Re: run pg_rewind on an uncleanly shut down cluster.  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
On Tue, Oct  6, 2015 at 03:58:44PM +0900, Michael Paquier wrote:
> On Tue, Oct 6, 2015 at 12:41 AM, Oleksii Kliukin <alexk@hintbits.com> wrote:
> > pg_rewind -D postgresql0 --source-server="host=127.0.0.1 port=5433
> > dbname=postgres"
> > The servers diverged at WAL position 0/3000060 on timeline 1.
> > could not open file "data/postgresql0/pg_xlog/000000010000000000000002":
> > No such file or directory
> >
> > Note that this problem happens not 100% of time during the tests,
> > sometimes pg_rewind can actually rewind the former master.
> 
> I don't think that there is any actual reason preventing us from
> rewinding a node that has its state in pg_control set as something
> else than DB_SHUTDOWNED, the important point here is to be sure that
> the target node is *not* running while pg_rewind is running (perhaps
> pg_rewind should perform an action in the target node to not have it
> run, let's say that it creates a fake postgresql.conf with invalid
> data and renames the existing one). Checking pg_control makes things
> easier though, there is no need to rely on external binaries like
> "pg_ctl status" or some parsing of postmaster.pid with kill(pid, 0)
> for example.

To disable the old cluster, pg_upgrade rename pg_control to
pg_control.old in disable_old_cluster(). You should do that, or
pg_upgrade should use whatever new method you choose.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Roman grave inscription                             +



pgsql-hackers by date:

Previous
From: Paul Ramsey
Date:
Subject: Re: [PATCH] postgres_fdw extension support
Next
From: Andres Freund
Date:
Subject: Re: [PATCH] postgres_fdw extension support