mirror of
https://github.com/postgres/postgres.git
synced 2025-08-31 17:02:12 +03:00
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
This commit is contained in:
@@ -540,6 +540,22 @@ static struct config_enum_entry default_toast_compression_options[] = {
|
||||
{NULL, 0, false}
|
||||
};
|
||||
|
||||
static const struct config_enum_entry wal_compression_options[] = {
|
||||
{"pglz", WAL_COMPRESSION_PGLZ, false},
|
||||
#ifdef USE_LZ4
|
||||
{"lz4", WAL_COMPRESSION_LZ4, false},
|
||||
#endif
|
||||
{"on", WAL_COMPRESSION_PGLZ, false},
|
||||
{"off", WAL_COMPRESSION_NONE, false},
|
||||
{"true", WAL_COMPRESSION_PGLZ, true},
|
||||
{"false", WAL_COMPRESSION_NONE, true},
|
||||
{"yes", WAL_COMPRESSION_PGLZ, true},
|
||||
{"no", WAL_COMPRESSION_NONE, true},
|
||||
{"1", WAL_COMPRESSION_PGLZ, true},
|
||||
{"0", WAL_COMPRESSION_NONE, true},
|
||||
{NULL, 0, false}
|
||||
};
|
||||
|
||||
/*
|
||||
* Options for enum values stored in other modules
|
||||
*/
|
||||
@@ -1304,16 +1320,6 @@ static struct config_bool ConfigureNamesBool[] =
|
||||
NULL, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"wal_compression", PGC_SUSET, WAL_SETTINGS,
|
||||
gettext_noop("Compresses full-page writes written in WAL file."),
|
||||
NULL
|
||||
},
|
||||
&wal_compression,
|
||||
false,
|
||||
NULL, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"wal_init_zero", PGC_SUSET, WAL_SETTINGS,
|
||||
gettext_noop("Writes zeroes to new WAL files before first use."),
|
||||
@@ -4816,6 +4822,16 @@ static struct config_enum ConfigureNamesEnum[] =
|
||||
NULL, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"wal_compression", PGC_SUSET, WAL_SETTINGS,
|
||||
gettext_noop("Compresses full-page writes written in WAL file with specified method."),
|
||||
NULL
|
||||
},
|
||||
&wal_compression,
|
||||
WAL_COMPRESSION_NONE, wal_compression_options,
|
||||
NULL, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"wal_level", PGC_POSTMASTER, WAL_SETTINGS,
|
||||
gettext_noop("Sets the level of information written to the WAL."),
|
||||
|
Reference in New Issue
Block a user