pgsql: Support base backup targets. - Mailing list pgsql-committers

From Robert Haas
Subject pgsql: Support base backup targets.
Date
Msg-id E1nAZj6-0005S2-7T@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Support base backup targets.

pg_basebackup now has a --target=TARGET[:DETAIL] option. If specfied,
it is sent to the server as the value of the TARGET option to the
BASE_BACKUP command. If DETAIL is included, it is sent as the value of
the new TARGET_DETAIL option to the BASE_BACKUP command.  If the
target is anything other than 'client', pg_basebackup assumes that it
will now be the server's job to write the backup in a location somehow
defined by the target, and that it therefore needs to write nothing
locally. However, the server will still send messages to the client
for progress reporting purposes.

On the server side, we now support two additional types of backup
targets.  There is a 'blackhole' target, which just throws away the
backup data without doing anything at all with it. Naturally, this
should only be used for testing and debugging purposes, since you will
not actually have a backup when it finishes running. More usefully,
there is also a 'server' target, so you can now use something like
'pg_basebackup -Xnone -t server:/SOME/PATH' to write a backup to some
location on the server. We can extend this to more types of targets
in the future, and might even want to create an extensibility
mechanism for adding new target types.

Since WAL fetching is handled with separate client-side logic, it's
not part of this mechanism; thus, backups with non-default targets
must use -Xnone or -Xfetch.

Patch by me, with a bug fix by Jeevan Ladhe.  The patch set of which
this is a part has also had review and/or testing from Tushar Ahuja,
Suraj Kharage, Dipesh Pandit, and Mark Dilger.

Discussion: http://postgr.es/m/CA+TgmoaYZbz0=Yk797aOJwkGJC-LK3iXn+wzzMx7KdwNpZhS5g@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3500ccc39b0dadd1068a03938e4b8ff562587ccc

Modified Files
--------------
doc/src/sgml/protocol.sgml                   |  23 +-
doc/src/sgml/ref/pg_basebackup.sgml          |  30 +++
src/backend/replication/Makefile             |   1 +
src/backend/replication/basebackup.c         |  81 +++++--
src/backend/replication/basebackup_copy.c    |  21 +-
src/backend/replication/basebackup_server.c  | 302 +++++++++++++++++++++++++++
src/backend/utils/activity/wait_event.c      |   6 +
src/bin/pg_basebackup/pg_basebackup.c        | 208 ++++++++++++++----
src/bin/pg_basebackup/t/010_pg_basebackup.pl |  64 +++++-
src/include/replication/basebackup_sink.h    |   3 +-
src/include/utils/wait_event.h               |   2 +
11 files changed, 677 insertions(+), 64 deletions(-)


pgsql-committers by date:

Previous
From: Andrew Dunstan
Date:
Subject: pgsql: Allow clean.bat to be run from anywhere
Next
From: Andres Freund
Date:
Subject: Re: pgsql: TAP tests: check for postmaster.pid anyway when "pg_ctl start" f