Re: unidirectional logical replication logging issue

From: Fabrice Chapuis <commeilmeplait(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: unidirectional logical replication logging issue
Date: 2026-11-27 16:06:00
Message-ID: CADmBQcNT7fhFk+CSY_7PDH753avXUBnEuRbDpeM25xvs7dBkrA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Amit,

Thanks for the suggestion.

I tested VACUUM (FREEZE) on the subscriber after reloading the data and
before executing the UPDATE on the publisher.

Unfortunately, I still get update_origin_differs messages in the subscriber
logs when the replicated UPDATE is applied.

I also noticed a recent discussion on pgsql-hackers regarding
GetTupleTransactionInfo() using the raw xmin of frozen tuples:

PostgreSQL: Avoid using raw xmin of frozen tuples in logicalrep conflict
detection
<https://www.postgresql.org/message-id/CAFvd2n_S%2B%2BxXFtDe208kbZUDbdeH8OabcGvOi6UdbdeJmUfgOQ%40mail.gmail.com>

As I understand it, this could potentially explain why the conflicts are
still reported even after running VACUUM (FREEZE).

I have checked the tuple infomask using pageinspect to confirm that the
affected rows were actually frozen before the replicated UPDATE.

I'll follow the Resolutions patch discussion and provide feedback on the
relevant thread when development resumes.

Regards,
Fabrice

On Fri, 27 Nov 2026 at 13:43, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:

> On Wed, Nov 25, 2026 at 9:57 PM Fabrice Chapuis
> <commeilmeplait(at)gmail(dot)com> wrote:
> >
> > Thanks for your feedback.
> >
> > Let me clarify our use case.
> >
> > Periodically, we need to refresh both databases with data coming from
> another environment. Our procedure is:
> >
> > Drop the subscription.
> >
> > Reload the source and destination tables from the same consistent
> dataset.
> >
> > Recreate the subscription with copy_data = false, since both sides
> already contain identical data.
> >
> > This procedure works correctly, and the publisher and subscriber are
> fully synchronized after the reload.
> > The issue occurs later, when the application executes a large UPDATE
> affecting millions of rows on the publisher. Since the corresponding rows
> on the subscriber were loaded locally, PostgreSQL 18 detects
> update_origin_differs conflicts for these rows.
> > The incoming UPDATEs are applied successfully, but PostgreSQL generates
> a LOG message for each affected row
> >
>
> This LOG should appear only after the first time the row has been
> updated. BTW, can you try "VACUUM (FREEZE) <tbl_name>;" on the
> subscriber after reload because that should let
> GetTupleTransactionInfo() to return false and the conflict shouldn't
> be reported in the particular scenario you shared.
>
> > Regarding the Resolutions patch, would it allow us to suppress the
> reporting of these expected update_origin_differs conflicts in the log
> while still applying the incoming UPDATEs normally, preferably keeping
> conflict detection and statistics enabled?
> >
>
> I don't know at this stage but surely we can consider during
> Resouldtions development. Kindly do provide the feedback on the
> relavant thread once the work on it is restarted.
>
> --
> With Regards,
> Amit Kapila.
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou 2026-11-27 16:08:10 REPACK (CONCURRENTLY) fails during parallel build of exclusion constraint indexes
Previous Message Tom Lane 2026-11-27 16:00:51 What is up on BF member kestrel?