Re: Conflict detection for update_deleted in logical replication - Mailing list pgsql-hackers

From shveta malik
Subject Re: Conflict detection for update_deleted in logical replication
Date
Msg-id CAJpy0uA4OucfeWHBUsYMCRwqF_a-RB4jJc23mpUSMdeLYHyJ+Q@mail.gmail.com
Whole thread Raw
In response to Re: Conflict detection for update_deleted in logical replication  (Amit Kapila <amit.kapila16@gmail.com>)
Responses RE: Conflict detection for update_deleted in logical replication
List pgsql-hackers
On Mon, Jun 23, 2025 at 4:20 PM Zhijie Hou (Fujitsu)
<houzj.fnst@fujitsu.com> wrote:
>
>
> Here is the V40 patch set

Thanks for the patches. Few comments:

1)
In get_subscription_info(), we are doing COUNT of rci-subscriptions
using below query:
SELECT count(*) AS nsub, COUNT(CASE WHEN subretainconflictinfo THEN 1
END) AS retain_conflict_info FROM pg_catalog.pg_subscription;

And then we are doing:
cluster->sub_retain_conflict_info = (strcmp(PQgetvalue(res, 0,
i_retain_conflict_info), "1") == 0);

i.e. get the value and compare with "1".  If the count of such subs is
say 2, won't it fail and will set sub_retain_conflict_info as 0?

2)
create_logical_replication_slots(void)
{
+ if (!count_old_cluster_logical_slots())
+ return;
+

We shall get rid of count_old_cluster_logical_slots() here as the
caller is checking it already.

3)
We can move the 'old_cluster.sub_retain_conflict_info' check from
create_conflict_detection_slot() to its caller. Then it will be more
informative and consistent with how we check migrate_logical_slots
outside of create_conflict_detection_slot()

thanks
Shveta



pgsql-hackers by date:

Previous
From: Pavel Luzanov
Date:
Subject: Re: Things I don't like about \du's "Attributes" column
Next
From: Ashutosh Bapat
Date:
Subject: Re: Logrep launcher race conditions leading to slow tests