pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Support base backup targets.
Date: Thu, 20 Jan 2022 15:51:52 +0000
Message-ID: <E1nAZj6-0005S2-7T@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1nAZj6-0005S2-7T@gemulon.postgresql.org>
Permalink:  ../E1nAZj6-0005S2-7T@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nAZj6-0005S2-7T@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: rhaas@postgresql.org
  Subject: Re: pgsql: Support base backup targets.
  In-Reply-To: <E1nAZj6-0005S2-7T@gemulon.postgresql.org>
  References: <E1nAZj6-0005S2-7T@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