RE: Conflict detection for update_deleted in logical replication
Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com>
Attachments
- v62-0002-Resume-retaining-the-information-for-conflict-de.patch (application/octet-stream) patch v62-0002
- v62-0001-Introduce-a-max_conflict_retention_duration-opti.patch (application/octet-stream) patch v62-0001
On Thursday, August 14, 2025 11:46 AM shveta malik <shveta.malik@gmail.com> wrote: > > On Wed, Aug 13, 2025 at 4:15 PM shveta malik <shveta.malik@gmail.com> > wrote: > > > > On Wed, Aug 13, 2025 at 10:41 AM Zhijie Hou (Fujitsu) > > <houzj.fnst@fujitsu.com> wrote: > > > > > > > > > Here is the V61 patch set which addressed above comments and the > comment by Nisha[2]. > > > > > > > Thank You for the patch. I tested the patch, please find a few comments: > > > > 1) > > Now when it stops-retention and later resumes it due to the fact that > > max_duration is meanwhile altered to 0, I get log: > > > > LOG: logical replication worker for subscription "sub1" resumes > > retaining the information for detecting conflicts > > DETAIL: The time spent applying changes up to LSN 0/17DD728 is now > > within the maximum limit of 0 ms. > > > > I did not get which lsn it is pointing to? Is it some dangling lsn > > from when it was retaining info? Also the msg looks odd, when it says > > 'is now within the maximum limit of 0 ms.' > > > > 2) > > While stopping the message is: > > LOG: logical replication worker for subscription "sub1" will stop > > retaining conflict information > > DETAIL: The time spent advancing the non-removable transaction ID has > > exceeded the maximum limit of 1000 ms. > > > > And while resuming: > > logical replication worker for subscription "sub1" resumes retaining > > the information for detecting conflicts > > ---------- > > > > We can make both similar. Both can have 'retaining the information for > > detecting conflicts' instead of 'conflict information' in first one. > > > > 3) > > I believe the tenses should also be updated. When stopping, we can say: > > > > Logical replication worker for subscription "sub1" has stopped... > > > > This is appropriate because it has already stopped by pre-setting > > oldest_nonremovable_xid to Invalid. > > > > When resuming, we can say: > > Logical replication worker for subscription "sub1" will resume... > > > > This is because it will begin resuming from the next cycle onward, > > specifically after the launcher sets its oldest_xid. > > > > 4) > > For the DETAIL part of resume and stop messages, how about these: > > > > The retention duration for information used in conflict detection has > > exceeded the limit of xx. > > The retention duration for information used in conflict detection is > > now within the acceptable limit of xx. > > The retention duration for information used in conflict detection is > > now indefinite. > > Thanks for the comments, I have adjusted the log messages according to the suggestions. > > 5) > Say there 2-3 subs, all have stopped-retention and the slot is set to have invalid > xmin; now if I create a new sub, it will start with stopped-flag set to true due to > the fact that slot has invalid xmin to begin with. But then immediately, it will > dump a resume message. It looks odd, as at first, it has not even stopped, as it > is a new sub. > Is there anything we can do to improve this situation? I changed the logic to recovery the slot immediately on starting a new worker that has retain_dead_tuples enabled. Here is the V62 patch set which addressed above comments and [1]. [1] https://www.postgresql.org/message-id/CAJpy0uBW8G2RNY%3DJjxzr_ootQ2MTxPQG98hz%3D-wdJzn86yapVg%40mail.gmail.com Best Regards, Hou zj
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