mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
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
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user