1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Add support for zstd base backup compression.

Both client-side compression and server-side compression are now
supported for zstd. In addition, a backup compressed by the server
using zstd can now be decompressed by the client in order to
accommodate the use of -Fp.

Jeevan Ladhe, with some edits by me.

Discussion: http://postgr.es/m/CA+Tgmobyzfbz=gyze2_LL1ZumZunmaEKbHQxjrFkOR7APZGu-g@mail.gmail.com
This commit is contained in:
Robert Haas
2022-03-07 15:08:45 -05:00
parent c28839c832
commit 7cf085f077
17 changed files with 748 additions and 24 deletions

View File

@ -2724,8 +2724,8 @@ The commands accepted in replication mode are:
<listitem>
<para>
Instructs the server to compress the backup using the specified
method. Currently, the supported methods are <literal>gzip</literal>
and <literal>lz4</literal>.
method. Currently, the supported methods are <literal>gzip</literal>,
<literal>lz4</literal>, and <literal>zstd</literal>.
</para>
</listitem>
</varlistentry>
@ -2737,7 +2737,8 @@ The commands accepted in replication mode are:
Specifies the compression level to be used. This should only be
used in conjunction with the <literal>COMPRESSION</literal> option.
For <literal>gzip</literal> the value should be an integer between 1
and 9, and for <literal>lz4</literal> it should be between 1 and 12.
and 9, for <literal>lz4</literal> between 1 and 12, and for
<literal>zstd</literal> it should be between 1 and 22.
</para>
</listitem>
</varlistentry>

View File

@ -417,30 +417,33 @@ PostgreSQL documentation
specify <literal>-Xfetch</literal>.
</para>
<para>
The compression method can be set to <literal>gzip</literal> or
<literal>lz4</literal>, or <literal>none</literal> for no
compression. A compression level can be optionally specified, by
appending the level number after a colon (<literal>:</literal>). If no
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 0, and no compression will be used if the level is 0.
The compression method can be set to <literal>gzip</literal>,
<literal>lz4</literal>, <literal>zstd</literal>, or
<literal>none</literal> for no compression. A compression level can
optionally be specified, by appending the level number after a colon
(<literal>:</literal>). If no 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 0, and no compression will be used if
the level is 0.
</para>
<para>
When the tar format is used with <literal>gzip</literal> or
<literal>lz4</literal>, the suffix <filename>.gz</filename> or
<filename>.lz4</filename> will automatically be added to all tar
filenames. When the plain format is used, client-side compression may
not be specified, but it is still possible to request server-side
compression. If this is done, the server will compress the backup for
transmission, and the client will decompress and extract it.
When the tar format is used with <literal>gzip</literal>,
<literal>lz4</literal>, or <literal>zstd</literal>, the suffix
<filename>.gz</filename>, <filename>.lz4</filename>, or
<filename>.zst</filename>, respectively, will be automatically added to
all tar filenames. When the plain format is used, client-side
compression may not be specified, but it is still possible to request
server-side compression. If this is done, the server will compress the
backup for transmission, and the client will decompress and extract it.
</para>
<para>
When this option is used in combination with
<literal>-Xstream</literal>, <literal>pg_wal.tar</literal> will
be compressed using <literal>gzip</literal> if client-side gzip
compression is selected, but will not be compressed if server-side
compresion or LZ4 compresion is selected.
compression is selected, but will not be compressed if any other
compression algorithm is selected, or if server-side compression
is selected.
</para>
</listitem>
</varlistentry>