pgsql: Replace BASE_BACKUP COMPRESSION_LEVEL option with COMPRESSION_DE - Mailing list pgsql-committers

From Robert Haas
Subject pgsql: Replace BASE_BACKUP COMPRESSION_LEVEL option with COMPRESSION_DE
Date
Msg-id E1nX0tb-0011WV-8i@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Replace BASE_BACKUP COMPRESSION_LEVEL option with COMPRESSION_DETAIL.

There are more compression parameters that can be specified than just
an integer compression level, so rename the new COMPRESSION_LEVEL
option to COMPRESSION_DETAIL before it gets released. Introduce a
flexible syntax for that option to allow arbitrary options to be
specified without needing to adjust the main replication grammar,
and common code to parse it that is shared between the client and
the server.

This commit doesn't actually add any new compression parameters,
so the only user-visible change is that you can now type something
like pg_basebackup --compress gzip:level=5 instead of writing just
pg_basebackup --compress gzip:5. However, it should make it easy to
add new options. If for example gzip starts offering fries, we can
support pg_basebackup --compress gzip:level=5,fries=true for the
benefit of users who want fries with that.

Along the way, this fixes a few things in pg_basebackup so that the
pg_basebackup can be used with a server-side compression algorithm
that pg_basebackup itself does not understand. For example,
pg_basebackup --compress server-lz4 could still succeed even if
only the server and not the client has LZ4 support, provided that
the other options to pg_basebackup don't require the client to
decompress the archive.

Patch by me. Reviewed by Justin Pryzby and Dagfinn Ilmari Mannsåker.

Discussion: http://postgr.es/m/CA+TgmoYvpetyRAbbg1M8b3-iHsaN4nsgmWPjOENu5-doHuJ7fA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ffd53659c46a54a6978bcb8c4424c1e157a2c0f1

Modified Files
--------------
doc/src/sgml/protocol.sgml                   |  22 +-
doc/src/sgml/ref/pg_basebackup.sgml          |  25 +-
src/backend/replication/basebackup.c         |  62 ++--
src/backend/replication/basebackup_gzip.c    |  20 +-
src/backend/replication/basebackup_lz4.c     |  19 +-
src/backend/replication/basebackup_zstd.c    |  19 +-
src/bin/pg_basebackup/bbstreamer.h           |   7 +-
src/bin/pg_basebackup/bbstreamer_gzip.c      |   7 +-
src/bin/pg_basebackup/bbstreamer_lz4.c       |   4 +-
src/bin/pg_basebackup/bbstreamer_zstd.c      |   4 +-
src/bin/pg_basebackup/pg_basebackup.c        | 409 +++++++++++----------------
src/bin/pg_basebackup/t/010_pg_basebackup.pl |  72 ++++-
src/common/Makefile                          |   1 +
src/common/backup_compression.c              | 269 ++++++++++++++++++
src/include/common/backup_compression.h      |  44 +++
src/include/replication/basebackup_sink.h    |   7 +-
src/tools/msvc/Mkvcbuild.pm                  |   2 +-
17 files changed, 662 insertions(+), 331 deletions(-)


pgsql-committers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: pgsql: Common SQL/JSON clauses
Next
From: Robert Haas
Date:
Subject: pgsql: Unbreak the build.