2011-01-14 16:30:33 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* replnodes.h
|
|
|
|
* definitions for replication grammar parse nodes
|
|
|
|
*
|
|
|
|
*
|
2023-01-02 21:00:37 +01:00
|
|
|
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
2011-01-14 16:30:33 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
2011-08-06 20:53:49 +02:00
|
|
|
* src/include/nodes/replnodes.h
|
2011-01-14 16:30:33 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef REPLNODES_H
|
|
|
|
#define REPLNODES_H
|
|
|
|
|
|
|
|
#include "access/xlogdefs.h"
|
2011-08-06 20:53:49 +02:00
|
|
|
#include "nodes/pg_list.h"
|
2011-01-14 16:30:33 +01:00
|
|
|
|
2014-02-01 04:45:17 +01:00
|
|
|
typedef enum ReplicationKind
|
|
|
|
{
|
|
|
|
REPLICATION_KIND_PHYSICAL,
|
|
|
|
REPLICATION_KIND_LOGICAL
|
|
|
|
} ReplicationKind;
|
|
|
|
|
2011-01-14 16:30:33 +01:00
|
|
|
|
|
|
|
/* ----------------------
|
|
|
|
* IDENTIFY_SYSTEM command
|
|
|
|
* ----------------------
|
|
|
|
*/
|
|
|
|
typedef struct IdentifySystemCmd
|
|
|
|
{
|
|
|
|
NodeTag type;
|
|
|
|
} IdentifySystemCmd;
|
|
|
|
|
|
|
|
|
|
|
|
/* ----------------------
|
|
|
|
* BASE_BACKUP command
|
|
|
|
* ----------------------
|
|
|
|
*/
|
|
|
|
typedef struct BaseBackupCmd
|
|
|
|
{
|
|
|
|
NodeTag type;
|
2011-01-23 23:39:18 +01:00
|
|
|
List *options;
|
2011-01-14 16:30:33 +01:00
|
|
|
} BaseBackupCmd;
|
|
|
|
|
|
|
|
|
2014-02-01 04:45:17 +01:00
|
|
|
/* ----------------------
|
|
|
|
* CREATE_REPLICATION_SLOT command
|
|
|
|
* ----------------------
|
|
|
|
*/
|
|
|
|
typedef struct CreateReplicationSlotCmd
|
|
|
|
{
|
|
|
|
NodeTag type;
|
|
|
|
char *slotname;
|
|
|
|
ReplicationKind kind;
|
|
|
|
char *plugin;
|
2016-12-08 18:00:00 +01:00
|
|
|
bool temporary;
|
2017-03-14 22:13:56 +01:00
|
|
|
List *options;
|
2014-02-01 04:45:17 +01:00
|
|
|
} CreateReplicationSlotCmd;
|
|
|
|
|
|
|
|
|
|
|
|
/* ----------------------
|
|
|
|
* DROP_REPLICATION_SLOT command
|
|
|
|
* ----------------------
|
|
|
|
*/
|
|
|
|
typedef struct DropReplicationSlotCmd
|
|
|
|
{
|
|
|
|
NodeTag type;
|
|
|
|
char *slotname;
|
2017-09-01 13:44:14 +02:00
|
|
|
bool wait;
|
2014-02-01 04:45:17 +01:00
|
|
|
} DropReplicationSlotCmd;
|
|
|
|
|
|
|
|
|
2011-01-14 16:30:33 +01:00
|
|
|
/* ----------------------
|
|
|
|
* START_REPLICATION command
|
|
|
|
* ----------------------
|
|
|
|
*/
|
|
|
|
typedef struct StartReplicationCmd
|
|
|
|
{
|
|
|
|
NodeTag type;
|
2014-02-01 04:45:17 +01:00
|
|
|
ReplicationKind kind;
|
|
|
|
char *slotname;
|
Allow a streaming replication standby to follow a timeline switch.
Before this patch, streaming replication would refuse to start replicating
if the timeline in the primary doesn't exactly match the standby. The
situation where it doesn't match is when you have a master, and two
standbys, and you promote one of the standbys to become new master.
Promoting bumps up the timeline ID, and after that bump, the other standby
would refuse to continue.
There's significantly more timeline related logic in streaming replication
now. First of all, when a standby connects to primary, it will ask the
primary for any timeline history files that are missing from the standby.
The missing files are sent using a new replication command TIMELINE_HISTORY,
and stored in standby's pg_xlog directory. Using the timeline history files,
the standby can follow the latest timeline present in the primary
(recovery_target_timeline='latest'), just as it can follow new timelines
appearing in an archive directory.
START_REPLICATION now takes a TIMELINE parameter, to specify exactly which
timeline to stream WAL from. This allows the standby to request the primary
to send over WAL that precedes the promotion. The replication protocol is
changed slightly (in a backwards-compatible way although there's little hope
of streaming replication working across major versions anyway), to allow
replication to stop when the end of timeline reached, putting the walsender
back into accepting a replication command.
Many thanks to Amit Kapila for testing and reviewing various versions of
this patch.
2012-12-13 18:00:00 +01:00
|
|
|
TimeLineID timeline;
|
2011-01-14 16:30:33 +01:00
|
|
|
XLogRecPtr startpoint;
|
2014-02-01 04:45:17 +01:00
|
|
|
List *options;
|
2011-01-14 16:30:33 +01:00
|
|
|
} StartReplicationCmd;
|
|
|
|
|
Allow a streaming replication standby to follow a timeline switch.
Before this patch, streaming replication would refuse to start replicating
if the timeline in the primary doesn't exactly match the standby. The
situation where it doesn't match is when you have a master, and two
standbys, and you promote one of the standbys to become new master.
Promoting bumps up the timeline ID, and after that bump, the other standby
would refuse to continue.
There's significantly more timeline related logic in streaming replication
now. First of all, when a standby connects to primary, it will ask the
primary for any timeline history files that are missing from the standby.
The missing files are sent using a new replication command TIMELINE_HISTORY,
and stored in standby's pg_xlog directory. Using the timeline history files,
the standby can follow the latest timeline present in the primary
(recovery_target_timeline='latest'), just as it can follow new timelines
appearing in an archive directory.
START_REPLICATION now takes a TIMELINE parameter, to specify exactly which
timeline to stream WAL from. This allows the standby to request the primary
to send over WAL that precedes the promotion. The replication protocol is
changed slightly (in a backwards-compatible way although there's little hope
of streaming replication working across major versions anyway), to allow
replication to stop when the end of timeline reached, putting the walsender
back into accepting a replication command.
Many thanks to Amit Kapila for testing and reviewing various versions of
this patch.
2012-12-13 18:00:00 +01:00
|
|
|
|
2021-10-25 00:40:42 +02:00
|
|
|
/* ----------------------
|
|
|
|
* READ_REPLICATION_SLOT command
|
|
|
|
* ----------------------
|
|
|
|
*/
|
|
|
|
typedef struct ReadReplicationSlotCmd
|
|
|
|
{
|
|
|
|
NodeTag type;
|
|
|
|
char *slotname;
|
|
|
|
} ReadReplicationSlotCmd;
|
|
|
|
|
|
|
|
|
Allow a streaming replication standby to follow a timeline switch.
Before this patch, streaming replication would refuse to start replicating
if the timeline in the primary doesn't exactly match the standby. The
situation where it doesn't match is when you have a master, and two
standbys, and you promote one of the standbys to become new master.
Promoting bumps up the timeline ID, and after that bump, the other standby
would refuse to continue.
There's significantly more timeline related logic in streaming replication
now. First of all, when a standby connects to primary, it will ask the
primary for any timeline history files that are missing from the standby.
The missing files are sent using a new replication command TIMELINE_HISTORY,
and stored in standby's pg_xlog directory. Using the timeline history files,
the standby can follow the latest timeline present in the primary
(recovery_target_timeline='latest'), just as it can follow new timelines
appearing in an archive directory.
START_REPLICATION now takes a TIMELINE parameter, to specify exactly which
timeline to stream WAL from. This allows the standby to request the primary
to send over WAL that precedes the promotion. The replication protocol is
changed slightly (in a backwards-compatible way although there's little hope
of streaming replication working across major versions anyway), to allow
replication to stop when the end of timeline reached, putting the walsender
back into accepting a replication command.
Many thanks to Amit Kapila for testing and reviewing various versions of
this patch.
2012-12-13 18:00:00 +01:00
|
|
|
/* ----------------------
|
|
|
|
* TIMELINE_HISTORY command
|
|
|
|
* ----------------------
|
|
|
|
*/
|
|
|
|
typedef struct TimeLineHistoryCmd
|
|
|
|
{
|
|
|
|
NodeTag type;
|
|
|
|
TimeLineID timeline;
|
|
|
|
} TimeLineHistoryCmd;
|
|
|
|
|
2011-01-14 16:30:33 +01:00
|
|
|
#endif /* REPLNODES_H */
|