Re: Scenario using pg_rewind

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: "Kato, Sho" <kato-sho(at)jp(dot)fujitsu(dot)com>
Cc: "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Scenario using pg_rewind
Date: 2018-02-27 09:17:00
Message-ID: 20180227091700.GB2128@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 27, 2018 at 07:40:27AM +0000, Kato, Sho wrote:
> I came up with an another scenario where user uses a synchronized old
> master as a new master.
> If so, pg_rewind need to copy WAL from a source server.
> Is pg_rewind assuming to use the old master as a new master?

The rewound instance needs to replay WAL from the last checkpoint where
WAL forked at promotion up to the point where WAL is being inserted on
the new primary when running pg_rewind, hence the rewound server needs
to follow the new, promoted, server anyway. So you would be able to use
a rewound instance only after it has reached a consistent state, and
only after it has replayed on the new timeline. So I don't see how much
that would be useful, the promoted server is going the new leader
anyway, so trying to make a rewound server again the leader just
complicates your HA flow.

> If pg_rewind is used only for a standby server installation,
> pg_rewind does not need to get WAL from source server, does it?

Not necessarily. You can always have an archive. The rewound instance
will likely need WAL segments on the new timeline though, after
promoting the new standby, please do not forget that a checkpoint needs
to be issued on it so as its control file is updated to reflect on-disk
its new timeline number that pg_rewind uses as a reference. In 10 and
older versions, the odds of not needing an archive are higher than in
v11 since we have removed the need of the secondary last checkpoint on
HEAD: WAL recycling is faster now.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeevan Chalke 2018-02-27 09:29:18 Re: [HACKERS] Partition-wise aggregation/grouping
Previous Message Daniel Gustafsson 2018-02-27 07:51:41 Re: Two small patches for the isolationtester lexer