From 20e2d08ba853a61523b6356b12cd600cc31217ad Mon Sep 17 00:00:00 2001 From: Hou Zhijie Date: Fri, 21 Mar 2025 13:50:27 +0800 Subject: [PATCH v2 1/3] fix comments and tests --- src/backend/replication/logical/conflict.c | 9 ++------- src/include/replication/conflict.h | 15 ++++++--------- src/test/subscription/t/035_conflicts.pl | 2 +- src/tools/pgindent/typedefs.list | 1 + 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/backend/replication/logical/conflict.c b/src/backend/replication/logical/conflict.c index b1614d3aaf6..9295c8ef6c1 100644 --- a/src/backend/replication/logical/conflict.c +++ b/src/backend/replication/logical/conflict.c @@ -91,15 +91,10 @@ GetTupleTransactionInfo(TupleTableSlot *localslot, TransactionId *xmin, * 'searchslot' should contain the tuple used to search the local tuple to be * updated or deleted. * - * 'conflictslots' list contains the existing local tuples, if any, that - * conflicts with the remote tuple. 'localxmins', 'localorigins', and 'localts' - * provide the transaction information related to the existing local tuples. - * * 'remoteslot' should contain the remote new tuple, if any. * - * The 'conflictindexes' list represents the OIDs of the unique index that - * triggered the constraint violation error. We use this to report the key - * values for conflicting tuple. + * 'conflicttuples' should be a list composed of ConflictTupleInfo pointer. + * Refer to the ConflictTupleInfo structure comments for details. * * The caller must ensure that the index with the OID 'indexoid' is locked so * that we can fetch and display the conflicting key value. diff --git a/src/include/replication/conflict.h b/src/include/replication/conflict.h index 06d5d05c560..4d0bab0dd28 100644 --- a/src/include/replication/conflict.h +++ b/src/include/replication/conflict.h @@ -55,18 +55,15 @@ typedef enum /* - * Information for the exiting local tuple that caused the conflict. + * Information for the existing local tuple that caused the conflict. */ typedef struct ConflictTupleInfo { - TupleTableSlot *slot; - Oid indexoid; /* conflicting index */ - TransactionId xmin; /* transaction ID that modified the existing - * local tuple */ - RepOriginId origin; /* which origin modified the exiting local - * tuple */ - TimestampTz ts; /* when the exiting local tuple was modified - * by the origin */ + TupleTableSlot *slot; /* tuple slot holding the conflicting local tuple */ + Oid indexoid; /* OID of the index where the conflict occurred */ + TransactionId xmin; /* transaction ID of the modification causing the conflict */ + RepOriginId origin; /* origin identifier of the modification */ + TimestampTz ts; /* timestamp of when the modification on the conflicting local tuple occurred */ } ConflictTupleInfo; extern bool GetTupleTransactionInfo(TupleTableSlot *localslot, diff --git a/src/test/subscription/t/035_conflicts.pl b/src/test/subscription/t/035_conflicts.pl index f1417e313db..37f8af07995 100644 --- a/src/test/subscription/t/035_conflicts.pl +++ b/src/test/subscription/t/035_conflicts.pl @@ -109,7 +109,7 @@ $node_publisher->safe_psql('postgres', # Confirm that this causes an error on the subscriber $node_subscriber->wait_for_log( - qr/ERROR: conflict detected on relation \"public.conf_tab\": conflict=multiple_unique_conflicts/, + qr/conflict detected on relation \"public.conf_tab\": conflict=multiple_unique_conflicts/, $log_offset); ok( $node_subscriber->log_contains( diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list index bfa276d2d35..3fbf5a4c212 100644 --- a/src/tools/pgindent/typedefs.list +++ b/src/tools/pgindent/typedefs.list @@ -480,6 +480,7 @@ ConditionVariableMinimallyPadded ConditionalStack ConfigData ConfigVariable +ConflictTupleInfo ConflictType ConnCacheEntry ConnCacheKey -- 2.30.0.windows.2