]> granicus.if.org Git - postgresql/commit
Prevent WAL files created by pg_basebackup -x/X from being archived again.
authorAndres Freund <andres@anarazel.de>
Sat, 3 Jan 2015 19:51:52 +0000 (20:51 +0100)
committerAndres Freund <andres@anarazel.de>
Sat, 3 Jan 2015 19:54:13 +0000 (20:54 +0100)
commitf961ad4790bddd540ebc5c3b44f752a3869fa866
tree816a9e1a7e5ce43034e2360f26d28956a101f930
parent4967e07a9131fa37b758c45fee3bd35ad7fb7035
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
src/backend/replication/basebackup.c
src/bin/pg_basebackup/pg_basebackup.c
src/bin/pg_basebackup/pg_receivexlog.c
src/bin/pg_basebackup/receivelog.c
src/bin/pg_basebackup/receivelog.h