aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2024-08-22 14:11:50 +0530
committerAmit Kapila <akapila@postgresql.org>2024-08-22 14:11:50 +0530
commitedcb71258504ed22abba8cc7181d2bab3762e757 (patch)
treec7b535dbee9fd8703a92cbdba97dcbf30421b289 /doc/src
parentd55322b0da60a8798ffdb8b78ef90db0fb5be18e (diff)
downloadpostgresql-edcb71258504ed22abba8cc7181d2bab3762e757.tar.gz
postgresql-edcb71258504ed22abba8cc7181d2bab3762e757.zip
Doc: explain the log format of logical replication conflicts.
This commit adds a detailed explanation of the log format for logical replication conflicts. Author: Hou Zhijie Reviewed-by: Shveta Malik, Peter Smith, Hayato Kuroda Discussion: https://postgr.es/m/OS0PR01MB5716352552DFADB8E9AD1D8994C92@OS0PR01MB5716.jpnprd01.prod.outlook.com Discussion: https://postgr.es/m/OS0PR01MB57162EDE8BA17F3EE08A24CA948D2@OS0PR01MB5716.jpnprd01.prod.outlook.com
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/logical-replication.sgml105
1 files changed, 105 insertions, 0 deletions
diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index 08f89e01ada..bee7e02983b 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -1667,6 +1667,111 @@ test_sub=# SELECT * FROM t1 ORDER BY id;
</para>
<para>
+ The log format for logical replication conflicts is as follows:
+<synopsis>
+LOG: conflict detected on relation "<replaceable>schemaname</replaceable>.<replaceable>tablename</replaceable>": conflict=<replaceable>conflict_type</replaceable>
+DETAIL: <replaceable class="parameter">detailed_explanation</replaceable>.
+{<replaceable class="parameter">detail_values</replaceable> [; ... ]}.
+
+<phrase>where <replaceable class="parameter">detail_values</replaceable> is one of:</phrase>
+
+ <literal>Key</literal> (<replaceable>column_name</replaceable> <optional>, ...</optional>)=(<replaceable>column_value</replaceable> <optional>, ...</optional>)
+ <literal>existing local tuple</literal> <optional>(<replaceable>column_name</replaceable> <optional>, ...</optional>)=</optional>(<replaceable>column_value</replaceable> <optional>, ...</optional>)
+ <literal>remote tuple</literal> <optional>(<replaceable>column_name</replaceable> <optional>, ...</optional>)=</optional>(<replaceable>column_value</replaceable> <optional>, ...</optional>)
+ <literal>replica identity</literal> {(<replaceable>column_name</replaceable> <optional>, ...</optional>)=(<replaceable>column_value</replaceable> <optional>, ...</optional>) | full <optional>(<replaceable>column_name</replaceable> <optional>, ...</optional>)=</optional>(<replaceable>column_value</replaceable> <optional>, ...</optional>)}
+</synopsis>
+
+ The log provides the following information:
+ <variablelist>
+ <varlistentry>
+ <term><literal>LOG</literal></term>
+ <listitem>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <replaceable>schemaname</replaceable>.<replaceable>tablename</replaceable>
+ identifies the local relation involved in the conflict.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <replaceable>conflict_type</replaceable> is the type of conflict that occurred
+ (e.g., <literal>insert_exists</literal>, <literal>update_exists</literal>).
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>DETAIL</literal></term>
+ <listitem>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <replaceable class="parameter">detailed_explanation</replaceable> includes
+ the origin, transaction ID, and commit timestamp of the transaction that
+ modified the existing local tuple, if available.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The <literal>Key</literal> section includes the key values of the local
+ tuple that violated a unique constraint for
+ <literal>insert_exists</literal> or <literal>update_exists</literal>
+ conflicts.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The <literal>existing local tuple</literal> section includes the local
+ tuple if its origin differs from the remote tuple for
+ <literal>update_differ</literal> or <literal>delete_differ</literal>
+ conflicts, or if the key value conflicts with the remote tuple for
+ <literal>insert_exists</literal> or <literal>update_exists</literal>
+ conflicts.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The <literal>remote tuple</literal> section includes the new tuple from
+ the remote insert or update operation that caused the conflict. Note that
+ for an update operation, the column value of the new tuple will be null
+ if the value is unchanged and toasted.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The <literal>replica identity</literal> section includes the replica
+ identity key values that were used to search for the existing local
+ tuple to be updated or deleted. This may include the full tuple value
+ if the local relation is marked with
+ <link linkend="sql-altertable-replica-identity-full"><literal>REPLICA IDENTITY FULL</literal></link>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <replaceable class="parameter">column_name</replaceable> is the column name.
+ For <literal>existing local tuple</literal>, <literal>remote tuple</literal>,
+ and <literal>replica identity full</literal> cases, column names are
+ logged only if the user lacks the privilege to access all columns of
+ the table. If column names are present, they appear in the same order
+ as the corresponding column values.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <replaceable class="parameter">column_value</replaceable> is the column value.
+ The large column values are truncated to 64 bytes.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+
+ <para>
Logical replication operations are performed with the privileges of the role
which owns the subscription. Permissions failures on target tables will
cause replication conflicts, as will enabled