Skip to content

Commit edcb712

Browse files
author
Amit Kapila
committed
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
1 parent d55322b commit edcb712

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

doc/src/sgml/logical-replication.sgml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,111 @@ test_sub=# SELECT * FROM t1 ORDER BY id;
16661666
log.
16671667
</para>
16681668

1669+
<para>
1670+
The log format for logical replication conflicts is as follows:
1671+
<synopsis>
1672+
LOG: conflict detected on relation "<replaceable>schemaname</replaceable>.<replaceable>tablename</replaceable>": conflict=<replaceable>conflict_type</replaceable>
1673+
DETAIL: <replaceable class="parameter">detailed_explanation</replaceable>.
1674+
{<replaceable class="parameter">detail_values</replaceable> [; ... ]}.
1675+
1676+
<phrase>where <replaceable class="parameter">detail_values</replaceable> is one of:</phrase>
1677+
1678+
<literal>Key</literal> (<replaceable>column_name</replaceable> <optional>, ...</optional>)=(<replaceable>column_value</replaceable> <optional>, ...</optional>)
1679+
<literal>existing local tuple</literal> <optional>(<replaceable>column_name</replaceable> <optional>, ...</optional>)=</optional>(<replaceable>column_value</replaceable> <optional>, ...</optional>)
1680+
<literal>remote tuple</literal> <optional>(<replaceable>column_name</replaceable> <optional>, ...</optional>)=</optional>(<replaceable>column_value</replaceable> <optional>, ...</optional>)
1681+
<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>)}
1682+
</synopsis>
1683+
1684+
The log provides the following information:
1685+
<variablelist>
1686+
<varlistentry>
1687+
<term><literal>LOG</literal></term>
1688+
<listitem>
1689+
<itemizedlist>
1690+
<listitem>
1691+
<para>
1692+
<replaceable>schemaname</replaceable>.<replaceable>tablename</replaceable>
1693+
identifies the local relation involved in the conflict.
1694+
</para>
1695+
</listitem>
1696+
<listitem>
1697+
<para>
1698+
<replaceable>conflict_type</replaceable> is the type of conflict that occurred
1699+
(e.g., <literal>insert_exists</literal>, <literal>update_exists</literal>).
1700+
</para>
1701+
</listitem>
1702+
</itemizedlist>
1703+
</listitem>
1704+
</varlistentry>
1705+
1706+
<varlistentry>
1707+
<term><literal>DETAIL</literal></term>
1708+
<listitem>
1709+
<itemizedlist>
1710+
<listitem>
1711+
<para>
1712+
<replaceable class="parameter">detailed_explanation</replaceable> includes
1713+
the origin, transaction ID, and commit timestamp of the transaction that
1714+
modified the existing local tuple, if available.
1715+
</para>
1716+
</listitem>
1717+
<listitem>
1718+
<para>
1719+
The <literal>Key</literal> section includes the key values of the local
1720+
tuple that violated a unique constraint for
1721+
<literal>insert_exists</literal> or <literal>update_exists</literal>
1722+
conflicts.
1723+
</para>
1724+
</listitem>
1725+
<listitem>
1726+
<para>
1727+
The <literal>existing local tuple</literal> section includes the local
1728+
tuple if its origin differs from the remote tuple for
1729+
<literal>update_differ</literal> or <literal>delete_differ</literal>
1730+
conflicts, or if the key value conflicts with the remote tuple for
1731+
<literal>insert_exists</literal> or <literal>update_exists</literal>
1732+
conflicts.
1733+
</para>
1734+
</listitem>
1735+
<listitem>
1736+
<para>
1737+
The <literal>remote tuple</literal> section includes the new tuple from
1738+
the remote insert or update operation that caused the conflict. Note that
1739+
for an update operation, the column value of the new tuple will be null
1740+
if the value is unchanged and toasted.
1741+
</para>
1742+
</listitem>
1743+
<listitem>
1744+
<para>
1745+
The <literal>replica identity</literal> section includes the replica
1746+
identity key values that were used to search for the existing local
1747+
tuple to be updated or deleted. This may include the full tuple value
1748+
if the local relation is marked with
1749+
<link linkend="sql-altertable-replica-identity-full"><literal>REPLICA IDENTITY FULL</literal></link>.
1750+
</para>
1751+
</listitem>
1752+
<listitem>
1753+
<para>
1754+
<replaceable class="parameter">column_name</replaceable> is the column name.
1755+
For <literal>existing local tuple</literal>, <literal>remote tuple</literal>,
1756+
and <literal>replica identity full</literal> cases, column names are
1757+
logged only if the user lacks the privilege to access all columns of
1758+
the table. If column names are present, they appear in the same order
1759+
as the corresponding column values.
1760+
</para>
1761+
</listitem>
1762+
<listitem>
1763+
<para>
1764+
<replaceable class="parameter">column_value</replaceable> is the column value.
1765+
The large column values are truncated to 64 bytes.
1766+
</para>
1767+
</listitem>
1768+
</itemizedlist>
1769+
</listitem>
1770+
</varlistentry>
1771+
</variablelist>
1772+
</para>
1773+
16691774
<para>
16701775
Logical replication operations are performed with the privileges of the role
16711776
which owns the subscription. Permissions failures on target tables will

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