RE: Conflict detection for update_deleted in logical replication

From: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
To: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: RE: Conflict detection for update_deleted in logical replication
Date: 2025-05-22 02:58:42
Message-ID: OS0PR01MB57165332720E2948D376942A9499A@OS0PR01MB5716.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 20, 2025 at 6:30 PM shveta malik wrote:
>
> Few more comments mostly for patch001:

Thanks for the comments!

>
> 4)
> For this feature, since we are only interested in remote UPDATEs happening
> concurrently, so shall we ask primary to provide oldest "UPDATE"
> transaction-id in commit-phase rather than any operation's transaction-id?
> This may avoid unnecessarily waiting and pinging at subscriber's end in order
> to advance oldest_nonremovable-xid.
> Thoughts?

It is possible, but considering the potential complexity/cost to track UPDATE
operations in top-level and sub-transactions, coupled with its limited benefit
for workloads featuring frequent UPDATEs on publishers such as observed during
TPC-B performance tests, I have opted to document this possibility in comments
instead of implementing it in the patch set.

>
> 5)
> +
> +/*
> + * GetOldestTransactionIdInCommit()
> + *
> + * Similar to GetOldestActiveTransactionId but returns the oldest
> transaction ID
> + * that is currently in the commit phase.
> + */
> +TransactionId
> +GetOldestTransactionIdInCommit(void)
>
> If there is no transaction currently in 'commit' phase, this function will then
> return the next transaction-id. Please mention this in the comments. I think the
> doc 'protocol-replication.html' should also be updated for the same.

I added this info in the doc. But since we have merged this function with
GetOldestActiveTransactionId() which has the same behavior, so I am
not adding more code comments for the existing function.

Best Regards,
Hou zj

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou (Fujitsu) 2025-05-22 02:59:02 RE: Conflict detection for update_deleted in logical replication
Previous Message Zhijie Hou (Fujitsu) 2025-05-22 02:57:57 RE: Conflict detection for update_deleted in logical replication