pgsql: Prevent WAL files created by pg_basebackup -x/X from being archi

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Prevent WAL files created by pg_basebackup -x/X from being archi
Date: 2015-01-03 20:40:52
Message-ID: E1Y7VVE-0007RQ-5y@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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(dot)GE21964(at)awork2(dot)anarazel(dot)de

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/2c0a4858965f1375dadb45df9f3a054bfcb283f5

Modified Files
--------------
src/backend/replication/basebackup.c | 24 ++++++++
src/bin/pg_basebackup/pg_basebackup.c | 33 +++++++----
src/bin/pg_basebackup/pg_receivexlog.c | 2 +-
src/bin/pg_basebackup/receivelog.c | 97 +++++++++++++++++++++++++-------
src/bin/pg_basebackup/receivelog.h | 3 +-
5 files changed, 127 insertions(+), 32 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2015-01-03 20:40:55 pgsql: Add pg_string_endswith as the start of a string helper library i
Previous Message Andres Freund 2015-01-03 18:59:57 Re: pgsql: Change how first WAL segment on new timeline after promotion is