diff options
| author | Magnus Hagander | 2016-03-11 10:08:01 +0000 |
|---|---|---|
| committer | Magnus Hagander | 2016-03-11 10:15:12 +0000 |
| commit | 38c83c9b7569378d864d8915e291716b8bec15f2 (patch) | |
| tree | 1bd74adad635b071024708f90d591074bf125ec0 /src/bin/pg_basebackup/pg_basebackup.c | |
| parent | 73e7e49da3b23a15cd84f003e11ad7d55ad80da7 (diff) | |
Refactor receivelog.c parameters
Much cruft had accumulated over time with a large number of parameters
passed down between functions very deep. With this refactoring, instead
introduce a StreamCtl structure that holds the parameters, and pass around
a pointer to this structure instead. This makes it much easier to add or
remove fields that are needed deeper down in the implementation without
having to modify every function header in the file.
Patch by me after much nagging from Andres
Reviewed by Craig Ringer and Daniel Gustafsson
Diffstat (limited to 'src/bin/pg_basebackup/pg_basebackup.c')
| -rw-r--r-- | src/bin/pg_basebackup/pg_basebackup.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c index ab9692a6d56..94852877a2d 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -372,10 +372,20 @@ typedef struct static int LogStreamerMain(logstreamer_param *param) { - if (!ReceiveXlogStream(param->bgconn, param->startptr, param->timeline, - param->sysidentifier, param->xlogdir, - reached_end_position, standby_message_timeout, - NULL, false, true)) + StreamCtl stream; + + MemSet(&stream, sizeof(stream), 0); + stream.startpos = param->startptr; + stream.timeline = param->timeline; + stream.sysidentifier = param->sysidentifier; + stream.stream_stop = reached_end_position; + stream.standby_message_timeout = standby_message_timeout; + stream.synchronous = false; + stream.mark_done = true; + stream.basedir = param->xlogdir; + stream.partial_suffix = NULL; + + if (!ReceiveXlogStream(param->bgconn, &stream)) /* * Any errors will already have been reported in the function process, |
