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 handling of missing files when using pg_rewind with online s
Date: Wed, 15 Jul 2020 06:19:35 +0000
Message-ID: <E1jvalT-0000WH-Ot@gemulon.postgresql.org> (raw)

Fix handling of missing files when using pg_rewind with online source

When working with an online source cluster, pg_rewind gets a list of all
the files in the source data directory using a WITH RECURSIVE query,
returning a NULL result for a file's metadata if it gets removed between
the moment it is listed in a directory and the moment its metadata is
obtained with pg_stat_file() (say a recycled WAL segment).  The query
result was processed in such a way that for each tuple we checked only
that the first file's metadata was NULL.  This could have two
consequences, both resulting in a failure of the rewind:
- If the first tuple referred to a removed file, all files from the
source would be ignored.
- Any file actually missing would not be considered as such.

While on it, rework slightly the code so as no values are saved if we
know that a file is going to be skipped.

Issue introduced by b36805f, so backpatch down to 9.5.

Author: Justin Pryzby, Michael Paquier
Reviewed-by: Daniel Gustafsson, Masahiko Sawada
Discussion: https://postgr.es/m/20200713061010.GC23581@telsasoft.com
Backpatch-through: 9.5

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5f89bb4cf0109bdb36eb8f78943f5b0f141c614a

Modified Files
--------------
src/bin/pg_rewind/libpq_fetch.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1jvalT-0000WH-Ot@gemulon.postgresql.org>
Permalink:  ../E1jvalT-0000WH-Ot@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jvalT-0000WH-Ot@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 handling of missing files when using pg_rewind with online s
  In-Reply-To: <E1jvalT-0000WH-Ot@gemulon.postgresql.org>
  References: <E1jvalT-0000WH-Ot@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