mirror of
https://github.com/postgres/postgres.git
synced 2026-03-01 21:01:12 -05:00
Add functionality for a new subscription to copy the initial data in the tables and then sync with the ongoing apply process. For the copying, add a new internal COPY option to have the COPY source data provided by a callback function. The initial data copy works on the subscriber by receiving COPY data from the publisher and then providing it locally into a COPY that writes to the destination table. A WAL receiver can now execute full SQL commands. This is used here to obtain information about tables and publications. Several new options were added to CREATE and ALTER SUBSCRIPTION to control whether and when initial table syncing happens. Change pg_dump option --no-create-subscription-slots to --no-subscription-connect and use the new CREATE SUBSCRIPTION ... NOCONNECT option for that. Author: Petr Jelinek <petr.jelinek@2ndquadrant.com> Tested-by: Erik Rijkers <er@xs4all.nl>
108 lines
2 KiB
C
108 lines
2 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* replnodes.h
|
|
* definitions for replication grammar parse nodes
|
|
*
|
|
*
|
|
* Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/nodes/replnodes.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef REPLNODES_H
|
|
#define REPLNODES_H
|
|
|
|
#include "access/xlogdefs.h"
|
|
#include "nodes/pg_list.h"
|
|
|
|
typedef enum ReplicationKind
|
|
{
|
|
REPLICATION_KIND_PHYSICAL,
|
|
REPLICATION_KIND_LOGICAL
|
|
} ReplicationKind;
|
|
|
|
|
|
/* ----------------------
|
|
* IDENTIFY_SYSTEM command
|
|
* ----------------------
|
|
*/
|
|
typedef struct IdentifySystemCmd
|
|
{
|
|
NodeTag type;
|
|
} IdentifySystemCmd;
|
|
|
|
|
|
/* ----------------------
|
|
* BASE_BACKUP command
|
|
* ----------------------
|
|
*/
|
|
typedef struct BaseBackupCmd
|
|
{
|
|
NodeTag type;
|
|
List *options;
|
|
} BaseBackupCmd;
|
|
|
|
|
|
/* ----------------------
|
|
* CREATE_REPLICATION_SLOT command
|
|
* ----------------------
|
|
*/
|
|
typedef struct CreateReplicationSlotCmd
|
|
{
|
|
NodeTag type;
|
|
char *slotname;
|
|
ReplicationKind kind;
|
|
char *plugin;
|
|
bool temporary;
|
|
List *options;
|
|
} CreateReplicationSlotCmd;
|
|
|
|
|
|
/* ----------------------
|
|
* DROP_REPLICATION_SLOT command
|
|
* ----------------------
|
|
*/
|
|
typedef struct DropReplicationSlotCmd
|
|
{
|
|
NodeTag type;
|
|
char *slotname;
|
|
} DropReplicationSlotCmd;
|
|
|
|
|
|
/* ----------------------
|
|
* START_REPLICATION command
|
|
* ----------------------
|
|
*/
|
|
typedef struct StartReplicationCmd
|
|
{
|
|
NodeTag type;
|
|
ReplicationKind kind;
|
|
char *slotname;
|
|
TimeLineID timeline;
|
|
XLogRecPtr startpoint;
|
|
List *options;
|
|
} StartReplicationCmd;
|
|
|
|
|
|
/* ----------------------
|
|
* TIMELINE_HISTORY command
|
|
* ----------------------
|
|
*/
|
|
typedef struct TimeLineHistoryCmd
|
|
{
|
|
NodeTag type;
|
|
TimeLineID timeline;
|
|
} TimeLineHistoryCmd;
|
|
|
|
/* ----------------------
|
|
* SQL commands
|
|
* ----------------------
|
|
*/
|
|
typedef struct SQLCmd
|
|
{
|
|
NodeTag type;
|
|
} SQLCmd;
|
|
|
|
#endif /* REPLNODES_H */
|