Re: Conflict detection for update_deleted in logical replication
Amit Kapila <amit.kapila16@gmail.com>
Attachments
- v30_0001_amit.1.patch.txt (text/plain)
On Fri, May 16, 2025 at 5:01 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > Please find some more comments on the 0001 patch: 1. We need to know about such transactions + * for conflict detection and resolution in logical replication. See + * GetOldestTransactionIdInCommit and its use. Do we need to mention resolution in the above sentence? This patch is all about detecting conflict reliably. 2. In wait_for_publisher_status(), we use remote_epoch, remote_nextxid, and remote_oldestxid to compute full transaction id's. Why can't we send FullTransactionIds for remote_oldestxid and remote_nextxid from publisher? If these are required, maybe a comment somewhere for that would be good. 3. /* + * Note it is important to set committs value after marking ourselves as + * in the commit critical section (DELAY_CHKPT_IN_COMMIT). This is because + * we want to ensure all such transactions are finished before we allow + * the logical replication client to advance its xid which is used to hold + * back dead rows for conflict detection. See + * maybe_advance_nonremovable_xid. + */ + committs = GetCurrentTimestamp(); How does setting committs after setting DELAY_CHKPT_IN_COMMIT help in advancing client-side xid? IIUC, on client-side, we simply wait for such an xid to be finished based on the remote_oldestxid and remote_nextxid sent via the server. So, the above comment is not completely clear to me. I have updated this and related comments in the attached diff patch to make it clear. See if that makes sense to you. 4. In 0001's commit message, we have: "Furthermore, the preserved commit timestamps and origin data are essential for consistently detecting update_origin_differs conflicts." But it is not clarified how this patch helps in consistently detecting update_origin_differs conflict? 5. I have tried to add some more details in comments on why oldest_nonremovable_xid needs to be FullTransactionId. See attached. -- With Regards, Amit Kapila.
Commits
-
Fix intermittent BF failures in 035_conflicts.
- 0f42206531b3 19 (unreleased) landed
-
Resume conflict-relevant data retention automatically.
- 0d48d393d465 19 (unreleased) landed
-
Fix intermittent test failure introduced in 6456c6e2c4.
- 01d793698f59 19 (unreleased) landed
-
Fix Coverity issue reported in commit a850be2fe.
- 5ac3c1ac22cb 19 (unreleased) landed
-
Add test to prevent premature removal of conflict-relevant data.
- 6456c6e2c4ad 19 (unreleased) landed
-
Post-commit review fixes for 228c370868.
- 1f7e9ba3ac4e 19 (unreleased) landed
-
Add max_retention_duration option to subscriptions.
- a850be2fe653 19 (unreleased) landed
-
Detect and report update_deleted conflicts.
- fd5a1a0c3e56 19 (unreleased) landed
-
Preserve conflict-relevant data during logical replication.
- 228c37086855 19 (unreleased) landed
-
Integrate FullTransactionIds deeper into two-phase code
- 62a17a92833d 19 (unreleased) cited
-
Improve checks for GUC recovery_target_timeline
- fd7d7b719137 19 (unreleased) cited
-
Prevent excessive delays before launching new logrep workers.
- fd519419c948 18.0 cited
-
Keep WAL segments by slot's last saved restart LSN
- ca307d5cec90 18.0 cited
-
Rework some code handling pg_subscription data in psql and pg_dump
- 08691ea958c2 18.0 cited
-
Use generateClonedIndexStmt to propagate CREATE INDEX to partitions.
- 68dfecbef210 18.0 cited