pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@postgresql.org
Subject: pgsql: Prevent WAL files created by pg_basebackup -x/X from being archi
Date: Sat, 03 Jan 2015 20:41:01 +0000
Message-ID: <E1Y7VVN-0007T7-PV@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Prevent WAL files created by pg_basebackup -x/X from being archived again.

WAL (and timeline history) files created by pg_basebackup did not
maintain the new base backup's archive status. That's currently not a
problem if the new node is used as a standby - but if that node is
promoted all still existing files can get archived again.  With a high
wal_keep_segment settings that can happen a significant time later -
which is quite confusing.

Change both the backend (for the -x/-X fetch case) and pg_basebackup
(for -X stream) itself to always mark WAL/timeline files included in
the base backup as .done. That's in line with walreceiver.c doing so.

The verbosity of the pg_basebackup changes show pretty clearly that it
needs some refactoring, but that'd result in not be backpatchable
changes.

Backpatch to 9.1 where pg_basebackup was introduced.

Discussion: 20141205002854.GE21964@awork2.anarazel.de

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/f961ad4790bddd540ebc5c3b44f752a3869fa866

Modified Files
--------------
src/backend/replication/basebackup.c   |   24 ++++++++++++++
src/bin/pg_basebackup/pg_basebackup.c  |   48 ++++++++++++++++++++++------
src/bin/pg_basebackup/pg_receivexlog.c |    2 +-
src/bin/pg_basebackup/receivelog.c     |   54 +++++++++++++++++++++++++++++---
src/bin/pg_basebackup/receivelog.h     |    3 +-
5 files changed, 115 insertions(+), 16 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (5+ messages)  latest in thread

Message-ID: <E1Y7VVN-0007T7-PV@gemulon.postgresql.org>
Permalink:  ../E1Y7VVN-0007T7-PV@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1Y7VVN-0007T7-PV@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: andres@anarazel.de
  Subject: Re: pgsql: Prevent WAL files created by pg_basebackup -x/X from being archi
  In-Reply-To: <E1Y7VVN-0007T7-PV@gemulon.postgresql.org>
  References: <E1Y7VVN-0007T7-PV@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