mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
pg_dump: Add support for zstd compression
Allow pg_dump to use the zstd compression, in addition to gzip/lz4. Bulk
of the new compression method is implemented in compress_zstd.{c,h},
covering the pg_dump compression APIs. The rest of the patch adds test
and makes various places aware of the new compression method.
The zstd library (which this patch relies on) supports multithreaded
compression since version 1.5. We however disallow that feature for now,
as it might interfere with parallel backups on platforms that rely on
threads (e.g. Windows). This can be improved / relaxed in the future.
This also fixes a minor issue in InitDiscoverCompressFileHandle(), which
was not updated to check if the file already has the .lz4 extension.
Adding zstd compression was originally proposed in 2020 (see the second
thread), but then was reworked to use the new compression API introduced
in e9960732a9
. I've considered both threads when compiling the list of
reviewers.
Author: Justin Pryzby
Reviewed-by: Tomas Vondra, Jacob Champion, Andreas Karlsson
Discussion: https://postgr.es/m/20230224191840.GD1653@telsasoft.com
Discussion: https://postgr.es/m/20201221194924.GI30237@telsasoft.com
This commit is contained in:
@ -330,8 +330,9 @@ PostgreSQL documentation
|
||||
machine-readable format that <application>pg_restore</application>
|
||||
can read. A directory format archive can be manipulated with
|
||||
standard Unix tools; for example, files in an uncompressed archive
|
||||
can be compressed with the <application>gzip</application> or
|
||||
<application>lz4</application> tools.
|
||||
can be compressed with the <application>gzip</application>,
|
||||
<application>lz4</application>, or
|
||||
<application>zstd</application> tools.
|
||||
This format is compressed by default using <literal>gzip</literal>
|
||||
and also supports parallel dumps.
|
||||
</para>
|
||||
@ -655,7 +656,8 @@ PostgreSQL documentation
|
||||
<para>
|
||||
Specify the compression method and/or the compression level to use.
|
||||
The compression method can be set to <literal>gzip</literal>,
|
||||
<literal>lz4</literal>, or <literal>none</literal> for no compression.
|
||||
<literal>lz4</literal>, <literal>zstd</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
|
||||
@ -676,8 +678,9 @@ PostgreSQL documentation
|
||||
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> or
|
||||
<application>lz4</application>; but the default is not to compress.
|
||||
as though it had been fed through <application>gzip</application>,
|
||||
<application>lz4</application>, or <application>zstd</application>;
|
||||
but the default is not to compress.
|
||||
</para>
|
||||
<para>
|
||||
The tar archive format currently does not support compression at all.
|
||||
|
Reference in New Issue
Block a user