Re: Proposal: Conflict log history table for Logical Replication

From: Zhijie Hou <houzhijie22(at)gmail(dot)com>
To: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, shihao zhong <zhong950419(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, saurabh singh <saurabh(dot)singh214(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, shveta malik <shvetamalik(at)gmail(dot)com>
Subject: Re: Proposal: Conflict log history table for Logical Replication
Date: 2026-11-25 06:38:42
Message-ID: da735675-34a2-450e-933b-4474ff4823bc@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Wed, Nov25, 2026 at 01:43 PM Nisha Moond wrote:
>
> Please find attached patch with the comment change suggested above. It
> also combines a few pending fixes for commit a5918fddf1:
> 1) The missing pg_subscription column entries in catalogs.sgml, and
> some code comment rewrites from [1].
> 2) The issue reported by Zsolt and the fix he provided at [2]
Thanks for sharing the patch.

I have few comments:

1.
@@ -2777,6 +2780,14 @@ DropSubscription(DropSubscriptionStmt *stmt, bool
isTopLevel)
if (slotname)
PreventInTransactionBlock(isTopLevel, "DROP SUBSCRIPTION");

+ /*
+ * Drop the conflict log table first. With RESTRICT this fails if other
+ * objects depend on it, so do it before any non-transactional cleanup
+ * below.
+ */
+ drop_sub_conflict_log_table(subid, subname, subconflictlogrelid,
+ stmt->behavior);

Moving drop_sub_conflict_log_table() here places it before the
LookupGXactBySubid() check, which breaks the 2PC deadlock guard added in
6a0a66b3e7.

2.
When ALTER SUBSCRIPTION ... SET (conflict_log_destination = 'log') fails
due to dependent objects on the conflict log table, it reports:

ERROR: cannot drop subscription sub1 because other objects depend on it
DETAIL: view mon_view depends on table pg_conflict.pg_conflict_log_16399
HINT: Use DROP ... CASCADE to drop the dependent objects too.

This message gives the impression that we are dropping the subscription,
whereas ALTER SUBSCRIPTION is only dropping the conflict log table.

3.
+ * ... DELETE and
+ * TRUNCATE are the only data operations allowed, so that users can still
+ * prune old conflict rows.

I think we shall either mention SELECT here as well, since users can
query from the conflict log table.

--
Best Regards,
Zhijie Hou

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-11-25 06:43:54 Re: Infinite loop in XLogPageRead() on standby
Previous Message Hayato Kuroda (Fujitsu) 2026-11-25 06:32:58 RE: Proposal: Conflict log history table for Logical Replication