From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Switch pg_dump to use compression specifications
Date: Fri, 02 Dec 2022 01:46:54 +0000
Message-ID: <E1p0v8f-001dho-I0@gemulon.postgresql.org> (raw)
Switch pg_dump to use compression specifications
Compression specifications are currently used by pg_basebackup and
pg_receivewal, and are able to let the user control in an extended way
the method and level of compression used. As an effect of this commit,
pg_dump's -Z/--compress is now able to use more than just an integer, as
of the grammar "method[:detail]".
The method can be either "none" or "gzip", and can optionally take a
detail string. If the detail string is only an integer, it defines the
compression level. A comma-separated list of keywords can also be used
method allows for more options, the only keyword supported now is
"level".
The change is backward-compatible, hence specifying only an integer
leads to no compression for a level of 0 and gzip compression when the
level is greater than 0.
Most of the code changes are straight-forward, as pg_dump was relying on
an integer tracking the compression level to check for gzip or no
compression. These are changed to use a compression specification and
the algorithm stored in it.
As of this change, note that the dump format is not bumped because there
is no need yet to track the compression algorithm in the TOC entries.
Hence, we still rely on the compression level to make the difference
when reading them. This will be mandatory once a new compression method
is added, though.
In order to keep the code simpler when parsing the compression
specification, the code is changed so as pg_dump now fails hard when
using gzip on -Z/--compress without its support compiled, rather than
enforcing no compression without the user knowing about it except
through a warning. Like before this commit, archive and custom formats
are compressed by default when the code is compiled with gzip, and left
uncompressed without gzip.
Author: Georgios Kokolatos
Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/O4mutIrCES8ZhlXJiMvzsivT7ztAMja2lkdL1LJx6O5f22I2W8PBIeLKz7mDLwxHoibcnRAYJXm1pH4t...
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/5e73a6048849bd7bda4947e39570b9011734114d
Modified Files
--------------
doc/src/sgml/ref/pg_dump.sgml | 38 +++++++---
src/bin/pg_dump/compress_io.c | 107 ++++++++++++----------------
src/bin/pg_dump/compress_io.h | 20 +++---
src/bin/pg_dump/pg_backup.h | 7 +-
src/bin/pg_dump/pg_backup_archiver.c | 75 ++++++++++++-------
src/bin/pg_dump/pg_backup_archiver.h | 10 +--
src/bin/pg_dump/pg_backup_custom.c | 6 +-
src/bin/pg_dump/pg_backup_directory.c | 13 ++--
src/bin/pg_dump/pg_backup_tar.c | 11 ++-
src/bin/pg_dump/pg_dump.c | 79 +++++++++++++-------
src/bin/pg_dump/t/001_basic.pl | 34 +++++++--
src/bin/pg_dump/t/002_pg_dump.pl | 3 +-
src/test/modules/test_pg_dump/t/001_base.pl | 16 +++++
src/tools/pgindent/typedefs.list | 1 -
14 files changed, 260 insertions(+), 160 deletions(-)
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: michael@paquier.xyz
Subject: Re: pgsql: Switch pg_dump to use compression specifications
In-Reply-To: <E1p0v8f-001dho-I0@gemulon.postgresql.org>
References: <E1p0v8f-001dho-I0@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