mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Logical replication
- Add PUBLICATION catalogs and DDL - Add SUBSCRIPTION catalog and DDL - Define logical replication protocol and output plugin - Add logical replication workers From: Petr Jelinek <petr@2ndquadrant.com> Reviewed-by: Steve Singer <steve@ssinger.info> Reviewed-by: Andres Freund <andres@anarazel.de> Reviewed-by: Erik Rijkers <er@xs4all.nl> Reviewed-by: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
This commit is contained in:
@@ -196,6 +196,7 @@ WalReceiverMain(void)
|
||||
WalRcvData *walrcv = WalRcv;
|
||||
TimestampTz last_recv_timestamp;
|
||||
bool ping_sent;
|
||||
char *err;
|
||||
|
||||
/*
|
||||
* WalRcv should be set up already (if we are a backend, we inherit this
|
||||
@@ -293,7 +294,10 @@ WalReceiverMain(void)
|
||||
|
||||
/* Establish the connection to the primary for XLOG streaming */
|
||||
EnableWalRcvImmediateExit();
|
||||
wrconn = walrcv_connect(conninfo, false, "walreceiver");
|
||||
wrconn = walrcv_connect(conninfo, false, "walreceiver", &err);
|
||||
if (!wrconn)
|
||||
ereport(ERROR,
|
||||
(errmsg("could not connect to the primary server: %s", err)));
|
||||
DisableWalRcvImmediateExit();
|
||||
|
||||
/*
|
||||
@@ -316,13 +320,16 @@ WalReceiverMain(void)
|
||||
{
|
||||
char *primary_sysid;
|
||||
char standby_sysid[32];
|
||||
int server_version;
|
||||
WalRcvStreamOptions options;
|
||||
|
||||
/*
|
||||
* Check that we're connected to a valid server using the
|
||||
* IDENTIFY_SYSTEM replication command,
|
||||
* IDENTIFY_SYSTEM replication command.
|
||||
*/
|
||||
EnableWalRcvImmediateExit();
|
||||
primary_sysid = walrcv_identify_system(wrconn, &primaryTLI);
|
||||
primary_sysid = walrcv_identify_system(wrconn, &primaryTLI,
|
||||
&server_version);
|
||||
|
||||
snprintf(standby_sysid, sizeof(standby_sysid), UINT64_FORMAT,
|
||||
GetSystemIdentifier());
|
||||
@@ -368,9 +375,12 @@ WalReceiverMain(void)
|
||||
* history file, bump recovery target timeline, and ask us to restart
|
||||
* on the new timeline.
|
||||
*/
|
||||
options.logical = false;
|
||||
options.startpoint = startpoint;
|
||||
options.slotname = slotname[0] != '\0' ? slotname : NULL;
|
||||
options.proto.physical.startpointTLI = startpointTLI;
|
||||
ThisTimeLineID = startpointTLI;
|
||||
if (walrcv_startstreaming(wrconn, startpointTLI, startpoint,
|
||||
slotname[0] != '\0' ? slotname : NULL))
|
||||
if (walrcv_startstreaming(wrconn, &options))
|
||||
{
|
||||
if (first_stream)
|
||||
ereport(LOG,
|
||||
|
||||
Reference in New Issue
Block a user