diff options
author | Amit Kapila <akapila@postgresql.org> | 2024-08-20 08:35:11 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2024-08-20 08:35:11 +0530 |
commit | 9758174e2e5cd278cf37e0980da76b51890e0011 (patch) | |
tree | 9ca019972be8f6b4b20acd98cdeb12a9475851e9 /src/backend/access/index/genam.c | |
parent | adf97c1562380e02acd60dc859c289ed3a8352ee (diff) |
Log the conflicts while applying changes in logical replication.
This patch provides the additional logging information in the following
conflict scenarios while applying changes:
insert_exists: Inserting a row that violates a NOT DEFERRABLE unique constraint.
update_differ: Updating a row that was previously modified by another origin.
update_exists: The updated row value violates a NOT DEFERRABLE unique constraint.
update_missing: The tuple to be updated is missing.
delete_differ: Deleting a row that was previously modified by another origin.
delete_missing: The tuple to be deleted is missing.
For insert_exists and update_exists conflicts, the log can include the origin
and commit timestamp details of the conflicting key with track_commit_timestamp
enabled.
update_differ and delete_differ conflicts can only be detected when
track_commit_timestamp is enabled on the subscriber.
We do not offer additional logging for exclusion constraint violations because
these constraints can specify rules that are more complex than simple equality
checks. Resolving such conflicts won't be straightforward. This area can be
further enhanced if required.
Author: Hou Zhijie
Reviewed-by: Shveta Malik, Amit Kapila, Nisha Moond, Hayato Kuroda, Dilip Kumar
Discussion: https://postgr.es/m/OS0PR01MB5716352552DFADB8E9AD1D8994C92@OS0PR01MB5716.jpnprd01.prod.outlook.com
Diffstat (limited to 'src/backend/access/index/genam.c')
-rw-r--r-- | src/backend/access/index/genam.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c index de751e8e4a3..43c95d6109b 100644 --- a/src/backend/access/index/genam.c +++ b/src/backend/access/index/genam.c @@ -154,8 +154,9 @@ IndexScanEnd(IndexScanDesc scan) * * Construct a string describing the contents of an index entry, in the * form "(key_name, ...)=(key_value, ...)". This is currently used - * for building unique-constraint and exclusion-constraint error messages, - * so only key columns of the index are checked and printed. + * for building unique-constraint, exclusion-constraint error messages, and + * logical replication conflict error messages so only key columns of the index + * are checked and printed. * * Note that if the user does not have permissions to view all of the * columns involved then a NULL is returned. Returning a partial key seems |