From: Michael Paquier Date: Wed, 4 Mar 2026 23:25:35 +0000 (+0900) Subject: Revert "Change default value of default_toast_compression to "lz4"" X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4f0b3afab4da87255ee159b96ba531157ee5af3b;p=thirdparty%2Fpostgresql.git Revert "Change default value of default_toast_compression to "lz4"" This reverts commit 7c1849311e49, due to the fact that more than 60% of the buildfarm members do not have lz4 installed. As we are in the last commit fest of the development cycle, and that it could take a couple of weeks to stabilize things, this change is reverted for now. This commit will be reworked in a lighter version, as default_toast_compression's default can be changed to "lz4" without the switch from --with-lz4 to --without-lz4. This approach will keep the buildfarm at bay, and still allow builds to take advantage of LZ4 in TOAST by default, as long as the code is compiled with LZ4 support. A harder requirement based on LZ4 should be achievable at some point, but it is going to require some work from the buildfarm owners first. Perhaps this part could be revisited at the beginning of the next development cycle. Discussion: https://postgr.es/m/CAOYmi+meTT0NbLbnVqOJD5OKwCtHL86PQ+RZZTrn6umfmHyWaw@mail.gmail.com --- diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml index a3107f82730..4841a204248 100644 --- a/.cirrus.tasks.yml +++ b/.cirrus.tasks.yml @@ -984,7 +984,6 @@ task: --host=x86_64-w64-mingw32ucrt \ --enable-cassert \ --without-icu \ - --without-lz4 \ CC="ccache x86_64-w64-mingw32ucrt-gcc" \ CXX="ccache x86_64-w64-mingw32ucrt-g++" make -s -j${BUILD_JOBS} clean diff --git a/configure b/configure index 7afd8ba01e8..b30b98a586e 100755 --- a/configure +++ b/configure @@ -1603,7 +1603,7 @@ Optional Packages: --with-system-tzdata=DIR use system time zone data in DIR --without-zlib do not use Zlib - --without-lz4 build without LZ4 support + --with-lz4 build with LZ4 support --with-zstd build with ZSTD support --with-ssl=LIB use LIB for SSL/TLS support (openssl) --with-openssl obsolete spelling of --with-ssl=openssl @@ -9570,9 +9570,7 @@ $as_echo "#define USE_LZ4 1" >>confdefs.h esac else - with_lz4=yes - -$as_echo "#define USE_LZ4 1" >>confdefs.h + with_lz4=no fi diff --git a/configure.ac b/configure.ac index 60d1c1900f2..f4e3bd307c8 100644 --- a/configure.ac +++ b/configure.ac @@ -1188,7 +1188,7 @@ AC_SUBST(with_zlib) # LZ4 # AC_MSG_CHECKING([whether to build with LZ4 support]) -PGAC_ARG_BOOL(with, lz4, yes, [build without LZ4 support], +PGAC_ARG_BOOL(with, lz4, no, [build with LZ4 support], [AC_DEFINE([USE_LZ4], 1, [Define to 1 to build with LZ4 support. (--with-lz4)])]) AC_MSG_RESULT([$with_lz4]) AC_SUBST(with_lz4) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 6779bc844d0..f670e2d4c31 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -3498,9 +3498,10 @@ include_dir 'conf.d' etc.). A compressed page image will be decompressed during WAL replay. The supported methods are pglz, - lz4 and zstd (if - PostgreSQL was compiled with - ). + lz4 (if PostgreSQL + was compiled with ) and + zstd (if PostgreSQL + was compiled with ). The default value is off. Only superusers and users with the appropriate SET privilege can change this setting. @@ -10017,9 +10018,9 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; CREATE TABLE or ALTER TABLE.) The supported compression methods are pglz and - lz4. - The default is lz4 (if available); otherwise, - pglz. + (if PostgreSQL was compiled with + ) lz4. + The default is pglz. diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml index a026ffea68d..b345a105674 100644 --- a/doc/src/sgml/installation.sgml +++ b/doc/src/sgml/installation.sgml @@ -975,6 +975,15 @@ build-postgresql: + + + + + Build with LZ4 compression support. + + + + @@ -1306,18 +1315,6 @@ build-postgresql: - - - - - - lz4 - - Prevents use of the LZ4 library. - - - - diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index 9d2c87b660a..aab2c6eb19f 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -462,7 +462,9 @@ WITH ( MODULUS numeric_literal, REM its existing compression method, rather than being recompressed with the compression method of the target column. The supported compression - methods are pglz and lz4. In + methods are pglz and lz4. + (lz4 is available only if + was used when building PostgreSQL.) In addition, compression_method can be default, which selects the default behavior of consulting the setting diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 188bc11e940..982532fe725 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -344,7 +344,9 @@ WITH ( MODULUS numeric_literal, REM has no direct effect, because such tables have no storage of their own, but the configured value will be inherited by newly-created partitions. The supported compression methods are pglz and - lz4. In addition, + lz4. (lz4 is available only if + was used when building + PostgreSQL.) In addition, compression_method can be default to explicitly specify the default behavior, which is to consult the diff --git a/doc/src/sgml/ref/pg_receivewal.sgml b/doc/src/sgml/ref/pg_receivewal.sgml index 1896f4da0e8..9e353a068e5 100644 --- a/doc/src/sgml/ref/pg_receivewal.sgml +++ b/doc/src/sgml/ref/pg_receivewal.sgml @@ -275,7 +275,9 @@ PostgreSQL documentation The compression method can be set to gzip, - lz4 or none for no compression. + lz4 (if PostgreSQL + was compiled with ) or + none 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 diff --git a/src/backend/access/common/toast_compression.c b/src/backend/access/common/toast_compression.c index 5a5d579494a..4d00537049e 100644 --- a/src/backend/access/common/toast_compression.c +++ b/src/backend/access/common/toast_compression.c @@ -23,7 +23,7 @@ #include "varatt.h" /* GUC */ -int default_toast_compression = DEFAULT_TOAST_COMPRESSION; +int default_toast_compression = TOAST_PGLZ_COMPRESSION; #define NO_COMPRESSION_SUPPORT(method) \ ereport(ERROR, \ diff --git a/src/backend/utils/misc/guc_parameters.dat b/src/backend/utils/misc/guc_parameters.dat index 5ee84a639d8..9507778415d 100644 --- a/src/backend/utils/misc/guc_parameters.dat +++ b/src/backend/utils/misc/guc_parameters.dat @@ -735,7 +735,7 @@ { name => 'default_toast_compression', type => 'enum', context => 'PGC_USERSET', group => 'CLIENT_CONN_STATEMENT', short_desc => 'Sets the default compression method for compressible values.', variable => 'default_toast_compression', - boot_val => 'DEFAULT_TOAST_COMPRESSION', + boot_val => 'TOAST_PGLZ_COMPRESSION', options => 'default_toast_compression_options', }, diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index e686d88afc4..f938cc65a3a 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -779,7 +779,7 @@ #row_security = on #default_table_access_method = 'heap' #default_tablespace = '' # a tablespace name, '' uses the default -#default_toast_compression = pglz # pglz or lz4 +#default_toast_compression = 'pglz' # 'pglz' or 'lz4' #temp_tablespaces = '' # a list of tablespace names, '' uses # only default tablespace #check_function_bodies = on diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 6387c66289e..53ec1544ff3 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -1426,11 +1426,6 @@ setup_config(void) "0640", false); } -#if USE_LZ4 - conflines = replace_guc_value(conflines, "default_toast_compression", - "lz4", true); -#endif - /* * Now replace anything that's overridden via -c switches. */ diff --git a/src/include/access/toast_compression.h b/src/include/access/toast_compression.h index 3265f10b734..5f3ffa9ab2d 100644 --- a/src/include/access/toast_compression.h +++ b/src/include/access/toast_compression.h @@ -52,15 +52,6 @@ typedef enum ToastCompressionId #define CompressionMethodIsValid(cm) ((cm) != InvalidCompressionMethod) -/* - * Choose an appropriate default toast compression method. If lz4 is - * compiled-in, use it, otherwise use pglz. - */ -#ifdef USE_LZ4 -#define DEFAULT_TOAST_COMPRESSION TOAST_LZ4_COMPRESSION -#else -#define DEFAULT_TOAST_COMPRESSION TOAST_PGLZ_COMPRESSION -#endif /* pglz compression/decompression routines */ extern varlena *pglz_compress_datum(const varlena *value);