From: | "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com> |
---|---|
To: | Peter Smith <smithpb2250(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | RE: Conflict detection for update_deleted in logical replication |
Date: | 2024-10-28 03:06:34 |
Message-ID: | OS0PR01MB5716FF696A8AD271AFAE1EAF944A2@OS0PR01MB5716.jpnprd01.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thursday, October 24, 2024 1:00 PM Peter Smith <smithpb2250(at)gmail(dot)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(dot)hayato(at)fujitsu(dot)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(dot)moond412(at)gmail(dot)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.
Best Regards,
Hou zj
Attachment | Content-Type | Size |
---|---|---|
v6-0005-Add-a-tap-test-to-verify-the-new-slot-xmin-mechan.patch | application/octet-stream | 6.9 KB |
v6-0003-Support-the-conflict-detection-for-update_deleted.patch | application/octet-stream | 21.4 KB |
v6-0004-Add-a-detect_update_deleted-option-to-subscriptio.patch | application/octet-stream | 64.1 KB |
v6-0001-Maintain-the-oldest-non-removeable-tranasction-ID.patch | application/octet-stream | 17.9 KB |
v6-0002-Maintain-the-replication-slot-in-logical-launcher.patch | application/octet-stream | 11.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Hayato Kuroda (Fujitsu) | 2024-10-28 03:17:23 | RE: Pgoutput not capturing the generated columns |
Previous Message | Marcelo Fernandes | 2024-10-28 02:43:23 | Proposal to add exclusion constraint from existing index |