Skip to content

Commit fee1040

Browse files
author
Amit Kapila
committed
Doc: Change optional parameters grouping in Create Subscription.
The subscription parameters are rearranged into two groups: a) those that control what happens during Create Subscription b) those that control the replication behavior This makes the documentation of Create Subscription easier to follow. Author: Peter Smith Reviewed-by: Amit Kapila Discussion: https://postgr.es/m/CAHut+PtPJDSOxtuMGpO2yDrRPKxcYGL4n7HqJP9HernZE=Cj+g@mail.gmail.com
1 parent 72b76f7 commit fee1040

File tree

1 file changed

+73
-59
lines changed

1 file changed

+73
-59
lines changed

doc/src/sgml/ref/create_subscription.sgml

Lines changed: 73 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,39 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
9292
<term><literal>WITH ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
9393
<listitem>
9494
<para>
95-
This clause specifies optional parameters for a subscription. The
96-
following parameters are supported:
95+
This clause specifies optional parameters for a subscription.
96+
</para>
97+
98+
<para>
99+
The following parameters control what happens during subscription creation:
97100

98101
<variablelist>
102+
99103
<varlistentry>
100-
<term><literal>copy_data</literal> (<type>boolean</type>)</term>
104+
<term><literal>connect</literal> (<type>boolean</type>)</term>
101105
<listitem>
102106
<para>
103-
Specifies whether the existing data in the publications that are
104-
being subscribed to should be copied once the replication starts.
105-
The default is <literal>true</literal>.
107+
Specifies whether the <command>CREATE SUBSCRIPTION</command>
108+
should connect to the publisher at all. Setting this to
109+
<literal>false</literal> will change default values of
110+
<literal>enabled</literal>, <literal>create_slot</literal> and
111+
<literal>copy_data</literal> to <literal>false</literal>.
112+
</para>
113+
114+
<para>
115+
It is not allowed to combine <literal>connect</literal> set to
116+
<literal>false</literal> and <literal>enabled</literal>,
117+
<literal>create_slot</literal>, or <literal>copy_data</literal>
118+
set to <literal>true</literal>.
119+
</para>
120+
121+
<para>
122+
Since no connection is made when this option is set
123+
to <literal>false</literal>, the tables are not subscribed, and so
124+
after you enable the subscription nothing will be replicated.
125+
It is required to run
126+
<literal>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</literal> in order
127+
for tables to be subscribed.
106128
</para>
107129
</listitem>
108130
</varlistentry>
@@ -146,38 +168,13 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
146168
</para>
147169
</listitem>
148170
</varlistentry>
171+
</variablelist>
172+
</para>
149173

150-
<varlistentry>
151-
<term><literal>synchronous_commit</literal> (<type>enum</type>)</term>
152-
<listitem>
153-
<para>
154-
The value of this parameter overrides the
155-
<xref linkend="guc-synchronous-commit"/> setting within this
156-
subscription's apply worker processes. The default value
157-
is <literal>off</literal>.
158-
</para>
159-
160-
<para>
161-
It is safe to use <literal>off</literal> for logical replication:
162-
If the subscriber loses transactions because of missing
163-
synchronization, the data will be sent again from the publisher.
164-
</para>
174+
<para>
175+
The following parameters control the replication behavior:
165176

166-
<para>
167-
A different setting might be appropriate when doing synchronous
168-
logical replication. The logical replication workers report the
169-
positions of writes and flushes to the publisher, and when using
170-
synchronous replication, the publisher will wait for the actual
171-
flush. This means that setting
172-
<literal>synchronous_commit</literal> for the subscriber to
173-
<literal>off</literal> when the subscription is used for
174-
synchronous replication might increase the latency for
175-
<command>COMMIT</command> on the publisher. In this scenario, it
176-
can be advantageous to set <literal>synchronous_commit</literal>
177-
to <literal>local</literal> or higher.
178-
</para>
179-
</listitem>
180-
</varlistentry>
177+
<variablelist>
181178

182179
<varlistentry>
183180
<term><literal>binary</literal> (<type>boolean</type>)</term>
@@ -201,33 +198,16 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
201198
</varlistentry>
202199

203200
<varlistentry>
204-
<term><literal>connect</literal> (<type>boolean</type>)</term>
201+
<term><literal>copy_data</literal> (<type>boolean</type>)</term>
205202
<listitem>
206203
<para>
207-
Specifies whether the <command>CREATE SUBSCRIPTION</command>
208-
should connect to the publisher at all. Setting this to
209-
<literal>false</literal> will change default values of
210-
<literal>enabled</literal>, <literal>create_slot</literal> and
211-
<literal>copy_data</literal> to <literal>false</literal>.
212-
</para>
213-
214-
<para>
215-
It is not allowed to combine <literal>connect</literal> set to
216-
<literal>false</literal> and <literal>enabled</literal>,
217-
<literal>create_slot</literal>, or <literal>copy_data</literal>
218-
set to <literal>true</literal>.
219-
</para>
220-
221-
<para>
222-
Since no connection is made when this option is set
223-
to <literal>false</literal>, the tables are not subscribed, and so
224-
after you enable the subscription nothing will be replicated.
225-
It is required to run
226-
<literal>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</literal> in order
227-
for tables to be subscribed.
204+
Specifies whether the existing data in the publications that are
205+
being subscribed to should be copied once the replication starts.
206+
The default is <literal>true</literal>.
228207
</para>
229208
</listitem>
230209
</varlistentry>
210+
231211
<varlistentry>
232212
<term><literal>streaming</literal> (<type>boolean</type>)</term>
233213
<listitem>
@@ -237,9 +217,41 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
237217
are fully decoded on the publisher, and only then sent to the
238218
subscriber as a whole.
239219
</para>
220+
</listitem>
221+
</varlistentry>
222+
223+
<varlistentry>
224+
<term><literal>synchronous_commit</literal> (<type>enum</type>)</term>
225+
<listitem>
226+
<para>
227+
The value of this parameter overrides the
228+
<xref linkend="guc-synchronous-commit"/> setting within this
229+
subscription's apply worker processes. The default value
230+
is <literal>off</literal>.
231+
</para>
232+
233+
<para>
234+
It is safe to use <literal>off</literal> for logical replication:
235+
If the subscriber loses transactions because of missing
236+
synchronization, the data will be sent again from the publisher.
237+
</para>
240238

239+
<para>
240+
A different setting might be appropriate when doing synchronous
241+
logical replication. The logical replication workers report the
242+
positions of writes and flushes to the publisher, and when using
243+
synchronous replication, the publisher will wait for the actual
244+
flush. This means that setting
245+
<literal>synchronous_commit</literal> for the subscriber to
246+
<literal>off</literal> when the subscription is used for
247+
synchronous replication might increase the latency for
248+
<command>COMMIT</command> on the publisher. In this scenario, it
249+
can be advantageous to set <literal>synchronous_commit</literal>
250+
to <literal>local</literal> or higher.
251+
</para>
241252
</listitem>
242253
</varlistentry>
254+
243255
<varlistentry>
244256
<term><literal>two_phase</literal> (<type>boolean</type>)</term>
245257
<listitem>
@@ -266,7 +278,9 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
266278

267279
</listitem>
268280
</varlistentry>
269-
</variablelist></para>
281+
</variablelist>
282+
</para>
283+
270284
</listitem>
271285
</varlistentry>
272286
</variablelist>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy