RE: Conflict detection and logging in logical replication

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

From: "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>
To: Amit Kapila <amit.kapila16@gmail.com>, shveta malik <shveta.malik@gmail.com>
Cc: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, Nisha Moond <nisha.moond412@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>, Dilip Kumar <dilipbalaut@gmail.com>, Jan Wieck <jan@wi3ck.info>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Date: 2024-08-18T08:49:37Z
Lists: pgsql-hackers
On Friday, August 16, 2024 2:49 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
> 
> 
> > --------------------
> >
> > One more comment:
> >
> > 5)
> > For insert/update_exists, the sequence is:
> > Key .. ; existing local tuple .. ; remote tuple ...
> >
> > For rest of the conflicts, sequence is:
> >  Existing local tuple .. ; remote tuple .. ; replica identity ..
> >
> > Is it intentional? Shall the 'Key' or 'Replica Identity' be the first
> > one to come in all conflicts?
> >
> 
> This is worth considering but Replica Identity signifies the old tuple values,
> that is why it is probably kept at the end. 

Right. I personally think the current position is ok.

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.