RE: Conflict detection and logging in logical replication

Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com>

From: "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>
To: Nisha Moond <nisha.moond412@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>, Dilip Kumar <dilipbalaut@gmail.com>, shveta malik <shveta.malik@gmail.com>, Jan Wieck <jan@wi3ck.info>, Tomas Vondra <tomas.vondra@enterprisedb.com>, Amit Kapila <amit.kapila16@gmail.com>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Date: 2024-06-26T02:57:47Z
Lists: pgsql-hackers

Attachments

On Monday, June 24, 2024 8:35 PM Nisha Moond <nisha.moond412@gmail.com> wrote:
> 
> On Mon, Jun 24, 2024 at 7:39 AM Zhijie Hou (Fujitsu)
> <houzj.fnst@fujitsu.com> wrote:
> >
> > When testing the patch, I noticed a bug that when reporting the
> > conflict after calling ExecInsertIndexTuples(), we might find the
> > tuple that we just inserted and report it.(we should only report
> > conflict if there are other conflict tuples which are not inserted by
> > us) Here is a new patch which fixed this and fixed a compile warning
> reported by CFbot.
> >
> Thank you for the patch!
> A review comment: The patch does not detect 'update_differ' conflicts when
> the Publisher has a non-partitioned table and the Subscriber has a partitioned
> version.

Thanks for reporting the issue !

Here is the new version patch set which fixed this issue. I also fixed
some typos and improved the doc in logical replication conflict based
on the comments from Shveta[1].

[1] https://www.postgresql.org/message-id/CAJpy0uABSf15E%2BbMDBRCpbFYo0dh4N%3DEtpv%2BSNw6RMy8ohyrcQ%40mail.gmail.com

Best Regards,
Hou zj

Commits

  1. Rename the conflict types for the origin differ cases.

  2. Doc: explain the log format of logical replication conflicts.

  3. Log the conflicts while applying changes in logical replication.

  4. Avoid duplicate table scans for cross-partition updates during logical replication.