mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Collect statistics about conflicts in logical replication.
This commit adds columns in view pg_stat_subscription_stats to show the number of times a particular conflict type has occurred during the application of logical replication changes. The following columns are added: confl_insert_exists: Number of times a row insertion violated a NOT DEFERRABLE unique constraint. confl_update_origin_differs: Number of times an update was performed on a row that was previously modified by another origin. confl_update_exists: Number of times that the updated value of a row violates a NOT DEFERRABLE unique constraint. confl_update_missing: Number of times that the tuple to be updated is missing. confl_delete_origin_differs: Number of times a delete was performed on a row that was previously modified by another origin. confl_delete_missing: Number of times that the tuple to be deleted is missing. The update_origin_differs and delete_origin_differs conflicts can be detected only when track_commit_timestamp is enabled. Author: Hou Zhijie Reviewed-by: Shveta Malik, Peter Smith, Anit Kapila Discussion: https://postgr.es/m/OS0PR01MB57160A07BD575773045FC214948F2@OS0PR01MB5716.jpnprd01.prod.outlook.com
This commit is contained in:
@ -1582,10 +1582,11 @@ test_sub=# SELECT * FROM t1 ORDER BY id;
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Additional logging is triggered in the following <firstterm>conflict</firstterm>
|
||||
cases:
|
||||
Additional logging is triggered, and the conflict statistics are collected (displayed in the
|
||||
<link linkend="monitoring-pg-stat-subscription-stats"><structname>pg_stat_subscription_stats</structname></link> view)
|
||||
in the following <firstterm>conflict</firstterm> cases:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<varlistentry id="conflict-insert-exists" xreflabel="insert_exists">
|
||||
<term><literal>insert_exists</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
@ -1598,7 +1599,7 @@ test_sub=# SELECT * FROM t1 ORDER BY id;
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<varlistentry id="conflict-update-origin-differs" xreflabel="update_origin_differs">
|
||||
<term><literal>update_origin_differs</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
@ -1610,7 +1611,7 @@ test_sub=# SELECT * FROM t1 ORDER BY id;
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<varlistentry id="conflict-update-exists" xreflabel="update_exists">
|
||||
<term><literal>update_exists</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
@ -1627,7 +1628,7 @@ test_sub=# SELECT * FROM t1 ORDER BY id;
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<varlistentry id="conflict-update-missing" xreflabel="update_missing">
|
||||
<term><literal>update_missing</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
@ -1636,7 +1637,7 @@ test_sub=# SELECT * FROM t1 ORDER BY id;
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<varlistentry id="conflict-delete-origin-differs" xreflabel="delete_origin_differs">
|
||||
<term><literal>delete_origin_differs</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
@ -1648,7 +1649,7 @@ test_sub=# SELECT * FROM t1 ORDER BY id;
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<varlistentry id="conflict-delete-missing" xreflabel="delete_missing">
|
||||
<term><literal>delete_missing</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
|
@ -507,7 +507,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
|
||||
|
||||
<row>
|
||||
<entry><structname>pg_stat_subscription_stats</structname><indexterm><primary>pg_stat_subscription_stats</primary></indexterm></entry>
|
||||
<entry>One row per subscription, showing statistics about errors.
|
||||
<entry>One row per subscription, showing statistics about errors and conflicts.
|
||||
See <link linkend="monitoring-pg-stat-subscription-stats">
|
||||
<structname>pg_stat_subscription_stats</structname></link> for details.
|
||||
</entry>
|
||||
@ -2157,7 +2157,10 @@ description | Waiting for a newly initialized WAL file to reach durable storage
|
||||
<structfield>apply_error_count</structfield> <type>bigint</type>
|
||||
</para>
|
||||
<para>
|
||||
Number of times an error occurred while applying changes
|
||||
Number of times an error occurred while applying changes. Note that any
|
||||
conflict resulting in an apply error will be counted in both
|
||||
<literal>apply_error_count</literal> and the corresponding conflict
|
||||
count (e.g., <literal>confl_*</literal>).
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
@ -2171,6 +2174,76 @@ description | Waiting for a newly initialized WAL file to reach durable storage
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="catalog_table_entry"><para role="column_definition">
|
||||
<structfield>confl_insert_exists</structfield> <type>bigint</type>
|
||||
</para>
|
||||
<para>
|
||||
Number of times a row insertion violated a
|
||||
<literal>NOT DEFERRABLE</literal> unique constraint during the
|
||||
application of changes. See <xref linkend="conflict-insert-exists"/>
|
||||
for details about this conflict.
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="catalog_table_entry"><para role="column_definition">
|
||||
<structfield>confl_update_origin_differs</structfield> <type>bigint</type>
|
||||
</para>
|
||||
<para>
|
||||
Number of times an update was applied to a row that had been previously
|
||||
modified by another source during the application of changes. See
|
||||
<xref linkend="conflict-update-origin-differs"/> for details about this
|
||||
conflict.
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="catalog_table_entry"><para role="column_definition">
|
||||
<structfield>confl_update_exists</structfield> <type>bigint</type>
|
||||
</para>
|
||||
<para>
|
||||
Number of times that an updated row value violated a
|
||||
<literal>NOT DEFERRABLE</literal> unique constraint during the
|
||||
application of changes. See <xref linkend="conflict-update-exists"/>
|
||||
for details about this conflict.
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="catalog_table_entry"><para role="column_definition">
|
||||
<structfield>confl_update_missing</structfield> <type>bigint</type>
|
||||
</para>
|
||||
<para>
|
||||
Number of times the tuple to be updated was not found during the
|
||||
application of changes. See <xref linkend="conflict-update-missing"/>
|
||||
for details about this conflict.
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="catalog_table_entry"><para role="column_definition">
|
||||
<structfield>confl_delete_origin_differs</structfield> <type>bigint</type>
|
||||
</para>
|
||||
<para>
|
||||
Number of times a delete operation was applied to row that had been
|
||||
previously modified by another source during the application of changes.
|
||||
See <xref linkend="conflict-delete-origin-differs"/> for details about
|
||||
this conflict.
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="catalog_table_entry"><para role="column_definition">
|
||||
<structfield>confl_delete_missing</structfield> <type>bigint</type>
|
||||
</para>
|
||||
<para>
|
||||
Number of times the tuple to be deleted was not found during the application
|
||||
of changes. See <xref linkend="conflict-delete-missing"/> for details
|
||||
about this conflict.
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="catalog_table_entry"><para role="column_definition">
|
||||
<structfield>stats_reset</structfield> <type>timestamp with time zone</type>
|
||||
|
Reference in New Issue
Block a user