Re: Proposal: Conflict log history table for Logical Replication

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: shveta malik <shveta(dot)malik(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal: Conflict log history table for Logical Replication
Date: 2025-11-24 06:21:40
Message-ID: CAFiTN-vGGMESm4K6GnyowdTfdqirGvx8beZDfaAXKqDTkQ6UpQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 20, 2025 at 5:38 PM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
>
I was working on these pending items, there is something where I got
stuck, I am exploring this more but would like to share the problem.

> 2) Need to add replica identity tuple instead of full tuple - reported by Shveta
I have worked on fixing this along with other comments by Peter, now
we can see only RI tuple is inserted as part of the key_tuple, IMHO
lets keep the name as key tuple as it will use the primary key or
unique key if no explicit replicate identity is set, thoughts?

postgres[3048044]=# select * from myschema.conflict_log_history2;
relid | schemaname | relname | conflict_type | local_xid |
remote_xid | remote_commit_lsn | local_commit_ts |
remote_commit_ts | local_o
rigin | remote_origin | key_tuple | local_tuple | remote_tuple
-------+------------+---------+-----------------------+-----------+------------+-------------------+-------------------------------+-------------------------------+--------
------+---------------+-----------+----------------+----------------
16385 | public | test | update_origin_differs | 765 |
759 | 0/0174F2E8 | 2025-11-24 06:16:50.468263+00 |
2025-11-24 06:16:55.483507+00 |
| pg_16396 | {"a":1} | {"a":1,"b":10} | {"a":1,"b":20}

Now pending work status
1) fixed review comments of 0002 and 0003 - Pending
2) Need to add replica identity tuple instead of full tuple -- Done
3) Keeping the logs in case of outer transaction failure by moving log
insertion outside the main transaction - reported by Shveta - Pending
4) Run pgindent -- planning to do it after we complete the first level
of review - Pending
5) Subscription test cases for logging the actual conflicts - Pending

--
Regards,
Dilip Kumar
Google

Attachment Content-Type Size
v6-0001-Add-configurable-conflict-log-table-for-Logical-R.patch application/octet-stream 99.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ajin Cherian 2025-11-24 06:42:28 Re: Improve pg_sync_replication_slots() to wait for primary to advance
Previous Message Soumya S Murali 2025-11-24 06:10:44 [PATCH] Expose checkpoint timestamp and duration in pg_stat_checkpointer