mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Allow logical replication to transfer data in binary format.
This patch adds a "binary" option to CREATE/ALTER SUBSCRIPTION. When that's set, the publisher will send data using the data type's typsend function if any, rather than typoutput. This is generally faster, if slightly less robust. As committed, we won't try to transfer user-defined array or composite types in binary, for fear that type OIDs won't match at the subscriber. This might be changed later, but it seems like fit material for a follow-on patch. Dave Cramer, reviewed by Daniel Gustafsson, Petr Jelinek, and others; adjusted some by me Discussion: https://postgr.es/m/CADK3HH+R3xMn=8t3Ct+uD+qJ1KD=Hbif5NFMJ+d5DkoCzp6Vgw@mail.gmail.com
This commit is contained in:
@@ -7472,7 +7472,7 @@ SCRAM-SHA-256$<replaceable><iteration count></replaceable>:<replaceable>&l
|
||||
(references <link linkend="catalog-pg-database"><structname>pg_database</structname></link>.<structfield>oid</structfield>)
|
||||
</para>
|
||||
<para>
|
||||
OID of the database which the subscription resides in
|
||||
OID of the database that the subscription resides in
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
@@ -7500,7 +7500,17 @@ SCRAM-SHA-256$<replaceable><iteration count></replaceable>:<replaceable>&l
|
||||
<structfield>subenabled</structfield> <type>bool</type>
|
||||
</para>
|
||||
<para>
|
||||
If true, the subscription is enabled and should be replicating.
|
||||
If true, the subscription is enabled and should be replicating
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="catalog_table_entry"><para role="column_definition">
|
||||
<structfield>subbinary</structfield> <type>bool</type>
|
||||
</para>
|
||||
<para>
|
||||
If true, the subscription will request that the publisher send data
|
||||
in binary format
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
@@ -7518,8 +7528,8 @@ SCRAM-SHA-256$<replaceable><iteration count></replaceable>:<replaceable>&l
|
||||
<structfield>subslotname</structfield> <type>name</type>
|
||||
</para>
|
||||
<para>
|
||||
Name of the replication slot in the upstream database. Also used
|
||||
for local replication origin name.
|
||||
Name of the replication slot in the upstream database (also used
|
||||
for the local replication origin name)
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
@@ -7528,8 +7538,8 @@ SCRAM-SHA-256$<replaceable><iteration count></replaceable>:<replaceable>&l
|
||||
<structfield>subsynccommit</structfield> <type>text</type>
|
||||
</para>
|
||||
<para>
|
||||
Contains the value of the <varname>synchronous_commit</varname>
|
||||
setting for the subscription workers.
|
||||
The <varname>synchronous_commit</varname>
|
||||
setting for the subscription's workers to use
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
@@ -7538,8 +7548,8 @@ SCRAM-SHA-256$<replaceable><iteration count></replaceable>:<replaceable>&l
|
||||
<structfield>subpublications</structfield> <type>text[]</type>
|
||||
</para>
|
||||
<para>
|
||||
Array of subscribed publication names. These reference the
|
||||
publications on the publisher server. For more on publications
|
||||
Array of subscribed publication names. These reference
|
||||
publications defined in the upstream database. For more on publications
|
||||
see <xref linkend="logical-replication-publication"/>.
|
||||
</para></entry>
|
||||
</row>
|
||||
|
@@ -163,8 +163,10 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
|
||||
<para>
|
||||
This clause alters parameters originally set by
|
||||
<xref linkend="sql-createsubscription"/>. See there for more
|
||||
information. The allowed options are <literal>slot_name</literal> and
|
||||
<literal>synchronous_commit</literal>
|
||||
information. The parameters that can be altered
|
||||
are <literal>slot_name</literal>,
|
||||
<literal>synchronous_commit</literal>, and
|
||||
<literal>binary</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@@ -152,8 +152,9 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
|
||||
<listitem>
|
||||
<para>
|
||||
The value of this parameter overrides the
|
||||
<xref linkend="guc-synchronous-commit"/> setting. The default
|
||||
value is <literal>off</literal>.
|
||||
<xref linkend="guc-synchronous-commit"/> setting within this
|
||||
subscription's apply worker processes. The default value
|
||||
is <literal>off</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -178,6 +179,27 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>binary</literal> (<type>boolean</type>)</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies whether the subscription will request the publisher to
|
||||
send the data in binary format (as opposed to text).
|
||||
The default is <literal>false</literal>.
|
||||
Even when this option is enabled, only data types that have
|
||||
binary send and receive functions will be transferred in binary.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When doing cross-version replication, it could happen that the
|
||||
publisher has a binary send function for some data type, but the
|
||||
subscriber lacks a binary receive function for the type. In
|
||||
such a case, data transfer will fail, and
|
||||
the <literal>binary</literal> option cannot be used.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>connect</literal> (<type>boolean</type>)</term>
|
||||
<listitem>
|
||||
|
Reference in New Issue
Block a user