Add support for LZ4 with compression of full-page writes in WAL
authorMichael Paquier <michael@paquier.xyz>
Tue, 29 Jun 2021 02:17:55 +0000 (11:17 +0900)
committerMichael Paquier <michael@paquier.xyz>
Tue, 29 Jun 2021 02:17:55 +0000 (11:17 +0900)
commit4035cd5d4eee4dae797bfc77ab07f8dcd8781b41
tree6f002f0b1f66bd5e6897ad399508060d77b1b874
parentcc2c7d65fc27e877c9f407587b0b92d46cd6dd16
Add support for LZ4 with compression of full-page writes in WAL

The logic is implemented so as there can be a choice in the compression
used when building a WAL record, and an extra per-record bit is used to
track down if a block is compressed with PGLZ, LZ4 or nothing.

wal_compression, the existing parameter, is changed to an enum with
support for the following backward-compatible values:
- "off", the default, to not use compression.
- "pglz" or "on", to compress FPWs with PGLZ.
- "lz4", the new mode, to compress FPWs with LZ4.

Benchmarking has showed that LZ4 outclasses easily PGLZ.  ZSTD would be
also an interesting choice, but going just with LZ4 for now makes the
patch minimalistic as toast compression is already able to use LZ4, so
there is no need to worry about any build-related needs for this
implementation.

Author: Andrey Borodin, Justin Pryzby
Reviewed-by: Dilip Kumar, Michael Paquier
Discussion: https://postgr.es/m/3037310D-ECB7-4BF1-AF20-01C10BB33A33@yandex-team.ru
13 files changed:
doc/src/sgml/config.sgml
doc/src/sgml/install-windows.sgml
doc/src/sgml/installation.sgml
doc/src/sgml/standalone-profile.xsl
src/backend/access/transam/xlog.c
src/backend/access/transam/xloginsert.c
src/backend/access/transam/xlogreader.c
src/backend/utils/misc/guc.c
src/backend/utils/misc/postgresql.conf.sample
src/bin/pg_waldump/pg_waldump.c
src/include/access/xlog.h
src/include/access/xlogrecord.h
src/tools/pgindent/typedefs.list