pg_create_physical_replication_slot
-
pg_create_physical_replication_slot(slotname name)
+
pg_create_physical_replication_slot(slot_name name)
- (
slotname name,
xlog_position pg_lsn)
+ (
slot_name name,
xlog_position pg_lsn)
Creates a new physical replication slot named
-
slotname. Streaming changes from a physical slot
+
slot_name. Streaming changes from a physical slot
is only possible with the walsender protocol - see
linkend="protocol-replication">. Corresponds to the walsender protocol
command CREATE_REPLICATION_SLOT ... PHYSICAL.
-
pg_drop_replication_slot(slotname name)
+
pg_drop_replication_slot(slot_name name)
void
Drops the physical or logical replication slot
- named
slotname. Same as walsender protocol
+ named
slot_name. Same as walsender protocol
command DROP_REPLICATION_SLOT>.
pg_create_logical_replication_slot
-
pg_create_logical_replication_slot(slotname name, plugin name)
+
pg_create_logical_replication_slot(slot_name name, plugin name)
- (
slotname name,
xlog_position pg_lsn)
+ (
slot_name name,
xlog_position pg_lsn)
Creates a new logical (decoding) replication slot named
-
slotname using the output plugin
+
slot_name using the output plugin
plugin. A call to this function has the same
effect as the replication protocol command
CREATE REPLICATION SLOT ... LOGICAL.
pg_logical_slot_get_changes
-
pg_logical_slot_get_changes(slotname name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[])
+
pg_logical_slot_get_changes(slot_name name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[])
(
location pg_lsn,
xid xid,
data text)
- Returns changes in the slot
slotname, starting
+ Returns changes in the slot
slot_name, starting
from the point at which since changes have been consumed last. If
upto_lsn> and upto_nchanges> are NULL,
- logical decoding will continue until end of WAL. If
+ logical decoding will continue until end of WAL. If
upto_lsn> is non-NULL, decoding will include only
those transactions which commit prior to the specified LSN. If
upto_nchanges is non-NULL, decoding will
pg_logical_slot_peek_changes
-
pg_logical_slot_peek_changes(slotname name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[])
+
pg_logical_slot_peek_changes(slot_name name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[])
(
location text,
xid xid,
data text)
pg_logical_slot_get_binary_changes
-
pg_logical_slot_get_binary_changes(slotname name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[])
+
pg_logical_slot_get_binary_changes(slot_name name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[])
(
location pg_lsn,
xid xid,
data bytea)
pg_logical_slot_peek_binary_changes
-
pg_logical_slot_peek_binary_changes(slotname name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[])
+
pg_logical_slot_peek_binary_changes(slot_name name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[])
(
location pg_lsn,
xid xid,
data bytea)
You can create a replication slot like this:
postgres=# SELECT * FROM pg_create_physical_replication_slot('node_a_slot');
- slotname | xlog_position
+ slot_name | xlog_position
-------------+---------------
node_a_slot |
node_a_slot | physical | | | f | |
(1 row)
- To configure the standby to use this slot, primary_slotname>
+ To configure the standby to use this slot, primary_slot_name>
should be configured in the standby's recovery.conf>.
Here is a simple example:
standby_mode = 'on'
primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass'
-primary_slotname = 'node_a_slot'
+primary_slot_name = 'node_a_slot'
postgres=# -- Create a slot named 'regression_slot' using the output plugin 'test_decoding'
postgres=# SELECT * FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
- slotname | xlog_position
+ slot_name | xlog_position
-----------------+---------------
regression_slot | 0/16B1970
(1 row)
Streaming Replication Protocol Interface
- The CREATE_REPLICATION_SLOT slotname LOGICAL
- options, DROP_REPLICATION_SLOT slotname
- and START_REPLICATION SLOT slotname LOGICAL options
+ The CREATE_REPLICATION_SLOT slot_name LOGICAL
+ options, DROP_REPLICATION_SLOT slot_name
+ and START_REPLICATION SLOT slot_name LOGICAL options
commands can be used to create, drop and stream changes from a replication
slot respectively. These commands are only available over a replication
connection; they cannot be used via SQL.
-
CREATE_REPLICATION_SLOT slotname> { PHYSICAL> | LOGICAL> output_plugin> } CREATE_REPLICATION_SLOT
+
CREATE_REPLICATION_SLOT slot_name> { PHYSICAL> | LOGICAL> output_plugin> } CREATE_REPLICATION_SLOT
Create a physical or logical replication
- slotname>
+ slot_name>
The name of the slot to create. Must be a valid replication slot
- START_REPLICATION [SLOT slotname>] [PHYSICAL] XXX/XXX> [TIMELINE tli>]
+ START_REPLICATION [SLOT slot_name>] [PHYSICAL] XXX/XXX> [TIMELINE tli>]
Instructs server to start streaming WAL, starting at
If a slot's name is provided
- via slotname>, it will be updated
+ via slot_name>, it will be updated
as replication progresses so that the server knows which WAL segments -
and if hot_standby_feedback> is on which transactions -
are still needed by the standby.
- START_REPLICATION SLOT slotname> LOGICAL XXX/XXX> [ ( option_name [option_value] [, ... ] ) ]
+ START_REPLICATION SLOT slot_name> LOGICAL XXX/XXX> [ ( option_name [option_value] [, ... ] ) ]
Instructs server to start streaming WAL for logical replication, starting
- SLOT slotname>
+ SLOT slot_name>
The name of the slot to stream changes from. This parameter is required,
- DROP_REPLICATION_SLOT slotname>
+ DROP_REPLICATION_SLOT slot_name>
Drops a replication slot, freeing any reserved server-side resources. If
- slotname>
+ slot_name>
The name of the slot to drop.
- name" xreflabel="primary_slotname">
- primary_slotname (string)
+ -name" xreflabel="primary_slot_name">
+ primary_slot_name (string)
-
primary_slotname> recovery parameter
+
primary_slot_name> recovery parameter
# removal on the upstream node. This setting has no effect if primary_conninfo
# is not set.
#
-#primary_slotname = ''
+#primary_slot_name = ''
#
# By default, a standby server keeps restoring XLOG records from the
# primary indefinitely. If you want to stop the standby mode, finish recovery
(errmsg_internal("primary_conninfo = '%s'",
PrimaryConnInfo)));
}
- else if (strcmp(item->name, "primary_slotname") == 0)
+ else if (strcmp(item->name, "primary_slot_name") == 0)
{
ReplicationSlotValidateName(item->value, ERROR);
PrimarySlotName = pstrdup(item->value);
ereport(DEBUG2,
- (errmsg_internal("primary_slotname = '%s'",
+ (errmsg_internal("primary_slot_name = '%s'",
PrimarySlotName)));
}
else if (strcmp(item->name, "trigger_file") == 0)
RETURNS SETOF record LANGUAGE internal STABLE ROWS 100 AS 'jsonb_to_recordset';
CREATE OR REPLACE FUNCTION pg_logical_slot_get_changes(
- IN slotname name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}',
+ IN slot_name name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}',
OUT location pg_lsn, OUT xid xid, OUT data text)
RETURNS SETOF RECORD
LANGUAGE INTERNAL
AS 'pg_logical_slot_get_changes';
CREATE OR REPLACE FUNCTION pg_logical_slot_peek_changes(
- IN slotname name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}',
+ IN slot_name name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}',
OUT location pg_lsn, OUT xid xid, OUT data text)
RETURNS SETOF RECORD
LANGUAGE INTERNAL
AS 'pg_logical_slot_peek_changes';
CREATE OR REPLACE FUNCTION pg_logical_slot_get_binary_changes(
- IN slotname name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}',
+ IN slot_name name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}',
OUT location pg_lsn, OUT xid xid, OUT data bytea)
RETURNS SETOF RECORD
LANGUAGE INTERNAL
AS 'pg_logical_slot_get_binary_changes';
CREATE OR REPLACE FUNCTION pg_logical_slot_peek_binary_changes(
- IN slotname name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}',
+ IN slot_name name, IN upto_lsn pg_lsn, IN upto_nchanges int, VARIADIC options text[] DEFAULT '{}',
OUT location pg_lsn, OUT xid xid, OUT data bytea)
RETURNS SETOF RECORD
LANGUAGE INTERNAL
printf(_(" -P, --plugin=PLUGIN use output plugin PLUGIN (default: %s)\n"), plugin);
printf(_(" -s, --status-interval=SECS\n"
" time between status packets sent to server (default: %d)\n"), (standby_message_timeout / 1000));
- printf(_(" -S, --slot=SLOT use existing replication slot SLOT instead of starting a new one\n"));
+ printf(_(" -S, --slot=SLOT name of the logical replication slot\n"));
printf(_("\nAction to be performed:\n"));
- printf(_(" --create create a new replication slot (for the slotname see --slot)\n"));
- printf(_(" --start start streaming in a replication slot (for the slotname see --slot)\n"));
- printf(_(" --drop drop the replication slot (for the slotname see --slot)\n"));
+ printf(_(" --create create a new replication slot (for the slot's name see --slot)\n"));
+ printf(_(" --start start streaming in a replication slot (for the slot's name see --slot)\n"));
+ printf(_(" --drop drop the replication slot (for the slot's name see --slot)\n"));
printf(_("\nReport bugs to
.\n"));
}
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 201406041
+#define CATALOG_VERSION_NO 201406051
#endif
DESCR("SP-GiST support for quad tree over range");
/* replication slots */
-DATA(insert OID = 3779 ( pg_create_physical_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f f f v 1 0 2249 "19" "{19,19,3220}" "{i,o,o}" "{slotname,slotname,xlog_position}" _null_ pg_create_physical_replication_slot _null_ _null_ _null_ ));
+DATA(insert OID = 3779 ( pg_create_physical_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f f f v 1 0 2249 "19" "{19,19,3220}" "{i,o,o}" "{slot_name,slot_name,xlog_position}" _null_ pg_create_physical_replication_slot _null_ _null_ _null_ ));
DESCR("create a physical replication slot");
DATA(insert OID = 3780 ( pg_drop_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f f f v 1 0 2278 "19" _null_ _null_ _null_ _null_ pg_drop_replication_slot _null_ _null_ _null_ ));
DESCR("drop a replication slot");
DATA(insert OID = 3781 ( pg_get_replication_slots PGNSP PGUID 12 1 10 0 0 f f f f f t s 0 0 2249 "" "{19,19,25,26,16,28,28,3220}" "{o,o,o,o,o,o,o,o}" "{slot_name,plugin,slot_type,datoid,active,xmin,catalog_xmin,restart_lsn}" _null_ pg_get_replication_slots _null_ _null_ _null_ ));
DESCR("information about replication slots currently in use");
-DATA(insert OID = 3786 ( pg_create_logical_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f f f v 2 0 2249 "19 19" "{19,19,25,3220}" "{i,i,o,o}" "{slotname,plugin,slotname,xlog_position}" _null_ pg_create_logical_replication_slot _null_ _null_ _null_ ));
+DATA(insert OID = 3786 ( pg_create_logical_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f f f v 2 0 2249 "19 19" "{19,19,25,3220}" "{i,i,o,o}" "{slot_name,plugin,slot_name,xlog_position}" _null_ pg_create_logical_replication_slot _null_ _null_ _null_ ));
DESCR("set up a logical replication slot");
-DATA(insert OID = 3782 ( pg_logical_slot_get_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,25}" "{i,i,i,v,o,o,o}" "{slotname,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ pg_logical_slot_get_changes _null_ _null_ _null_ ));
+DATA(insert OID = 3782 ( pg_logical_slot_get_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,25}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ pg_logical_slot_get_changes _null_ _null_ _null_ ));
DESCR("get changes from replication slot");
-DATA(insert OID = 3783 ( pg_logical_slot_get_binary_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,17}" "{i,i,i,v,o,o,o}" "{slotname,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ pg_logical_slot_get_binary_changes _null_ _null_ _null_ ));
+DATA(insert OID = 3783 ( pg_logical_slot_get_binary_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,17}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ pg_logical_slot_get_binary_changes _null_ _null_ _null_ ));
DESCR("get binary changes from replication slot");
-DATA(insert OID = 3784 ( pg_logical_slot_peek_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,25}" "{i,i,i,v,o,o,o}" "{slotname,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ pg_logical_slot_peek_changes _null_ _null_ _null_ ));
+DATA(insert OID = 3784 ( pg_logical_slot_peek_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,25}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ pg_logical_slot_peek_changes _null_ _null_ _null_ ));
DESCR("peek at changes from replication slot");
-DATA(insert OID = 3785 ( pg_logical_slot_peek_binary_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,17}" "{i,i,i,v,o,o,o}" "{slotname,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ pg_logical_slot_peek_binary_changes _null_ _null_ _null_ ));
+DATA(insert OID = 3785 ( pg_logical_slot_peek_binary_changes PGNSP PGUID 12 1000 1000 25 0 f f f f f t v 4 0 2249 "19 3220 23 1009" "{19,3220,23,1009,3220,28,17}" "{i,i,i,v,o,o,o}" "{slot_name,upto_lsn,upto_nchanges,options,location,xid,data}" _null_ pg_logical_slot_peek_binary_changes _null_ _null_ _null_ ));
DESCR("peek at binary changes from replication slot");
/* event triggers */