mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +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:
@@ -14,6 +14,12 @@
|
||||
|
||||
/*
|
||||
* Conflict types that could occur while applying remote changes.
|
||||
*
|
||||
* This enum is used in statistics collection (see
|
||||
* PgStat_StatSubEntry::conflict_count and
|
||||
* PgStat_BackendSubEntry::conflict_count) as well, therefore, when adding new
|
||||
* values or reordering existing ones, ensure to review and potentially adjust
|
||||
* the corresponding statistics collection codes.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
@@ -42,6 +48,8 @@ typedef enum
|
||||
*/
|
||||
} ConflictType;
|
||||
|
||||
#define CONFLICT_NUM_TYPES (CT_DELETE_MISSING + 1)
|
||||
|
||||
extern bool GetTupleTransactionInfo(TupleTableSlot *localslot,
|
||||
TransactionId *xmin,
|
||||
RepOriginId *localorigin,
|
||||
|
||||
Reference in New Issue
Block a user