summaryrefslogtreecommitdiff
path: root/src/bin/pg_basebackup/pg_receivexlog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_basebackup/pg_receivexlog.c')
-rw-r--r--src/bin/pg_basebackup/pg_receivexlog.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/bin/pg_basebackup/pg_receivexlog.c b/src/bin/pg_basebackup/pg_receivexlog.c
index f96b547b0f3..7f7ee9dc9ba 100644
--- a/src/bin/pg_basebackup/pg_receivexlog.c
+++ b/src/bin/pg_basebackup/pg_receivexlog.c
@@ -276,10 +276,11 @@ FindStreamingStart(uint32 *tli)
static void
StreamLog(void)
{
- XLogRecPtr startpos,
- serverpos;
- TimeLineID starttli,
- servertli;
+ XLogRecPtr serverpos;
+ TimeLineID servertli;
+ StreamCtl stream;
+
+ MemSet(&stream, 0, sizeof(stream));
/*
* Connect in replication mode to the server
@@ -311,17 +312,17 @@ StreamLog(void)
/*
* Figure out where to start streaming.
*/
- startpos = FindStreamingStart(&starttli);
- if (startpos == InvalidXLogRecPtr)
+ stream.startpos = FindStreamingStart(&stream.timeline);
+ if (stream.startpos == InvalidXLogRecPtr)
{
- startpos = serverpos;
- starttli = servertli;
+ stream.startpos = serverpos;
+ stream.timeline = servertli;
}
/*
* Always start streaming at the beginning of a segment
*/
- startpos -= startpos % XLOG_SEG_SIZE;
+ stream.startpos -= stream.startpos % XLOG_SEG_SIZE;
/*
* Start the replication
@@ -329,12 +330,17 @@ StreamLog(void)
if (verbose)
fprintf(stderr,
_("%s: starting log streaming at %X/%X (timeline %u)\n"),
- progname, (uint32) (startpos >> 32), (uint32) startpos,
- starttli);
+ progname, (uint32) (stream.startpos >> 32), (uint32) stream.startpos,
+ stream.timeline);
+
+ stream.stream_stop = stop_streaming;
+ stream.standby_message_timeout = standby_message_timeout;
+ stream.synchronous = synchronous;
+ stream.mark_done = false;
+ stream.basedir = basedir;
+ stream.partial_suffix = ".partial";
- ReceiveXlogStream(conn, startpos, starttli, NULL, basedir,
- stop_streaming, standby_message_timeout, ".partial",
- synchronous, false);
+ ReceiveXlogStream(conn, &stream);
PQfinish(conn);
conn = NULL;