mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
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/O4mutIrCES8ZhlXJiMvzsivT7ztAMja2lkdL1LJx6O5f22I2W8PBIeLKz7mDLwxHoibcnRAYJXm1pH4tyUNC4a8eDzLn22a6Pb1S74Niexg=@pm.me
This commit is contained in:
@ -644,17 +644,39 @@ PostgreSQL documentation
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-Z <replaceable class="parameter">0..9</replaceable></option></term>
|
||||
<term><option>--compress=<replaceable class="parameter">0..9</replaceable></option></term>
|
||||
<term><option>-Z <replaceable class="parameter">level</replaceable></option></term>
|
||||
<term><option>-Z <replaceable class="parameter">method</replaceable></option>[:<replaceable>detail</replaceable>]</term>
|
||||
<term><option>--compress=<replaceable class="parameter">level</replaceable></option></term>
|
||||
<term><option>--compress=<replaceable class="parameter">method</replaceable></option>[:<replaceable>detail</replaceable>]</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specify the compression level to use. Zero means no compression.
|
||||
Specify the compression method and/or the compression level to use.
|
||||
The compression method can be set to <literal>gzip</literal> or
|
||||
<literal>none</literal> for no compression.
|
||||
A compression detail string can optionally be specified. If the
|
||||
detail string is an integer, it specifies the compression level.
|
||||
Otherwise, it should be a comma-separated list of items, each of the
|
||||
form <literal>keyword</literal> or <literal>keyword=value</literal>.
|
||||
Currently, the only supported keyword is <literal>level</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If no compression level is specified, the default compression
|
||||
level will be used. If only a level is specified without mentioning
|
||||
an algorithm, <literal>gzip</literal> compression will be used if
|
||||
the level is greater than <literal>0</literal>, and no compression
|
||||
will be used if the level is <literal>0</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For the custom and directory archive formats, this specifies compression of
|
||||
individual table-data segments, and the default is to compress
|
||||
at a moderate level.
|
||||
For plain text output, setting a nonzero compression level causes
|
||||
the entire output file to be compressed, as though it had been
|
||||
fed through <application>gzip</application>; but the default is not to compress.
|
||||
individual table-data segments, and the default is to compress using
|
||||
<literal>gzip</literal> at a moderate level. For plain text output,
|
||||
setting a nonzero compression level causes the entire output file to be compressed,
|
||||
as though it had been fed through <application>gzip</application>; but the default
|
||||
is not to compress.
|
||||
</para>
|
||||
<para>
|
||||
The tar archive format currently does not support compression at all.
|
||||
</para>
|
||||
</listitem>
|
||||
|
Reference in New Issue
Block a user