Extend the options of pg_basebackup to control compression

Enterprise / PostgreSQL - Michael Paquier [paquier.xyz] - 21 January 2022 02:08 UTC

The option --compress is extended to accept a compression method and an optional compression level, as of the grammar METHOD[:LEVEL]. The methods currently support are "none" and "gzip", for client-side compression. Any of those methods use only an integer value for the compression level, but any method implemented in the future could use more specific keywords if necessary.

This commit keeps the logic backward-compatible. Hence, the following compatibility rules apply for the new format of the option --compress:
- -z/--gzip is a synonym of --compress=gzip.
- --compress=NUM implies:
** --compress=none if NUM = 0.
** --compress=gzip:NUM if NUM > 0.

Note that there are also plans to extend more this grammar with server-side compression.

5c649fe153 Extend the options of pg_basebackup to control compression
doc/src/sgml/ref/pg_basebackup.sgml | 21 +++-
src/bin/pg_basebackup/pg_basebackup.c | 146 +++++++++++++++++++++++----
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 36 ++++++-
3 files changed, 179 insertions(+), 24 deletions(-)

Upstream: git.postgresql.org

  • Share