mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Refactor code parsing compression option values (-Z/--compress)
This commit moves the code in charge of deparsing the method and detail strings fed later to parse_compress_specification() to a common routine, where the backward-compatible case of only an integer being found (N = 0 => "none", N > 1 => gzip at level N) is handled. Note that this has a side-effect for pg_basebackup, as we now attempt to detect "server-" and "client-" before checking for the integer-only pre-14 grammar, where values like server-N and client-N (without the follow-up detail string) are now valid rather than failing because of an unsupported method name. Past grammars are still handled the same way, but these flavors are now authorized, and would now switch to consider N = 0 as no compression and N > 1 as gzip with the compression level used as N, with the caller still controlling if the compression method should be done server-side, client-side or is unspecified. The documentation of pg_basebackup is updated to reflect that. This benefits other code paths that would like to rely on the same logic as pg_basebackup and pg_receivewal with option values used for compression specifications, one area discussed lately being pg_dump. Author: Georgios Kokolatos, Michael Paquier Discussion: https://postgr.es/m/O4mutIrCES8ZhlXJiMvzsivT7ztAMja2lkdL1LJx6O5f22I2W8PBIeLKz7mDLwxHoibcnRAYJXm1pH4tyUNC4a8eDzLn22a6Pb1S74Niexg=@pm.me
This commit is contained in:
@ -416,14 +416,18 @@ PostgreSQL documentation
|
||||
</para>
|
||||
<para>
|
||||
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 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>.
|
||||
<literal>lz4</literal>, <literal>zstd</literal>,
|
||||
<literal>none</literal> for no compression or an integer (no
|
||||
compression if 0, <literal>gzip</literal> if greater than 0).
|
||||
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 supported keywords are <literal>level</literal>
|
||||
and <literal>workers</literal>.
|
||||
The detail string cannot be used when the compression method
|
||||
is specified as a plain integer.
|
||||
</para>
|
||||
<para>
|
||||
If no compression level is specified, the default compression level
|
||||
|
Reference in New Issue
Block a user