postgresql/src/bin
Michael Paquier babbbb595d Add support for LZ4 compression in pg_receivewal
pg_receivewal gains a new option, --compression-method=lz4, available
when the code is compiled with --with-lz4.  Similarly to gzip, this
gives the possibility to compress archived WAL segments with LZ4.  This
option is not compatible with --compress.

The implementation uses LZ4 frames, and is compatible with simple lz4
commands.  Like gzip, using --synchronous ensures that any data will be
flushed to disk within the current .partial segment, so as it is
possible to retrieve as much WAL data as possible even from a
non-completed segment (this requires completing the partial file with
zeros up to the WAL segment size supported by the backend after
decompression, but this is the same as gzip).

The calculation of the streaming start LSN is able to transparently find
and check LZ4-compressed segments.  Contrary to gzip where the
uncompressed size is directly stored in the object read, the LZ4 chunk
protocol does not store the uncompressed data by default.  There is
contentSize that can be used with LZ4 frames by that would not help if
using an archive that includes segments compressed with the defaults of
a "lz4" command, where this is not stored.  So, this commit has taken
the most extensible approach by decompressing the already-archived
segment to check its uncompressed size, through a blank output buffer in
chunks of 64kB (no actual performance difference noticed with 8kB, 16kB
or 32kB, and the operation in itself is actually fast).

Tests have been added to verify the creation and correctness of the
generated LZ4 files.  The latter is achieved by the use of command
"lz4", if found in the environment.

The tar-based WAL method in walmethods.c, used now only by
pg_basebackup, does not know yet about LZ4.  Its code could be extended
for this purpose.

Author: Georgios Kokolatos
Reviewed-by: Michael Paquier, Jian Guo, Magnus Hagander, Dilip Kumar
Discussion: https://postgr.es/m/ZCm1J5vfyQ2E6dYvXz8si39HQ2gwxSZ3IpYaVgYa3lUwY88SLapx9EEnOf5uEwrddhx2twG7zYKjVeuP5MwZXCNPybtsGouDsAD1o2L_I5E=@pm.me
2021-11-05 11:33:25 +09:00
..
initdb Fix incorrect format placeholder 2021-11-03 07:34:28 +01:00
pg_amcheck Doc: improve README files associated with TAP tests. 2021-10-31 18:12:44 -04:00
pg_archivecleanup Move Perl test modules to a better namespace 2021-10-24 10:28:19 -04:00
pg_basebackup Add support for LZ4 compression in pg_receivewal 2021-11-05 11:33:25 +09:00
pg_checksums Move Perl test modules to a better namespace 2021-10-24 10:28:19 -04:00
pg_config Move Perl test modules to a better namespace 2021-10-24 10:28:19 -04:00
pg_controldata Move Perl test modules to a better namespace 2021-10-24 10:28:19 -04:00
pg_ctl Move Perl test modules to a better namespace 2021-10-24 10:28:19 -04:00
pg_dump pg_dump: Refactor messages 2021-10-30 19:25:10 +02:00
pg_resetwal Move Perl test modules to a better namespace 2021-10-24 10:28:19 -04:00
pg_rewind Move Perl test modules to a better namespace 2021-10-24 10:28:19 -04:00
pg_test_fsync Move Perl test modules to a better namespace 2021-10-24 10:28:19 -04:00
pg_test_timing Move Perl test modules to a better namespace 2021-10-24 10:28:19 -04:00
pg_upgrade Fix tests of pg_upgrade across different major versions 2021-10-13 09:22:00 +09:00
pg_verifybackup Move Perl test modules to a better namespace 2021-10-24 10:28:19 -04:00
pg_waldump Move Perl test modules to a better namespace 2021-10-24 10:28:19 -04:00
pgbench pgbench: Fix typo in comment. 2021-11-02 23:08:02 +09:00
pgevent Update copyright for 2021 2021-01-02 13:06:25 -05:00
psql Allow publishing the tables of schema. 2021-10-27 07:44:52 +05:30
scripts Clarify that --system reindexes system catalogs *only* 2021-10-27 16:28:11 +02:00
Makefile Add pg_amcheck, a CLI for contrib/amcheck. 2021-03-12 13:00:01 -05:00