Skip to content

Commit 75eae09

Browse files
committed
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
1 parent 695f459 commit 75eae09

File tree

11 files changed

+41
-41
lines changed

11 files changed

+41
-41
lines changed

src/backend/replication/basebackup_lz4.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
*/
1313
#include "postgres.h"
1414

15-
#ifdef HAVE_LIBLZ4
15+
#ifdef USE_LZ4
1616
#include <lz4frame.h>
1717
#endif
1818

1919
#include "replication/basebackup_sink.h"
2020

21-
#ifdef HAVE_LIBLZ4
21+
#ifdef USE_LZ4
2222

2323
typedef struct bbsink_lz4
2424
{
@@ -62,7 +62,7 @@ const bbsink_ops bbsink_lz4_ops = {
6262
bbsink *
6363
bbsink_lz4_new(bbsink *next, int compresslevel)
6464
{
65-
#ifndef HAVE_LIBLZ4
65+
#ifndef USE_LZ4
6666
ereport(ERROR,
6767
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
6868
errmsg("lz4 compression is not supported by this build")));
@@ -87,7 +87,7 @@ bbsink_lz4_new(bbsink *next, int compresslevel)
8787
#endif
8888
}
8989

90-
#ifdef HAVE_LIBLZ4
90+
#ifdef USE_LZ4
9191

9292
/*
9393
* Begin backup.

src/backend/replication/basebackup_zstd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
*/
1313
#include "postgres.h"
1414

15-
#ifdef HAVE_LIBZSTD
15+
#ifdef USE_ZSTD
1616
#include <zstd.h>
1717
#endif
1818

1919
#include "replication/basebackup_sink.h"
2020

21-
#ifdef HAVE_LIBZSTD
21+
#ifdef USE_ZSTD
2222

2323
typedef struct bbsink_zstd
2424
{
@@ -61,7 +61,7 @@ const bbsink_ops bbsink_zstd_ops = {
6161
bbsink *
6262
bbsink_zstd_new(bbsink *next, int compresslevel)
6363
{
64-
#ifndef HAVE_LIBZSTD
64+
#ifndef USE_ZSTD
6565
ereport(ERROR,
6666
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
6767
errmsg("zstd compression is not supported by this build")));
@@ -86,7 +86,7 @@ bbsink_zstd_new(bbsink *next, int compresslevel)
8686
#endif
8787
}
8888

89-
#ifdef HAVE_LIBZSTD
89+
#ifdef USE_ZSTD
9090

9191
/*
9292
* Begin backup.

src/bin/pg_basebackup/bbstreamer_lz4.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include <unistd.h>
1515

16-
#ifdef HAVE_LIBLZ4
16+
#ifdef USE_LZ4
1717
#include <lz4frame.h>
1818
#endif
1919

@@ -22,7 +22,7 @@
2222
#include "common/file_perm.h"
2323
#include "common/string.h"
2424

25-
#ifdef HAVE_LIBLZ4
25+
#ifdef USE_LZ4
2626
typedef struct bbstreamer_lz4_frame
2727
{
2828
bbstreamer base;
@@ -69,7 +69,7 @@ const bbstreamer_ops bbstreamer_lz4_decompressor_ops = {
6969
bbstreamer *
7070
bbstreamer_lz4_compressor_new(bbstreamer *next, int compresslevel)
7171
{
72-
#ifdef HAVE_LIBLZ4
72+
#ifdef USE_LZ4
7373
bbstreamer_lz4_frame *streamer;
7474
LZ4F_errorCode_t ctxError;
7575
LZ4F_preferences_t *prefs;
@@ -114,7 +114,7 @@ bbstreamer_lz4_compressor_new(bbstreamer *next, int compresslevel)
114114
#endif
115115
}
116116

117-
#ifdef HAVE_LIBLZ4
117+
#ifdef USE_LZ4
118118
/*
119119
* Compress the input data to output buffer.
120120
*
@@ -280,7 +280,7 @@ bbstreamer_lz4_compressor_free(bbstreamer *streamer)
280280
bbstreamer *
281281
bbstreamer_lz4_decompressor_new(bbstreamer *next)
282282
{
283-
#ifdef HAVE_LIBLZ4
283+
#ifdef USE_LZ4
284284
bbstreamer_lz4_frame *streamer;
285285
LZ4F_errorCode_t ctxError;
286286

@@ -309,7 +309,7 @@ bbstreamer_lz4_decompressor_new(bbstreamer *next)
309309
#endif
310310
}
311311

312-
#ifdef HAVE_LIBLZ4
312+
#ifdef USE_LZ4
313313
/*
314314
* Decompress the input data to output buffer until we run out of input
315315
* data. Each time the output buffer is full, pass on the decompressed data

src/bin/pg_basebackup/bbstreamer_zstd.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313

1414
#include <unistd.h>
1515

16-
#ifdef HAVE_LIBZSTD
16+
#ifdef USE_ZSTD
1717
#include <zstd.h>
1818
#endif
1919

2020
#include "bbstreamer.h"
2121
#include "common/logging.h"
2222

23-
#ifdef HAVE_LIBZSTD
23+
#ifdef USE_ZSTD
2424

2525
typedef struct bbstreamer_zstd_frame
2626
{
@@ -65,7 +65,7 @@ const bbstreamer_ops bbstreamer_zstd_decompressor_ops = {
6565
bbstreamer *
6666
bbstreamer_zstd_compressor_new(bbstreamer *next, int compresslevel)
6767
{
68-
#ifdef HAVE_LIBZSTD
68+
#ifdef USE_ZSTD
6969
bbstreamer_zstd_frame *streamer;
7070

7171
Assert(next != NULL);
@@ -99,7 +99,7 @@ bbstreamer_zstd_compressor_new(bbstreamer *next, int compresslevel)
9999
#endif
100100
}
101101

102-
#ifdef HAVE_LIBZSTD
102+
#ifdef USE_ZSTD
103103
/*
104104
* Compress the input data to output buffer.
105105
*
@@ -225,7 +225,7 @@ bbstreamer_zstd_compressor_free(bbstreamer *streamer)
225225
bbstreamer *
226226
bbstreamer_zstd_decompressor_new(bbstreamer *next)
227227
{
228-
#ifdef HAVE_LIBZSTD
228+
#ifdef USE_ZSTD
229229
bbstreamer_zstd_frame *streamer;
230230

231231
Assert(next != NULL);
@@ -257,7 +257,7 @@ bbstreamer_zstd_decompressor_new(bbstreamer *next)
257257
#endif
258258
}
259259

260-
#ifdef HAVE_LIBZSTD
260+
#ifdef USE_ZSTD
261261
/*
262262
* Decompress the input data to output buffer until we run out of input
263263
* data. Each time the output buffer is full, pass on the decompressed data

src/bin/pg_basebackup/pg_receivewal.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "receivelog.h"
3333
#include "streamutil.h"
3434

35-
#ifdef HAVE_LIBLZ4
35+
#ifdef USE_LZ4
3636
#include "lz4frame.h"
3737
#endif
3838

@@ -382,7 +382,7 @@ FindStreamingStart(uint32 *tli)
382382
}
383383
else if (!ispartial && wal_compression_method == COMPRESSION_LZ4)
384384
{
385-
#ifdef HAVE_LIBLZ4
385+
#ifdef USE_LZ4
386386
#define LZ4_CHUNK_SZ 64 * 1024 /* 64kB as maximum chunk size read */
387387
int fd;
388388
ssize_t r;
@@ -889,7 +889,7 @@ main(int argc, char **argv)
889889
#endif
890890
break;
891891
case COMPRESSION_LZ4:
892-
#ifdef HAVE_LIBLZ4
892+
#ifdef USE_LZ4
893893
if (compresslevel != 0)
894894
{
895895
pg_log_error("cannot use --compress with --compression-method=%s",

src/bin/pg_basebackup/t/020_pg_receivewal.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
SKIP:
142142
{
143143
skip "postgres was not built with LZ4 support", 5
144-
if (!check_pg_config("#define HAVE_LIBLZ4 1"));
144+
if (!check_pg_config("#define USE_LZ4 1"));
145145

146146
# Generate more WAL including one completed, compressed segment.
147147
$primary->psql('postgres', 'SELECT pg_switch_wal();');

src/bin/pg_basebackup/walmethods.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <time.h>
1919
#include <unistd.h>
2020

21-
#ifdef HAVE_LIBLZ4
21+
#ifdef USE_LZ4
2222
#include <lz4frame.h>
2323
#endif
2424
#ifdef HAVE_LIBZ
@@ -70,7 +70,7 @@ typedef struct DirectoryMethodFile
7070
#ifdef HAVE_LIBZ
7171
gzFile gzfp;
7272
#endif
73-
#ifdef HAVE_LIBLZ4
73+
#ifdef USE_LZ4
7474
LZ4F_compressionContext_t ctx;
7575
size_t lz4bufsize;
7676
void *lz4buf;
@@ -114,7 +114,7 @@ dir_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
114114
#ifdef HAVE_LIBZ
115115
gzFile gzfp = NULL;
116116
#endif
117-
#ifdef HAVE_LIBLZ4
117+
#ifdef USE_LZ4
118118
LZ4F_compressionContext_t ctx = NULL;
119119
size_t lz4bufsize = 0;
120120
void *lz4buf = NULL;
@@ -160,7 +160,7 @@ dir_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
160160
}
161161
}
162162
#endif
163-
#ifdef HAVE_LIBLZ4
163+
#ifdef USE_LZ4
164164
if (dir_data->compression_method == COMPRESSION_LZ4)
165165
{
166166
size_t ctx_out;
@@ -245,7 +245,7 @@ dir_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
245245
gzclose(gzfp);
246246
else
247247
#endif
248-
#ifdef HAVE_LIBLZ4
248+
#ifdef USE_LZ4
249249
if (dir_data->compression_method == COMPRESSION_LZ4)
250250
{
251251
(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_
265265
if (dir_data->compression_method == COMPRESSION_GZIP)
266266
f->gzfp = gzfp;
267267
#endif
268-
#ifdef HAVE_LIBLZ4
268+
#ifdef USE_LZ4
269269
if (dir_data->compression_method == COMPRESSION_LZ4)
270270
{
271271
f->ctx = ctx;
@@ -306,7 +306,7 @@ dir_write(Walfile f, const void *buf, size_t count)
306306
}
307307
else
308308
#endif
309-
#ifdef HAVE_LIBLZ4
309+
#ifdef USE_LZ4
310310
if (dir_data->compression_method == COMPRESSION_LZ4)
311311
{
312312
size_t chunk;
@@ -394,7 +394,7 @@ dir_close(Walfile f, WalCloseMethod method)
394394
}
395395
else
396396
#endif
397-
#ifdef HAVE_LIBLZ4
397+
#ifdef USE_LZ4
398398
if (dir_data->compression_method == COMPRESSION_LZ4)
399399
{
400400
size_t compressed;
@@ -487,7 +487,7 @@ dir_close(Walfile f, WalCloseMethod method)
487487
if (r != 0)
488488
dir_data->lasterrno = errno;
489489

490-
#ifdef HAVE_LIBLZ4
490+
#ifdef USE_LZ4
491491
pg_free(df->lz4buf);
492492
/* supports free on NULL */
493493
LZ4F_freeCompressionContext(df->ctx);
@@ -523,7 +523,7 @@ dir_sync(Walfile f)
523523
}
524524
}
525525
#endif
526-
#ifdef HAVE_LIBLZ4
526+
#ifdef USE_LZ4
527527
if (dir_data->compression_method == COMPRESSION_LZ4)
528528
{
529529
DirectoryMethodFile *df = (DirectoryMethodFile *) f;

src/bin/pg_dump/t/002_pg_dump.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3743,7 +3743,7 @@
37433743
}
37443744
37453745
# Determine whether build supports LZ4.
3746-
my $supports_lz4 = check_pg_config("#define HAVE_LIBLZ4 1");
3746+
my $supports_lz4 = check_pg_config("#define USE_LZ4 1");
37473747
37483748
# Create additional databases for mutations of schema public
37493749
$node->psql('postgres', 'create database regress_pg_dump_test;');

src/bin/pg_verifybackup/t/008_untar.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@
4141
'backup_archive' => 'base.tar.lz4',
4242
'decompress_program' => $ENV{'LZ4'},
4343
'decompress_flags' => [ '-d', '-m'],
44-
'enabled' => check_pg_config("#define HAVE_LIBLZ4 1")
44+
'enabled' => check_pg_config("#define USE_LZ4 1")
4545
},
4646
{
4747
'compression_method' => 'zstd',
4848
'backup_flags' => ['--compress', 'server-zstd'],
4949
'backup_archive' => 'base.tar.zst',
5050
'decompress_program' => $ENV{'ZSTD'},
5151
'decompress_flags' => [ '-d' ],
52-
'enabled' => check_pg_config("#define HAVE_LIBZSTD 1")
52+
'enabled' => check_pg_config("#define USE_ZSTD 1")
5353
}
5454
);
5555

src/bin/pg_verifybackup/t/009_extract.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
{
3131
'compression_method' => 'lz4',
3232
'backup_flags' => ['--compress', 'server-lz4:5'],
33-
'enabled' => check_pg_config("#define HAVE_LIBLZ4 1")
33+
'enabled' => check_pg_config("#define USE_LZ4 1")
3434
},
3535
{
3636
'compression_method' => 'zstd',
3737
'backup_flags' => ['--compress', 'server-zstd:5'],
38-
'enabled' => check_pg_config("#define HAVE_LIBZSTD 1")
38+
'enabled' => check_pg_config("#define USE_ZSTD 1")
3939
}
4040
);
4141

src/bin/pg_verifybackup/t/010_client_untar.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@
4141
'decompress_program' => $ENV{'LZ4'},
4242
'decompress_flags' => [ '-d' ],
4343
'output_file' => 'base.tar',
44-
'enabled' => check_pg_config("#define HAVE_LIBLZ4 1")
44+
'enabled' => check_pg_config("#define USE_LZ4 1")
4545
},
4646
{
4747
'compression_method' => 'zstd',
4848
'backup_flags' => ['--compress', 'client-zstd:5'],
4949
'backup_archive' => 'base.tar.zst',
5050
'decompress_program' => $ENV{'ZSTD'},
5151
'decompress_flags' => [ '-d' ],
52-
'enabled' => check_pg_config("#define HAVE_LIBZSTD 1")
52+
'enabled' => check_pg_config("#define USE_ZSTD 1")
5353
}
5454
);
5555

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy