postgresql/src/include/replication
Amit Kapila fd5a1a0c3e Detect and report update_deleted conflicts.
This enhancement builds upon the infrastructure introduced in commit
228c370868, which enables the preservation of deleted tuples and their
origin information on the subscriber. This capability is crucial for
handling concurrent transactions replicated from remote nodes.

The update introduces support for detecting update_deleted conflicts
during the application of update operations on the subscriber. When an
update operation fails to locate the target row-typically because it has
been concurrently deleted-we perform an additional table scan. This scan
uses the SnapshotAny mechanism and we do this additional scan only when
the retain_dead_tuples option is enabled for the relevant subscription.

The goal of this scan is to locate the most recently deleted tuple-matching
the old column values from the remote update-that has not yet been removed
by VACUUM and is still visible according to our slot (i.e., its deletion
is not older than conflict-detection-slot's xmin). If such a tuple is
found, the system reports an update_deleted conflict, including the origin
and transaction details responsible for the deletion.

This provides a groundwork for more robust and accurate conflict
resolution process, preventing unexpected behavior by correctly
identifying cases where a remote update clashes with a deletion from
another origin.

Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/OS0PR01MB5716BE80DAEB0EE2A6A5D1F5949D2@OS0PR01MB5716.jpnprd01.prod.outlook.com
2025-08-04 04:02:47 +00:00
..
conflict.h Detect and report update_deleted conflicts. 2025-08-04 04:02:47 +00:00
decode.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
logical.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
logicallauncher.h Preserve conflict-relevant data during logical replication. 2025-07-23 02:56:00 +00:00
logicalproto.h Change publication's publish_generated_columns option type to enum. 2025-01-23 15:28:37 +05:30
logicalrelation.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
logicalworker.h Rename some signal and interrupt handling functions for consistency 2025-03-05 16:22:26 +02:00
message.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
origin.h Remove pg_replication_origin's TOAST table. 2025-05-07 14:47:36 -05:00
output_plugin.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
pgoutput.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
reorderbuffer.h Fix re-distributing previously distributed invalidation messages during logical decoding. 2025-06-16 17:36:01 -07:00
slot.h Preserve conflict-relevant data during logical replication. 2025-07-23 02:56:00 +00:00
slotsync.h pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
snapbuild.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
snapbuild_internal.h pg_logicalinspect: Fix possible crash when passing a directory path. 2025-03-11 09:56:40 -07:00
syncrep.h Return yyparse() result not via global variable 2025-01-24 06:55:39 +01:00
walreceiver.h Use standard die() signal handler in walreceiver 2025-04-04 12:38:32 +03:00
walsender.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
walsender_private.h Fix race with synchronous_standby_names at startup 2025-04-11 10:00:21 +09:00
worker_internal.h Detect and report update_deleted conflicts. 2025-08-04 04:02:47 +00:00