Re: Using old master as new replica after clean switchover - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Using old master as new replica after clean switchover
Date
Msg-id 20190222043109.GB24416@paquier.xyz
Whole thread Raw
In response to Re: Using old master as new replica after clean switchover  (Claudio Freire <klaussfreire@gmail.com>)
List pgsql-hackers
On Thu, Feb 21, 2019 at 03:38:21PM -0300, Claudio Freire wrote:
> If I'm not mistaken, if you don't have WAL archive set up (a shared
> filesystem isn't necessary, but the standby has to be able to restore
> WAL segments from the archive), a few transactions that haven't been
> streamed at primary shutdown could be lost, since the secondary won't
> be able to stream anything after the primary has shut down. WAL
> archive can always be restored even without a primary running, hence
> why a WAL archive is needed.
>
> Or am I missing something?

Well, my point is that you may not need an archive if you are able to
stream the changes from a primary using streaming if the primary has a
replication slot or if a checkpoint has not recycled yet the segments
that a standby may need.  If the primary is offline, and you need to
recover a standby, then an archive is mandatory.  When recovering from
an archive, the standby would be able to catch up to the end of the
segment archived as we don't enforce a segment switch when a node
shuts down.  If using pg_receivewal as a form of archiving with its
--synchronous mode, it is also possible to stream up to the point
where the primary has generated its shutdown checkpoint, so you would
not lose data included on the last segment the primary was working on
when stopped.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Removal of duplicate variable declarations in fe-connect.c
Next
From: Michael Paquier
Date:
Subject: Re: Using old master as new replica after clean switchover