Skip to content

Commit 38c5fbd

Browse files
committed
doc: Improve pgoutput documentation.
This commit updates the pgoutput documentation with the following changes: - Specify the data type for each pgoutput option. - Clarify the relationship between proto_version and options such as streaming and two_phase. - Add a note on the use of pg_logical_slot_peek_changes and pg_logical_slot_get_changes with pgoutput. Author: Fujii Masao <[email protected]> Reviewed-by: Chao Li <[email protected]> Reviewed-by: Hayato Kuroda <[email protected]> Discussion: https://postgr.es/m/CAHGQGwFJTbygdhhjR_iP4Oem=Lo1xsptWWOq825uoW+hG_Lfnw@mail.gmail.com
1 parent 34a62c2 commit 38c5fbd

File tree

2 files changed

+69
-51
lines changed

2 files changed

+69
-51
lines changed

doc/src/sgml/func/func-admin.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ postgres=# SELECT '0/0'::pg_lsn + pd.segment_number * ps.setting::int + :offset
12241224
</row>
12251225

12261226
<row>
1227-
<entry role="func_table_entry"><para role="func_signature">
1227+
<entry id="pg-logical-slot-peek-binary-changes" role="func_table_entry"><para role="func_signature">
12281228
<indexterm>
12291229
<primary>pg_logical_slot_peek_binary_changes</primary>
12301230
</indexterm>

doc/src/sgml/logicaldecoding.sgml

Lines changed: 68 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -600,109 +600,112 @@ DETAIL: Synchronization could lead to data loss, because the remote slot needs
600600
<title>Options</title>
601601

602602
<variablelist>
603-
<varlistentry>
604-
<term>
605-
proto_version
606-
</term>
603+
<varlistentry id="pgoutput-options-proto-version">
604+
<term><varname>proto_version</varname> (<type>integer</type>)</term>
607605
<listitem>
608606
<para>
609-
Protocol version. Currently versions <literal>1</literal>, <literal>2</literal>,
607+
Specifies the protocol version.
608+
Currently versions <literal>1</literal>, <literal>2</literal>,
610609
<literal>3</literal>, and <literal>4</literal> are supported. A valid
611610
version is required.
612611
</para>
613612
<para>
614-
Version <literal>2</literal> is supported only for server version 14
615-
and above, and it allows streaming of large in-progress transactions.
613+
Version <literal>2</literal> is supported on server version 14
614+
and above, and is required when <varname>streaming</varname>
615+
is set to <literal>on</literal> to stream large in-progress
616+
transactions.
616617
</para>
617618
<para>
618-
Version <literal>3</literal> is supported only for server version 15
619-
and above, and it allows streaming of two-phase commits.
619+
Version <literal>3</literal> is supported on server version 15
620+
and above, and is required when <varname>two_phase</varname>
621+
is enabled to stream two-phase commits.
620622
</para>
621623
<para>
622-
Version <literal>4</literal> is supported only for server version 16
623-
and above, and it allows streams of large in-progress transactions to
624-
be applied in parallel.
624+
Version <literal>4</literal> is supported on server version 16
625+
and above, and is required when <varname>streaming</varname>
626+
is set to <literal>parallel</literal> to stream large in-progress
627+
transactions to be applied in parallel.
625628
</para>
626629
</listitem>
627630
</varlistentry>
628631

629-
<varlistentry>
630-
<term>
631-
publication_names
632-
</term>
632+
<varlistentry id="pgoutput-options-publication-names">
633+
<term><varname>publication_names</varname> (<type>string</type>)</term>
633634
<listitem>
634635
<para>
635-
Comma-separated list of publication names for which to subscribe
636-
(receive changes). The individual publication names are treated
636+
A comma-separated list of publication names to subscribe to.
637+
The individual publication names are treated
637638
as standard objects names and can be quoted the same as needed.
638639
At least one publication name is required.
639640
</para>
640641
</listitem>
641642
</varlistentry>
642643

643-
<varlistentry>
644-
<term>
645-
binary
646-
</term>
644+
<varlistentry id="pgoutput-options-binary">
645+
<term><varname>binary</varname> (<type>boolean</type>)</term>
647646
<listitem>
648647
<para>
649-
Boolean option to use binary transfer mode. Binary mode is faster
648+
Enables binary transfer mode. Binary mode is faster
650649
than the text mode but slightly less robust.
651650
The default is <literal>off</literal>.
652651
</para>
653652
</listitem>
654653
</varlistentry>
655654

