summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2022-03-08 08:08:32 +0530
committerAmit Kapila <akapila@postgresql.org>2022-03-08 08:08:32 +0530
commitd3e8368c4b6e5110d8b3d12859850aeaae08dffb (patch)
tree2c5ee9eb72722f2fe5950ec8a4b671dbc454add3 /doc/src
parent4228cabb72bb57e1df4c9d92613f1fcd4baadd5a (diff)
Add the additional information to the logical replication worker errcontext.
This commits adds both the finish LSN (commit_lsn in case transaction got committed, prepare_lsn in case of a prepared transaction, etc.) and replication origin name to the existing error context message. This will help users in specifying the origin name and transaction finish LSN to pg_replication_origin_advance() SQL function to skip a particular transaction. Author: Masahiko Sawada Reviewed-by: Takamichi Osumi, Euler Taveira, and Amit Kapila Discussion: https://postgr.es/m/CAD21AoBarBf2oTF71ig2g_o=3Z_Dt6_sOpMQma1kFgbnA5OZ_w@mail.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/logical-replication.sgml23
1 files changed, 19 insertions, 4 deletions
diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index fb4472356d5..82326c39019 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -352,11 +352,26 @@
<para>
The resolution can be done either by changing data or permissions on the subscriber so
that it does not conflict with the incoming change or by skipping the
- transaction that conflicts with the existing data. The transaction can be
- skipped by calling the <link linkend="pg-replication-origin-advance">
+ transaction that conflicts with the existing data. When a conflict produces
+ an error, the replication won't proceed, and the logical replication worker will
+ emit the following kind of message to the subscriber's server log:
+<screen>
+ERROR: duplicate key value violates unique constraint "test_pkey"
+DETAIL: Key (c)=(1) already exists.
+CONTEXT: processing remote data for replication origin "pg_16395" during "INSERT" for replication target relation "public.test" in transaction 725 finished at 0/14C0378
+</screen>
+ The LSN of the transaction that contains the change violating the constraint and
+ the replication origin name can be found from the server log (LSN 0/14C0378 and
+ replication origin <literal>pg_16395</literal> in the above case). To skip the
+ transaction, the subscription needs to be disabled temporarily by
+ <command>ALTER SUBSCRIPTION ... DISABLE</command> first. Then, the transaction
+ can be skipped by calling the
+ <link linkend="pg-replication-origin-advance">
<function>pg_replication_origin_advance()</function></link> function with
- a <parameter>node_name</parameter> corresponding to the subscription name,
- and a position. The current position of origins can be seen in the
+ the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>) and the
+ next LSN of the transaction's LSN (i.e., LSN 0/14C0379). After that the replication
+ can be resumed by <command>ALTER SUBSCRIPTION ... ENABLE</command>. The current
+ position of origins can be seen in the
<link linkend="view-pg-replication-origin-status">
<structname>pg_replication_origin_status</structname></link> system view.
</para>