Re: Using old master as new replica after clean switchover

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Claudio Freire <klaussfreire(at)gmail(dot)com>
Cc: RSR999GMAILCOM <rsr999(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Using old master as new replica after clean switchover
Date: 2019-02-22 04:31:09
Message-ID: 20190222043109.GB24416@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-02-22 04:35:28 Re: Using old master as new replica after clean switchover
Previous Message Michael Paquier 2019-02-22 04:22:46 Re: Removal of duplicate variable declarations in fe-connect.c