656-
<varlistentry>
657-
<term>
658-
messages
659-
</term>
655+
<varlistentry id="pgoutput-options-messages">
656+
<term><varname>messages</varname> (<type>boolean</type>)</term>
660657
<listitem>
661658
<para>
662-
Boolean option to enable sending the messages that are written
663-
by <function>pg_logical_emit_message</function>.
659+
Enables sending the messages that are written by
660+
<function><link linkend="pg-logical-emit-message">pg_logical_emit_message</link></function>.
664661
The default is <literal>off</literal>.
665662
</para>
666663
</listitem>
667664
</varlistentry>
668665

669-
<varlistentry>
670-
<term>
671-
streaming
672-
</term>
666+
<varlistentry id="pgoutput-options-streaming">
667+
<term><varname>streaming</varname> (<type>enum</type>)</term>
673668
<listitem>
674669
<para>
675-
Option to enable streaming of in-progress transactions. Valid values are
670+
Enables streaming of in-progress transactions. Valid values are
676671
<literal>off</literal> (the default), <literal>on</literal> and
677-
<literal>parallel</literal>. The setting <literal>parallel</literal>
678-
enables sending extra information with some messages to be used for
679-
parallelization. Minimum protocol version 2 is required to turn it
680-
<literal>on</literal>. Minimum protocol version 4 is required for the
681-
<literal>parallel</literal> value.
672+
<literal>parallel</literal>.
673+
</para>
674+
<para>
675+
When set to <literal>off</literal>, <filename>pgoutput</filename>
676+
fully decodes a transaction before sending it as a whole.
677+
This mode works with any protocol version.
678+
</para>
679+
<para>
680+
When set to <literal>on</literal>, <filename>pgoutput</filename>
681+
streams large in-progress transactions.
682+
This requires protocol version 2 or higher.
683+
</para>
684+
<para>
685+
When set to <literal>parallel</literal>, <filename>pgoutput</filename>
686+
streams large in-progress transactions and also sends
687+
extra information in some messages to support parallel processing.
688+
This requires protocol version 4 or higher.
682689
</para>
683690
</listitem>
684691
</varlistentry>
685692

686-
<varlistentry>
687-
<term>
688-
two_phase
689-
</term>
693+
<varlistentry id="pgoutput-options-two-phase">
694+
<term><varname>two_phase</varname> (<type>boolean</type>)</term>
690695
<listitem>
691696
<para>
692-
Boolean option to enable two-phase transactions. Minimum protocol
693-
version 3 is required to turn it on.
697+
Enables sending two-phase transactions.
698+
Minimum protocol version 3 is required to turn it on.
694699
The default is <literal>off</literal>.
695700
</para>
696701
</listitem>
697702
</varlistentry>
698703

699-
<varlistentry>
700-
<term>
701-
origin
702-
</term>
704+
<varlistentry id="pgoutput-options-origin">
705+
<term><varname>origin</varname> (<type>enum</type>)</term>
703706
<listitem>
704707
<para>
705-
Option to send changes by their origin. Possible values are
708+
Specifies whether to send changes by their origin. Possible values are
706709
<literal>none</literal> to only send the changes that have no origin
707710
associated, or <literal>any</literal>
708711
to send the changes regardless of their origin. This can be used
@@ -715,6 +718,21 @@ DETAIL: Synchronization could lead to data loss, because the remote slot needs
715718
</variablelist>
716719

717720
</sect3>
721+
722+
<sect3 id="logicaldecoding-pgoutput-notes">
723+
<title>Notes</title>
724+
725+
<para>
726+
<filename>pgoutput</filename> produces binary output,
727+
so functions expecting textual data (
728+
<function><link linkend="pg-logical-slot-peek-changes">pg_logical_slot_peek_changes</link></function> and
729+
<function><link linkend="pg-logical-slot-get-changes">pg_logical_slot_get_changes</link></function>)
730+
cannot be used with it. Use
731+
<function><link linkend="pg-logical-slot-peek-binary-changes">pg_logical_slot_peek_binary_changes</link></function> or
732+
<function><link linkend="pg-logical-slot-get-binary-changes">pg_logical_slot_get_binary_changes</link></function>
733+
instead.
734+
</para>
735+
</sect3>
718736
</sect2>
719737
</sect1>
720738

0 commit comments

Comments
 (0)