Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5917671

Browse files
committed
pg_basebackup: Try to fix some failures on Windows.
Commit ffd5365 messed up the mechanism that was being used to pass parameters to LogStreamerMain() on Windows. It worked on Linux because only Windows was using threads. Repair by moving the additional parameters added by that commit into the 'logstreamer_param' struct. Along the way, fix a compiler warning on builds without HAVE_LIBZ. Discussion: http://postgr.es/m/CA+TgmoY5=AmWOtMj3v+cySP2rR=Bt6EGyF_joAq4CfczMddKtw@mail.gmail.com
1 parent 9d92582 commit 5917671

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/backend/replication/basebackup_gzip.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,14 @@ const bbsink_ops bbsink_gzip_ops = {
6161
bbsink *
6262
bbsink_gzip_new(bbsink *next, bc_specification *compress)
6363
{
64-
int compresslevel;
65-
6664
#ifndef HAVE_LIBZ
6765
ereport(ERROR,
6866
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
6967
errmsg("gzip compression is not supported by this build")));
7068
return NULL; /* keep compiler quiet */
7169
#else
7270
bbsink_gzip *sink;
71+
int compresslevel;
7372

7473
Assert(next != NULL);
7574

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -541,12 +541,12 @@ typedef struct
541541
char xlog[MAXPGPATH]; /* directory or tarfile depending on mode */
542542
char *sysidentifier;
543543
int timeline;
544+
WalCompressionMethod wal_compress_method;
545+
int wal_compress_level;
544546
} logstreamer_param;
545547

546548
static int
547-
LogStreamerMain(logstreamer_param *param,
548-
WalCompressionMethod wal_compress_method,
549-
int wal_compress_level)
549+
LogStreamerMain(logstreamer_param *param)
550550
{
551551
StreamCtl stream;
552552

@@ -575,8 +575,8 @@ LogStreamerMain(logstreamer_param *param,
575575
stream.do_sync);
576576
else
577577
stream.walmethod = CreateWalTarMethod(param->xlog,
578-
wal_compress_method,
579-
wal_compress_level,
578+
param->wal_compress_method,
579+
param->wal_compress_level,
580580
stream.do_sync);
581581

582582
if (!ReceiveXlogStream(param->bgconn, &stream))
@@ -634,6 +634,8 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier,
634634
param = pg_malloc0(sizeof(logstreamer_param));
635635
param->timeline = timeline;
636636
param->sysidentifier = sysidentifier;
637+
param->wal_compress_method = wal_compress_method;
638+
param->wal_compress_level = wal_compress_level;
637639

638640
/* Convert the starting position */
639641
if (sscanf(startpos, "%X/%X", &hi, &lo) != 2)
@@ -724,7 +726,7 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier,
724726
int ret;
725727

726728
/* in child process */
727-
ret = LogStreamerMain(param, wal_compress_method, wal_compress_level);
729+
ret = LogStreamerMain(param);
728730

729731
/* temp debugging aid to analyze 019_replslot_limit failures */
730732
if (verbose)

0 commit comments

Comments
 (0)