pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix WAL recycling on standbys depending on archive_mode
Date: Fri, 28 Sep 2018 03:01:14 +0000
Message-ID: <E1g5j1m-0003ut-Az@gemulon.postgresql.org> (raw)

Fix WAL recycling on standbys depending on archive_mode

A restart point or a checkpoint recycling WAL segments treats segments
marked with neither ".done" (archiving is done) or ".ready" (segment is
ready to be archived) in archive_status the same way for archive_mode
being "on" or "always".  While for a primary this is fine, a standby
running a restart point with archive_mode = on would try to mark such a
segment as ready for archiving, which is something that will never
happen except after the standby is promoted.

Note that this problem applies only to WAL segments coming from the
local pg_wal the first time archive recovery is run.  Segments part of a
self-contained base backup are the most common case where this could
happen, however even in this case normally the .done markers would be
most likely part of the backup.  Segments recovered from an archive are
marked as .ready or .done by the startup process, and segments finished
streaming are marked as such by the WAL receiver, so they are handled
already.

Reported-by: Haruka Takatsuka
Author: Michael Paquier
Discussion: https://postgr.es/m/15402-a453c90ed4cf88b2@postgresql.org
Backpatch-through: 9.5, where archive_mode = always has been added.

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/88926fd481b7d1c928947230e154235d9d9720f4

Modified Files
--------------
src/backend/access/transam/xlogarchive.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)



view thread (5+ messages)

Message-ID: <E1g5j1m-0003ut-Az@gemulon.postgresql.org>
Permalink:  ../E1g5j1m-0003ut-Az@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1g5j1m-0003ut-Az@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Fix WAL recycling on standbys depending on archive_mode
  In-Reply-To: <E1g5j1m-0003ut-Az@gemulon.postgresql.org>
  References: <E1g5j1m-0003ut-Az@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox