RE: Conflict detection for update_deleted in logical replication
Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com>
Attachments
- v6-0005-Add-a-tap-test-to-verify-the-new-slot-xmin-mechan.patch (application/octet-stream) patch v6-0005
- v6-0003-Support-the-conflict-detection-for-update_deleted.patch (application/octet-stream) patch v6-0003
- v6-0004-Add-a-detect_update_deleted-option-to-subscriptio.patch (application/octet-stream) patch v6-0004
- v6-0001-Maintain-the-oldest-non-removeable-tranasction-ID.patch (application/octet-stream) patch v6-0001
- v6-0002-Maintain-the-replication-slot-in-logical-launcher.patch (application/octet-stream) patch v6-0002
On Thursday, October 24, 2024 1:00 PM Peter Smith <smithpb2250@gmail.com> wrote:
Thanks Peter, Kuroda-san and Nisha for the comments.
>
> Hi Hou-san, here are my review comments for patch v5-0001.
>
> 15.
> + /*
> + * Exit early if the user has disabled sending messages to the
> + * publisher.
> + */
> + if (wal_receiver_status_interval <= 0) return;
>
> What are the implications of this early exit? If the update request is not possible,
> then I guess the update status is never received, but then I suppose that means
> none of this update_deleted logic is possible. If that is correct, then will there
> be some documented warning/caution about conflict-handling implications by
> disabling that GUC?
The detection of update_deleted is still possible in this case, but the dead tuple
cannot be cleaned up without communicating with the publisher. I have documented
this in the 0004 patch where the subscription option is added.
On Friday, October 25, 2024 2:17 PM Kuroda, Hayato/黒田 隼人 <kuroda.hayato@fujitsu.com> wrote:
> > Here is the V5 patch set which addressed above comments.
>
> Thanks for updating the patch! While reviewing yours, I found a corner case
> that
> a recently deleted tuple cannot be detected when index scan is chosen.
> This can happen when indices are re-built during the replication.
> Unfortunately, I don't have any solutions for it.
Thanks for reporting. I changed the patch to use table scan in all cases, since
It is used only in conflict cases, so it could be OK, but I will
think if there are better solutions for it based on Mikhail's reply[1].
On Friday, October 25, 2024 4:51 PM Nisha Moond <nisha.moond412@gmail.com> wrote:
> 1) In FindMostRecentlyDeletedTupleInfo(),
>
> + /* Try to find the tuple */
> + while (index_getnext_slot(scan, ForwardScanDirection, scanslot)) {
> + Assert(tuples_equal(scanslot, searchslot, eq));
> + update_recent_dead_tuple_info(scanslot, oldestXmin, delete_xid,
> + delete_time, delete_origin);
> + }
>
> In my tests, I found that the above assert() triggers during unidirectional
> replication of an update on a table. While doing the replica identity index scan,
> it can only ensure to match the indexed columns value, but the current Assert()
> assumes all the column values should match, which seems wrong.
Thanks for reporting. These codes have been removed in V6 patch set.
>
> 2) Since update_deleted requires both 'track_commit_timestamp' and the
> 'detect_update_deleted' to be enabled, should we raise an error in the CREATE
> and ALTER subscription commands when track_commit_timestamp=OFF but
> the user specifies detect_update_deleted=true?
Added.
Attach the V6 patch set which addressed all the comments so far.
[1] https://www.postgresql.org/message-id/CANtu0ohzMB38tcf2%3Dq1HVCdz%2BeEpBBauHhMoATz_%3DYFEjDd7FQ%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