summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2017-03-14 17:13:56 -0400
committerPeter Eisentraut <peter_e@gmx.net>2017-03-14 17:34:22 -0400
commiteb4da3e3807d2054bb05c3eb201cb9a363682f09 (patch)
treec17c676ae946fa0df632217ec163987f155820ac /doc
parent71504026556fc1494c9a7045aad9645f7d9e4cdf (diff)
downloadpostgresql-eb4da3e3807d2054bb05c3eb201cb9a363682f09.tar.gz
Add option to control snapshot export to CREATE_REPLICATION_SLOT
We used to export snapshots unconditionally in CREATE_REPLICATION_SLOT in the replication protocol, but several upcoming patches want more control over what happens. Suppress snapshot export in pg_recvlogical, which neither needs nor can use the exported snapshot. Since snapshot exporting can fail this improves reliability. This also paves the way for allowing the creation of replication slots on standbys, which cannot export snapshots because they cannot allocate new XIDs. Author: Petr Jelinek <petr.jelinek@2ndquadrant.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/src/sgml/logicaldecoding.sgml11
-rw-r--r--doc/src/sgml/protocol.sgml19
2 files changed, 26 insertions, 4 deletions
diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml
index 03c2c691d1..bb22f9ae22 100644
--- a/doc/src/sgml/logicaldecoding.sgml
+++ b/doc/src/sgml/logicaldecoding.sgml
@@ -271,8 +271,9 @@ $ pg_recvlogical -d postgres --slot test --drop-slot
<sect2>
<title>Exported Snapshots</title>
<para>
- When a new replication slot is created using the streaming replication interface,
- a snapshot is exported
+ When a new replication slot is created using the streaming replication
+ interface (see <xref linkend="protocol-replication-create-slot">), a
+ snapshot is exported
(see <xref linkend="functions-snapshot-synchronization">), which will show
exactly the state of the database after which all changes will be
included in the change stream. This can be used to create a new replica by
@@ -282,6 +283,12 @@ $ pg_recvlogical -d postgres --slot test --drop-slot
database's state at that point in time, which afterwards can be updated
using the slot's contents without losing any changes.
</para>
+ <para>
+ Creation of a snapshot is not always possible. In particular, it will
+ fail when connected to a hot standby. Applications that do not require
+ snapshot export may suppress it with the <literal>NOEXPORT_SNAPSHOT</>
+ option.
+ </para>
</sect2>
</sect1>
diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 67f3f455db..7c82b48845 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -1486,8 +1486,8 @@ The commands accepted in walsender mode are:
</listitem>
</varlistentry>
- <varlistentry>
- <term><literal>CREATE_REPLICATION_SLOT</literal> <replaceable class="parameter">slot_name</> [ <literal>TEMPORARY</> ] { <literal>PHYSICAL</> [ <literal>RESERVE_WAL</> ] | <literal>LOGICAL</> <replaceable class="parameter">output_plugin</> }
+ <varlistentry id="protocol-replication-create-slot" xreflabel="CREATE_REPLICATION_SLOT">
+ <term><literal>CREATE_REPLICATION_SLOT</literal> <replaceable class="parameter">slot_name</> [ <literal>TEMPORARY</> ] { <literal>PHYSICAL</> [ <literal>RESERVE_WAL</> ] | <literal>LOGICAL</> <replaceable class="parameter">output_plugin</> [ <literal>EXPORT_SNAPSHOT</> | <literal>NOEXPORT_SNAPSHOT</> ] }
<indexterm><primary>CREATE_REPLICATION_SLOT</primary></indexterm>
</term>
<listitem>
@@ -1538,6 +1538,21 @@ The commands accepted in walsender mode are:
</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><literal>EXPORT_SNAPSHOT</></term>
+ <term><literal>NOEXPORT_SNAPSHOT</></term>
+ <listitem>
+ <para>
+ Decides what to do with the snapshot created during logical slot
+ initialization. <literal>EXPORT_SNAPSHOT</>, which is the default,
+ will export the snapshot for use in other sessions. This option can't
+ be used inside a transaction. <literal>NOEXPORT_SNAPSHOT</> will
+ just use the snapshot for logical decoding as normal but won't do
+ anything else with it.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
<para>