aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2022-03-15 13:06:25 -0400
committerRobert Haas <rhaas@postgresql.org>2022-03-15 13:06:25 -0400
commit75eae090876f4d47bf6a1e1016627b75da612307 (patch)
tree55bd88228194696d5c1c6e25b2332a17148c978c /src
parent695f459f1713303ba33b76eeb866c6501dff6380 (diff)
downloadpostgresql-75eae090876f4d47bf6a1e1016627b75da612307.tar.gz
postgresql-75eae090876f4d47bf6a1e1016627b75da612307.zip
Change HAVE_LIBLZ4 and HAVE_LIBZSTD tests to USE_LZ4 and USE_ZSTD.
These tests were added recently, but older code tests USE_LZ4 rathr than HAVE_LIBLZ4, so let's follow the established precedent. It also seems more consistent with the intent of the configure tests, since I think that the USE_* symbols are intended to correspond to what the user requested, and the HAVE_* symbols to what configure found while probing. Discussion: http://postgr.es/m/CA+Tgmoap+hTD2-QNPJLH4tffeFE8MX5+xkbFKMU3FKBy=ZSNKA@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/backend/replication/basebackup_lz4.c8
-rw-r--r--src/backend/replication/basebackup_zstd.c8
-rw-r--r--src/bin/pg_basebackup/bbstreamer_lz4.c12
-rw-r--r--src/bin/pg_basebackup/bbstreamer_zstd.c12
-rw-r--r--src/bin/pg_basebackup/pg_receivewal.c6
-rw-r--r--src/bin/pg_basebackup/t/020_pg_receivewal.pl2
-rw-r--r--src/bin/pg_basebackup/walmethods.c20
-rw-r--r--src/bin/pg_dump/t/002_pg_dump.pl2
-rw-r--r--src/bin/pg_verifybackup/t/008_untar.pl4
-rw-r--r--src/bin/pg_verifybackup/t/009_extract.pl4
-rw-r--r--src/bin/pg_verifybackup/t/010_client_untar.pl4
11 files changed, 41 insertions, 41 deletions
diff --git a/src/backend/replication/basebackup_lz4.c b/src/backend/replication/basebackup_lz4.c
index 472b620d7c7..d838f723d02 100644
--- a/src/backend/replication/basebackup_lz4.c
+++ b/src/backend/replication/basebackup_lz4.c
@@ -12,13 +12,13 @@
*/
#include "postgres.h"
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
#include <lz4frame.h>
#endif
#include "replication/basebackup_sink.h"
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
typedef struct bbsink_lz4
{
@@ -62,7 +62,7 @@ const bbsink_ops bbsink_lz4_ops = {
bbsink *
bbsink_lz4_new(bbsink *next, int compresslevel)
{
-#ifndef HAVE_LIBLZ4
+#ifndef USE_LZ4
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("lz4 compression is not supported by this build")));
@@ -87,7 +87,7 @@ bbsink_lz4_new(bbsink *next, int compresslevel)
#endif
}
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
/*
* Begin backup.
diff --git a/src/backend/replication/basebackup_zstd.c b/src/backend/replication/basebackup_zstd.c
index e3f9b1d4dc0..c0e2be6e27b 100644
--- a/src/backend/replication/basebackup_zstd.c
+++ b/src/backend/replication/basebackup_zstd.c
@@ -12,13 +12,13 @@
*/
#include "postgres.h"
-#ifdef HAVE_LIBZSTD
+#ifdef USE_ZSTD
#include <zstd.h>
#endif
#include "replication/basebackup_sink.h"
-#ifdef HAVE_LIBZSTD
+#ifdef USE_ZSTD
typedef struct bbsink_zstd
{
@@ -61,7 +61,7 @@ const bbsink_ops bbsink_zstd_ops = {
bbsink *
bbsink_zstd_new(bbsink *next, int compresslevel)
{
-#ifndef HAVE_LIBZSTD
+#ifndef USE_ZSTD
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("zstd compression is not supported by this build")));
@@ -86,7 +86,7 @@ bbsink_zstd_new(bbsink *next, int compresslevel)
#endif
}
-#ifdef HAVE_LIBZSTD
+#ifdef USE_ZSTD
/*
* Begin backup.
diff --git a/src/bin/pg_basebackup/bbstreamer_lz4.c b/src/bin/pg_basebackup/bbstreamer_lz4.c
index bde018246f2..810052e4e3d 100644
--- a/src/bin/pg_basebackup/bbstreamer_lz4.c
+++ b/src/bin/pg_basebackup/bbstreamer_lz4.c
@@ -13,7 +13,7 @@
#include <unistd.h>
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
#include <lz4frame.h>
#endif
@@ -22,7 +22,7 @@
#include "common/file_perm.h"
#include "common/string.h"
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
typedef struct bbstreamer_lz4_frame
{
bbstreamer base;
@@ -69,7 +69,7 @@ const bbstreamer_ops bbstreamer_lz4_decompressor_ops = {
bbstreamer *
bbstreamer_lz4_compressor_new(bbstreamer *next, int compresslevel)
{
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
bbstreamer_lz4_frame *streamer;
LZ4F_errorCode_t ctxError;
LZ4F_preferences_t *prefs;
@@ -114,7 +114,7 @@ bbstreamer_lz4_compressor_new(bbstreamer *next, int compresslevel)
#endif
}
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
/*
* Compress the input data to output buffer.
*
@@ -280,7 +280,7 @@ bbstreamer_lz4_compressor_free(bbstreamer *streamer)
bbstreamer *
bbstreamer_lz4_decompressor_new(bbstreamer *next)
{
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
bbstreamer_lz4_frame *streamer;
LZ4F_errorCode_t ctxError;
@@ -309,7 +309,7 @@ bbstreamer_lz4_decompressor_new(bbstreamer *next)
#endif
}
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
/*
* Decompress the input data to output buffer until we run out of input
* data. Each time the output buffer is full, pass on the decompressed data
diff --git a/src/bin/pg_basebackup/bbstreamer_zstd.c b/src/bin/pg_basebackup/bbstreamer_zstd.c
index cc68367dd56..e86749a8fb7 100644
--- a/src/bin/pg_basebackup/bbstreamer_zstd.c
+++ b/src/bin/pg_basebackup/bbstreamer_zstd.c
@@ -13,14 +13,14 @@
#include <unistd.h>
-#ifdef HAVE_LIBZSTD
+#ifdef USE_ZSTD
#include <zstd.h>
#endif
#include "bbstreamer.h"
#include "common/logging.h"
-#ifdef HAVE_LIBZSTD
+#ifdef USE_ZSTD
typedef struct bbstreamer_zstd_frame
{
@@ -65,7 +65,7 @@ const bbstreamer_ops bbstreamer_zstd_decompressor_ops = {
bbstreamer *
bbstreamer_zstd_compressor_new(bbstreamer *next, int compresslevel)
{
-#ifdef HAVE_LIBZSTD
+#ifdef USE_ZSTD
bbstreamer_zstd_frame *streamer;
Assert(next != NULL);
@@ -99,7 +99,7 @@ bbstreamer_zstd_compressor_new(bbstreamer *next, int compresslevel)
#endif
}
-#ifdef HAVE_LIBZSTD
+#ifdef USE_ZSTD
/*
* Compress the input data to output buffer.
*
@@ -225,7 +225,7 @@ bbstreamer_zstd_compressor_free(bbstreamer *streamer)
bbstreamer *
bbstreamer_zstd_decompressor_new(bbstreamer *next)
{
-#ifdef HAVE_LIBZSTD
+#ifdef USE_ZSTD
bbstreamer_zstd_frame *streamer;
Assert(next != NULL);
@@ -257,7 +257,7 @@ bbstreamer_zstd_decompressor_new(bbstreamer *next)
#endif
}
-#ifdef HAVE_LIBZSTD
+#ifdef USE_ZSTD
/*
* Decompress the input data to output buffer until we run out of input
* data. Each time the output buffer is full, pass on the decompressed data
diff --git a/src/bin/pg_basebackup/pg_receivewal.c b/src/bin/pg_basebackup/pg_receivewal.c
index 8a4c2b89646..e2ceafeb0f5 100644
--- a/src/bin/pg_basebackup/pg_receivewal.c
+++ b/src/bin/pg_basebackup/pg_receivewal.c
@@ -32,7 +32,7 @@
#include "receivelog.h"
#include "streamutil.h"
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
#include "lz4frame.h"
#endif
@@ -382,7 +382,7 @@ FindStreamingStart(uint32 *tli)
}
else if (!ispartial && wal_compression_method == COMPRESSION_LZ4)
{
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
#define LZ4_CHUNK_SZ 64 * 1024 /* 64kB as maximum chunk size read */
int fd;
ssize_t r;
@@ -889,7 +889,7 @@ main(int argc, char **argv)
#endif
break;
case COMPRESSION_LZ4:
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
if (compresslevel != 0)
{
pg_log_error("cannot use --compress with --compression-method=%s",
diff --git a/src/bin/pg_basebackup/t/020_pg_receivewal.pl b/src/bin/pg_basebackup/t/020_pg_receivewal.pl
index 545618e0b20..8c38816b22b 100644
--- a/src/bin/pg_basebackup/t/020_pg_receivewal.pl
+++ b/src/bin/pg_basebackup/t/020_pg_receivewal.pl
@@ -141,7 +141,7 @@ SKIP:
SKIP:
{
skip "postgres was not built with LZ4 support", 5
- if (!check_pg_config("#define HAVE_LIBLZ4 1"));
+ if (!check_pg_config("#define USE_LZ4 1"));
# Generate more WAL including one completed, compressed segment.
$primary->psql('postgres', 'SELECT pg_switch_wal();');
diff --git a/src/bin/pg_basebackup/walmethods.c b/src/bin/pg_basebackup/walmethods.c
index a6d08c1270a..1e0ff760eba 100644
--- a/src/bin/pg_basebackup/walmethods.c
+++ b/src/bin/pg_basebackup/walmethods.c
@@ -18,7 +18,7 @@
#include <time.h>
#include <unistd.h>
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
#include <lz4frame.h>
#endif
#ifdef HAVE_LIBZ
@@ -70,7 +70,7 @@ typedef struct DirectoryMethodFile
#ifdef HAVE_LIBZ
gzFile gzfp;
#endif
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
LZ4F_compressionContext_t ctx;
size_t lz4bufsize;
void *lz4buf;
@@ -114,7 +114,7 @@ dir_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
#ifdef HAVE_LIBZ
gzFile gzfp = NULL;
#endif
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
LZ4F_compressionContext_t ctx = NULL;
size_t lz4bufsize = 0;
void *lz4buf = NULL;
@@ -160,7 +160,7 @@ dir_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
}
}
#endif
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
if (dir_data->compression_method == COMPRESSION_LZ4)
{
size_t ctx_out;
@@ -245,7 +245,7 @@ dir_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
gzclose(gzfp);
else
#endif
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
if (dir_data->compression_method == COMPRESSION_LZ4)
{
(void) LZ4F_compressEnd(ctx, lz4buf, lz4bufsize, NULL);
@@ -265,7 +265,7 @@ dir_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
if (dir_data->compression_method == COMPRESSION_GZIP)
f->gzfp = gzfp;
#endif
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
if (dir_data->compression_method == COMPRESSION_LZ4)
{
f->ctx = ctx;
@@ -306,7 +306,7 @@ dir_write(Walfile f, const void *buf, size_t count)
}
else
#endif
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
if (dir_data->compression_method == COMPRESSION_LZ4)
{
size_t chunk;
@@ -394,7 +394,7 @@ dir_close(Walfile f, WalCloseMethod method)
}
else
#endif
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
if (dir_data->compression_method == COMPRESSION_LZ4)
{
size_t compressed;
@@ -487,7 +487,7 @@ dir_close(Walfile f, WalCloseMethod method)
if (r != 0)
dir_data->lasterrno = errno;
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
pg_free(df->lz4buf);
/* supports free on NULL */
LZ4F_freeCompressionContext(df->ctx);
@@ -523,7 +523,7 @@ dir_sync(Walfile f)
}
}
#endif
-#ifdef HAVE_LIBLZ4
+#ifdef USE_LZ4
if (dir_data->compression_method == COMPRESSION_LZ4)
{
DirectoryMethodFile *df = (DirectoryMethodFile *) f;
diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
index 3e55ff26f82..fd1052e5db8 100644
--- a/src/bin/pg_dump/t/002_pg_dump.pl
+++ b/src/bin/pg_dump/t/002_pg_dump.pl
@@ -3743,7 +3743,7 @@ if ($collation_check_stderr !~ /ERROR: /)
}
# Determine whether build supports LZ4.
-my $supports_lz4 = check_pg_config("#define HAVE_LIBLZ4 1");
+my $supports_lz4 = check_pg_config("#define USE_LZ4 1");
# Create additional databases for mutations of schema public
$node->psql('postgres', 'create database regress_pg_dump_test;');
diff --git a/src/bin/pg_verifybackup/t/008_untar.pl b/src/bin/pg_verifybackup/t/008_untar.pl
index d52ca17430b..98d09ce40c2 100644
--- a/src/bin/pg_verifybackup/t/008_untar.pl
+++ b/src/bin/pg_verifybackup/t/008_untar.pl
@@ -41,7 +41,7 @@ my @test_configuration = (
'backup_archive' => 'base.tar.lz4',
'decompress_program' => $ENV{'LZ4'},
'decompress_flags' => [ '-d', '-m'],
- 'enabled' => check_pg_config("#define HAVE_LIBLZ4 1")
+ 'enabled' => check_pg_config("#define USE_LZ4 1")
},
{
'compression_method' => 'zstd',
@@ -49,7 +49,7 @@ my @test_configuration = (
'backup_archive' => 'base.tar.zst',
'decompress_program' => $ENV{'ZSTD'},
'decompress_flags' => [ '-d' ],
- 'enabled' => check_pg_config("#define HAVE_LIBZSTD 1")
+ 'enabled' => check_pg_config("#define USE_ZSTD 1")
}
);
diff --git a/src/bin/pg_verifybackup/t/009_extract.pl b/src/bin/pg_verifybackup/t/009_extract.pl
index d30ba01742a..9f9cc7540b6 100644
--- a/src/bin/pg_verifybackup/t/009_extract.pl
+++ b/src/bin/pg_verifybackup/t/009_extract.pl
@@ -30,12 +30,12 @@ my @test_configuration = (
{
'compression_method' => 'lz4',
'backup_flags' => ['--compress', 'server-lz4:5'],
- 'enabled' => check_pg_config("#define HAVE_LIBLZ4 1")
+ 'enabled' => check_pg_config("#define USE_LZ4 1")
},
{
'compression_method' => 'zstd',
'backup_flags' => ['--compress', 'server-zstd:5'],
- 'enabled' => check_pg_config("#define HAVE_LIBZSTD 1")
+ 'enabled' => check_pg_config("#define USE_ZSTD 1")
}
);
diff --git a/src/bin/pg_verifybackup/t/010_client_untar.pl b/src/bin/pg_verifybackup/t/010_client_untar.pl
index 0b96b6cc43c..487e30e826d 100644
--- a/src/bin/pg_verifybackup/t/010_client_untar.pl
+++ b/src/bin/pg_verifybackup/t/010_client_untar.pl
@@ -41,7 +41,7 @@ my @test_configuration = (
'decompress_program' => $ENV{'LZ4'},
'decompress_flags' => [ '-d' ],
'output_file' => 'base.tar',
- 'enabled' => check_pg_config("#define HAVE_LIBLZ4 1")
+ 'enabled' => check_pg_config("#define USE_LZ4 1")
},
{
'compression_method' => 'zstd',
@@ -49,7 +49,7 @@ my @test_configuration = (
'backup_archive' => 'base.tar.zst',
'decompress_program' => $ENV{'ZSTD'},
'decompress_flags' => [ '-d' ],
- 'enabled' => check_pg_config("#define HAVE_LIBZSTD 1")
+ 'enabled' => check_pg_config("#define USE_ZSTD 1")
}
);